Important: The information in this document is obsolete and should not be used for new development.
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
andOutlineMetrics
. In addition, QuickDraw provides font measurement information in theGetFontInfo
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. TheFontMetrics
procedure returns these measurements in a font metrics record (of data typeFMetricRec
), which allows fractional widths, whereas QuickDraw'sGetFontInfo
procedure returns a font information record (of data typeFontInfo
), 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. TheGetFontInfo
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. TheFontMetrics
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.) TheOutlineMetrics
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.