Important: The information in this document is obsolete and should not be used for new development.
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:
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.
- The
CharWidthfunction returns the horizontal extension of a single glyph.- The
StringWidthfunction returns the width of a Pascal string.- The
TextWidthfunction returns the width of the glyphs of a text segment.- The
MeasureTextprocedure 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
MeasureJustifiedprocedure 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.
Subtopics
- CharWidth
- StringWidth
- TextWidth
- MeasureText
- MeasureJustified