< Previous PageNext Page > Hide TOC

Getting Font Metrics

NSFont defines a number of methods for accessing a font’s metrics information, when that information is available. Methods such as boundingRectForGlyph:, boundingRectForFont, xHeight, and so on, all correspond to standard font metrics information. Figure 1 shows how the font metrics apply to glyph dimensions, and Table 1 lists the method names that correlate with the metrics. See the various method descriptions for more specific information.


Figure 1  Font metrics

Font metrics

Table 1  Font metrics and related NSFont methods

Font metric

Methods

Advancement

advancementForGlyph:, maximumAdvancement

X-height

xHeight

Ascent

ascender

Bounding rectangle

boundingRectForFont, boundingRectForGlyph:

Cap height

capHeight

Line height

defaultLineHeightForFont, pointSize, labelFontSize, smallSystemFontSize, systemFontSize, systemFontSizeForControlSize:

Descent

descender

Italic angle

italicAngle



< Previous PageNext Page > Hide TOC


© 1997, 2008 Apple Inc. All Rights Reserved. (Last updated: 2008-02-08)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.