Font Structures
A font has to provide more than recognizable letterforms. Software needs to know how much space each form occupies, how it relates to its neighbors, and whether a different form or position is needed in a particular context. At small display sizes, it may also need guidance about which details of the drawing to preserve.
Four kinds of data address these needs: glyph representations, metrics, substitution and positioning rules, and hinting. They contribute to different stages of turning text into visible marks. Not every font uses every capability, but these categories provide a useful way to understand the work of developing one.
Glyph Representations
The most immediately visible part of a font is its set of glyph drawings. In an outline font, each drawing is described by vector outlines: lines and curves that define the boundaries of a shape mathematically.
This differs from a bitmap, which records a pattern of pixels at a particular resolution. Enlarge a bitmap and the existing pixels must be enlarged or new pixels estimated from them. A drawing prepared for one size does not automatically acquire the detail needed at another. Separate bitmap drawings can be prepared for selected sizes, but storing and maintaining them adds work and data.
An outline describes the shape independently of a particular pixel grid. The same description can be scaled for small text, a large heading, or printed output. The conversion from an outline to pixels at the required size is called rasterization.
Scalability does not mean that every size will look equally good without further care. At a large size, many pixels can describe a curved edge. At a small size, only a few may be available for an entire detail. The underlying outline can remain the same while the rasterizer has to make different decisions about its visible result. Hinting, introduced at the end of this chapter, addresses part of that problem.
Two widely used outline technologies are PostScript outlines, based on cubic curves, and TrueType outlines, based on quadratic curves. Both describe scalable shapes; they express their curves differently. The curve mathematics and node types are taught in Contours, Nodes, and Handles and the following drawing chapters.
Fonts can also contain bitmap or color representations, and some glyphs have no visible drawing. A space glyph is a familiar example: its contribution is the space it occupies. Outlines are the main drawing model developed in this manual, rather than a requirement that every glyph must contain a black shape bounded by curves.
Metrics
A drawing describes a shape. Metrics describe how it occupies space and is placed in text. Three levels matter: the font's shared vertical framework, the horizontal space assigned to each glyph, and adjustments for particular combinations. The examples here concern horizontal text running from left to right.
The shared vertical framework
The baseline is the main horizontal reference for placing glyphs in a line of text. Letters such as H and x appear to rest on it; the lower portions of p and g extend below it. Their common reference is the baseline, not the lowest point of each drawing.
Font dimensions describe the design's shared vertical proportions. In a Latin design, these include:
| Dimension | What it describes |
|---|---|
| x-height | The nominal height of lowercase bodies, represented by x |
| Caps height | The nominal height of capitals, represented by H |
| Ascender height | The height of upper extensions, as in h |
| Descender depth | The depth of lower extensions, as in p |
These reference heights describe relationships rather than a box enclosing every outline. Rounded forms and accents can extend beyond them. Their proportions also affect the apparent size of text: a larger x-height gives lowercase bodies more height relative to the rest of the design.
Fonts also supply ascent, descent, and line-gap values for line spacing. These layout values need not equal the design's reference heights. Their terminology and application are developed in Font Metrics and Glyph Metrics.
Advance width and sidebearings
A glyph's advance width is the distance by which the text's placement position normally advances after that glyph, before additional positioning adjustments. It includes the drawing and the space assigned around it. A space glyph can have an advance without any visible drawing; a narrow i usually has a smaller advance than a wide m.
The sidebearings relate the drawing's edges to the boundaries of that advance. The left sidebearing runs from the starting position to the drawing's leftmost extent. The right sidebearing runs from its rightmost extent to the end of the advance.
Advance width = left sidebearing + drawing width + right sidebearing
Drawing width is the horizontal distance between the outline's outermost points. Sidebearings are included in the advance, not added after it. In two unkerned copies of n, the gap between their drawn extents comes from the first glyph's right sidebearing and the second glyph's left sidebearing. Changing either glyph's default spacing therefore affects many combinations. The practice of judging and adjusting that space is covered in Spacing Glyphs.
Kerning
Kerning adjusts particular glyph combinations beyond their default metrics. In AV, the diagonals can leave a conspicuous opening even when each letter's sidebearings work well with other neighbors. Moving that pair closer can reduce the opening without changing the spacing of A or V everywhere else.
Kerning can increase or decrease space; the drawings determine which adjustment is useful. Sidebearings establish the general fit, and kerning refines combinations for which that fit is insufficient. This distinction separates a glyph's ordinary spacing from an exception associated with its neighbor.
Substitution and Positioning Rules
The glyphs used to display a word need not correspond one for one to its characters: one glyph can represent a ligature, while a character can have several contextual or stylistic forms. A font can provide rules that let the text engine select and position forms according to context, language, or a typographic choice. These rules extend the information provided by the default character mapping and glyph metrics.
Substitution
A substitution replaces glyphs in the displayed sequence with other glyphs. For an fi ligature, a rule identifies a suitable sequence of f and i glyphs and substitutes the combined form. The ligature can have no direct Unicode assignment because it is reached from glyphs already selected for the two characters.
The same principle supports alternatives such as small capitals or stylistic forms. The font contains the drawings and the relationships needed to reach them. Merely including an alternate drawing does not tell the application when to select it.
Substitution also serves the ordinary requirements of writing systems. For Arabic text, the engine determines joining context and uses appropriate rules to select contextual letterforms. This is part of rendering the writing correctly, rather than an optional decorative treatment.
Positioning
A positioning rule adjusts where a glyph is placed or how far the text advances, without replacing the glyph itself. Kerning is one application. Another is the placement of accents and other marks in relation to a base glyph.
An accent intended for a narrow lowercase letter may need a different position when used with a wide capital. A fixed position that works for one drawing may be wrong for the other. Positioning rules can express those relationships so the text engine places the mark appropriately for the selected forms.
Positioning can also align connecting parts in a cursive design. Choosing the correct contextual form and placing it correctly are related tasks: substitution supplies the form, while positioning can establish its relationship to adjacent forms.
OpenType features
OpenType features organize layout behavior into identifiable functions. Each registered feature has a short tag. For example, liga identifies standard ligatures, and smcp identifies small capitals. The feature connects that function with the font's relevant substitution or positioning rules.
Some features correspond to choices that an application exposes to the user, such as enabling small capitals. Others are applied by the text engine as part of shaping a writing system. Feature support and application behavior matter: a rule's presence in a font does not guarantee that every application will offer a switch for it or apply it in the same circumstances.
The font contains the rules; the text engine applies them. For the designer, supplying the right forms and specifying their relationships are both parts of producing usable text.
Hinting
At a small display size, a carefully drawn detail may occupy only a few pixels. Similar strokes can appear to have different thicknesses, or an important gap can become difficult to distinguish. Scaling the outline alone does not guarantee that the available pixels will preserve the relationships in the design.
Hinting supplies additional information that a rasterizer can use to improve that result. PostScript hinting describes important relationships for the rasterizer to interpret. TrueType hinting provides a program with more explicit control over adjustments to the rendered outlines. The approaches offer different balances of authoring effort and control.
Hinting is particularly relevant when text has to remain clear at small pixel sizes. Its visible effect depends on the rasterizer and its settings; it does not replace the need for sound drawings and spacing. Hinting is a significant part of professional font production when reliable small-size rendering matters. The two systems are developed in Hinting and the Pixel Grid and The TrueType Hinting Model and Workspace.