- Inside Macintosh: Text /
- Chapter 3 - QuickDraw Text / QuickDraw Text Reference
- Routines
Measuring Text
Laying out text to determine how much of it fits on the display line entails measuring the text. QuickDraw provides five high-level routines that let you do this:
- The
CharWidth function returns the horizontal extension of a single glyph.
- The
StringWidth function returns the width of a Pascal string.
- The
TextWidth function returns the width of the glyphs of a text segment.
- The
MeasureText procedure fills an array with an entry for each character identifying the width of each character's glyph as measured from the left side of the entire text segment.
- The
MeasureJustified procedure fills an array with an entry for each character in a style run identifying the width of each character's glyph as measured from the left side of the text segment.
These routines measure text in the font, style, and size of the current graphics port. Consequently, you need to call them once for each individual style run in any line of text that contains multiple style runs.
Subtopics
- CharWidth
-
- StringWidth
-
- TextWidth
-
- MeasureText
-
- MeasureJustified
-
© Apple Computer, Inc.
6 JUL 1996