Font size depends on display resolution and display/browser settings (users can increase or decrease the font size as they like). Also remember that users are not guaranteed to have the font you want (even the most popular ones), and their browser may use a sightly different font instead.
You can render the page, then measure the element (span or div) that contains your text, then adjust the font size as necessary, but this may result in a jumpy page (in some cases a browser will have to re- render the entire page if dimensions of a single div change). I don't know your requirements, but if you have to be precise, you can use canvas. On Jul 27, 12:20 pm, Nano Elefant <[email protected]> wrote: > Hello, > > Is there a way to set the font and font size of either a HTML, > RichTextArea or TextArea in code? > Is there a way to calculate the width and height of a text if i know > the font? > > Any ideas? -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
