On Thursday, July 5, 2012 8:37:00 PM UTC-4, Jim Douglas wrote:
http://google-web-toolkit.--googlecode.com/svn/javadoc/2. 5/com/google/gwt/canvas/dom/ client/Context2d.html#setFont( java.lang.String)
http://google-web-toolkit.googlecode.com/svn/javadoc/2. 5/com/google/gwt/canvas/dom/ client/Context2d.html# measureText(java.lang.String)
http://google-web-toolkit.googlecode.com/svn/javadoc/2. 5/com/google/gwt/canvas/dom/ client/TextMetrics.html# getWidth()
On Jul 5, 4:17 pm, Sean <slough...@gmail.com> wrote:
> Hey guys,
>
> I was wondering if there was a way I can set the font in a canvas:
> *m_context.setFont("bold 12px sans-serif");*
>
> Then take some text, like Hello World! and know how many pixels wide that
> will be? I have a set space on my canvas, and I want to maximize the size
> of the text or justify it correctly. So if I know Hello World will take 50
> pixels in the X-direction, but I have 75 pixels, I can start it at
> x+(75-50)/2.0 pixels and have it centered.
>
> Thanks!
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/ZKfujDz_UBsJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment