PeachDrawing.Text
PeachDrawing.Text
TypefaceMetrics Class
The vertical dimensions of a Typeface, in design units: whole numbers on the grid the font was drawn on, UnitsPerEm of them to the em.
public sealed class TypefaceMetrics
Inheritance System.Object → TypefaceMetrics
Remarks
Nothing here depends on a text size. To get a length at a size, multiply by the size and divide by UnitsPerEm. Distances above the baseline are positive, and a descent is a positive length below it in every font that follows the specification; a font that records a descent with the wrong sign is reported as it is.
Two sets of line dimensions are given because platforms disagree about which one text is laid out with.
CellAscent, CellDescent and LineSpacing are the rectangle Windows
draws a line of text in, derived from the OS/2 Windows metrics unless the font asks for its typographic
metrics; in that case the typographic line gap is folded into the cell ascent, so the cell can be taller than
NormalLineAscent. NormalLineAscent, NormalLineDescent and
NormalLineGap are what browsers use for CSS line-height: normal: the hhea triple, or
the OS/2 typographic triple when the font sets its USE_TYPO_METRICS bit and records typographic metrics
at all.
| Properties | |
|---|---|
| CapHeight | The height of a flat capital letter above the baseline. A font that does not record it (an OS/2 table older than version 2) reports its CellAscent, which is the fallback CSS Values 4 prescribes for the cap unit. |
| CellAscent | The height of the line cell above the baseline. |
| CellDescent | The depth of the line cell below the baseline. |
| FirstCharIndex | The lowest character code the font’s OS/2 table says it covers; a symbol font’s codes are offset by its high byte. |
| HasMeasuredXHeight | Whether XHeight is the font’s own figure and not an estimate. |
| HasSerifs | Whether the font’s OS/2 family class is one of the serif classes, 1 to 7. A font that says nothing, or is a sans serif, a script or a symbol font, reports false. |
| IsFixedPitch | Whether every glyph advances by the same width (the post table’s isFixedPitch, the authoritative signal, unlike PANOSE). |
| IsItalicStyle | Whether the OS/2 selection flags mark the face italic. This is the font’s own claim: IsItalic is the answer to use for choosing a face. |
| IsSymbolic | Whether the font’s character map is a symbol one (a cmap subtable for platform 3, encoding 0), whose codes are in the private range starting at FirstCharIndex and not Unicode. |
| ItalicAngle | The angle of italic strokes in degrees counter-clockwise from vertical, so negative for a slope to the right (the post table). |
| LineSpacing | The distance from one baseline to the next when lines are set solid: the cell plus any external leading, which is none when the font asks for its typographic metrics. |
| NormalLineAscent | The height above the baseline that CSS line-height: normal uses. |
| NormalLineDescent | The depth below the baseline that CSS line-height: normal uses. |
| NormalLineGap | The gap between lines that CSS line-height: normal adds to the ascent and descent, never negative. |
| StrikeoutPosition | The position of the strikeout stroke relative to the baseline (the OS/2 table). |
| StrikeoutThickness | The thickness of the strikeout stroke. |
| UnderlinePosition | The position of the top of the underline stroke relative to the baseline, negative below it (the post table). |
| UnderlineThickness | The thickness of the underline stroke, which a poorly authored font may give as 0. |
| UnitsPerEm | The number of design units to the em square (the head table’s unitsPerEm). |
| XHeight | The height of a lower-case letter without an ascender above the baseline. A font that does not record it reports 66 percent of its CellAscent, and HasMeasuredXHeight says so. |
| XMax | The right edge of the box that holds every glyph. |
| XMin | The left edge of the box that holds every glyph (the head table’s xMin). |
| YMax | The top edge of the box that holds every glyph. |
| YMin | The bottom edge of the box that holds every glyph. |