• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 10. Controlling Text > Determining the Dimensions of Text

Determining the Dimensions of Text

When creating dynamic text fields with specific text and formatting at run time, you’ll likely need to know the exact size of your text for layout purposes. For example, if you want to display a user’s name on the screen, you’ll need to know the size of the text so you can create a text field big enough to accommodate it. A particular bit of text can be measured by six properties: ascent, descent, width, height, textFieldWidth, and textFieldHeight (Figure 10.73). Knowing these measurements will allow you to create a text field that can display all the text without cropping.

Figure 10.73. Text fields have six measurements that can be retrieved through the getTextExtent method: ascent, descent, width, height, textFieldWidth, and textFieldHeight.



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint