Both the visible and invisible parts of a character affect its measurement. The visible part of a character is called a glyph. The invisible part is a rectangular region that contains the character; this region is called a character cell. The origin of a character cell is its upper-left corner. When a text-output function specifies coordinates at which the text should appear, GDI places the origin of the first character cell at those coordinates. (This is the default behavior for GDI. An application can change this at any time by using the SetTextAlign function.)
The most common unit of measurement for measuring characters is the point. In the computer industry, a point is exactly 1/72 of an inch. Font heights in Windows can be specified in “twips,” which are 1/20 of a point (that is, 1/1440 of an inch). Point size refers to the size of the character cell, but only loosely to the size of the visible characters; the glyphs from different 12-point fonts can have different heights. The following example shows the different font heights in alternating glyphs from Times New Roman, PalatinoÒ, and Arial, each at 12 points:
Following are some of the character-cell measurements an application can affect or query when it creates a font:
Measurement | Description |
Ascent | Specifies the distance from the base line to the top of a character. The ascender of a character is the part of the character above the base line. In Windows, the value for the ascent is the distance from the base line to the top of the character cell; this can include white space. The typographic ascent, on the other hand, corresponds to the tallest character in a font. For TrueType fonts, this character is often the lowercase “f.” |
Base line | Specifies the line on which all characters stand. The base line is typically the lowest point of most of the capital letters in a font. (Though the tail of the “Q,” for example, can extend below the base line.) |
Descent | Specifies the distance from the base line to the bottom of a character. The descender of a character is the part of the character below the base line. For example, the tail of the letter “g” is a descender. In Windows, the value for the descent is the distance from the base line to the bottom of the character cell; this can include white space. The typographic descent, on the other hand, corresponds to the character in a font that extends farthest beneath the base line. For TrueType fonts, this character is often the lowercase “g.” |
Height | Specifies the vertical space required for a font. The height of a font is the sum of the ascent, descent, and internal leading for that font. (For a description of internal leading, see Section 18.1.3.) |
Width | Specifies the horizontal space required for a character cell in a font. GDI returns widths for the average character cell in a font and for the widest character cell. The average width can be simple or weighted, depending on the font. An application can also retrieve the widths for individual characters. These widths include the empty space preceding and following the glyph. |