Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Text /
Chapter 4 - Font Manager / Using the Font Manager


Getting Font Measurement Information

You sometimes need to get font measurement information for the text font in the current graphics port. The Font Manager provides two routines for this purpose: FontMetrics and OutlineMetrics. In addition, QuickDraw provides font measurement information in the GetFontInfo procedure. You can use this information when arranging the glyphs of one font or several fonts on a line or to calculate adjustments needed when font size or style changes.

The FontMetrics procedure can be used on any kind of font, whether bitmapped or outline. It returns the ascent and descent measurements, the width of the largest glyph in the font, and the leading measurements. The FontMetrics procedure returns these measurements in a font metrics record (of data type FMetricRec), which allows fractional widths, whereas QuickDraw's GetFontInfo procedure returns a font information record (of data type FontInfo), which uses integer widths. In addition to these four measurements, the font metrics record includes a handle to the global width table, which in turn contains a handle to the font family resource for the current text font. The GetFontInfo procedure and the font information record are described in the chapter "QuickDraw Text" in this book. The global width table is described on page 4-32. The FontMetrics procedure and the font metrics record are described on page 4-50.

The OutlineMetrics function returns measurements for glyphs to be displayed in an outline font. The function returns an error if the text font in the current graphics port is any other kind of font. These measurements include the maximum y-values, minimum y-values, advance widths, left-side bearings, and bounding boxes. (For the definitions of these terms, see the section "About Fonts," which begins on page 4-6.) The OutlineMetrics function is described beginning on page 4-52.

For a font of a non-Roman script system that uses an associated font, the font measurements reflect combined values from the current font and the associated font. This is to accommodate the script system's automatic display of Roman characters in the associated font instead of the current font. See the discussion of associated fonts in the chapter "Introduction to Text on the Macintosh" in this book.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996