Font hinting 2026-11-05
Font hinting guides the adjustment of a scaled outline font to the target pixel grid before rasterization. In TrueType, instructions can control how outline points move at a particular size and resolution. Grid fitting can preserve important strokes when faithful geometric scaling would leave them awkwardly positioned between pixels.[ref]
For an idealized example, two equal-width vertical strokes can overlap different fractions of neighboring pixels after scaling. Their rasterized darkness can then differ despite equal geometric widths. Coordinating the adjusted stroke positions and widths can make their displayed weights more consistent. The target depends on the requested size: a correction suitable for a small glyph need not be appropriate when many more pixels resolve its outline.
Font hinting changes the geometry used for rendering, rather than the underlying Unicode text or its grapheme clusters. Glyph substitution, glyph positioning and font hinting solve different parts of the path from encoded text to a visible image.
Glyph index 2026-11-05
A glyph index is a numerical identifier for a glyph inside a particular computer font. It identifies an entry in that font's own glyph collection, rather than a Unicode code point. In an OpenType computer font, the cmap table maps character codes to default glyph indices; unavailable characters map to index zero, whose special .notdef glyph indicates missing coverage.[ref]
For a hypothetical example, one computer font might map U+0041 to index 37 while another maps the same character A to index 9. Both can display the correct letter. Carrying index 37 from the first computer font into the second can select an unrelated form. A later glyph substitution can also change the selected glyph index while leaving the underlying text characters unchanged. This distinction matters in rendering caches and when exchanging shaped text between systems.
Glyph positioning 2026-11-05
Glyph positioning assigns locations to the glyphs selected during text shaping. It specifies how each glyph is placed and how the logical pen position progresses through the text. A text baseline supplies a common reference for placing the shapes. An OpenType GPOS table can adjust horizontal and vertical placement, glyph advances and attachment between selected glyphs.[ref]
A simple coordinate model separates the two effects. Let be the pen position, a placement offset and the glyph advance. Draw glyph with its origin at
then update the logical position by
Changing moves the current shape; changing moves the starting position of subsequent shapes.
For example, a combining character can select an accent glyph that must be positioned above an earlier base glyph. The accent's placement and its glyph advance answer different questions. Kerning similarly changes spacing according to context, while glyph substitution changes which forms are selected. These choices precede the rasterization of the placed outlines into pixels.
Glyph substitution 2026-11-05
Glyph substitution replaces selected glyph indices by other glyph indices while laying out text. In OpenType, the GSUB table specifies these replacements after the default character-to-glyph index mapping. A substitution can replace one glyph by another, several by a typographic ligature, or one by several; its application can depend on surrounding glyphs.[ref]
For a hypothetical computer font, suppose f and i initially select indices17 and23. A matching ligature rule could replace the pair by index91. These numbers belong to that particular computer font; they do not change the stored Unicode sequence into code point91. The example also shows why substitution differs from kerning: replacing the pair selects a new shape, whereas adjusting the pair's positions can retain both original shapes.
Lookup order matters when one substitution creates or removes the input pattern for a later substitution. Text shaping must therefore interpret the applicable OpenType rules, rather than independently choosing a default glyph for each text character.
Grid fitting 2026-11-05
Grid fitting adjusts scaled glyph geometry relative to a target pixel grid before rasterization. TrueType font hinting can move outline points to preserve important strokes and alignment at small sizes. The result depends on the requested resolution and transformation.[ref]
A simple area-coverage antialiasing model shows the problem. A vertical stroke from horizontal coordinate 0.4 to 1.6 covers 60 percent of each of two neighboring pixel columns. An equal-width stroke from 3.9 to 5.1 covers 10 percent, 100 percent and 10 percent of three columns. Both geometries have width 1.2 pixels, yet their darkest columns differ. Snapping their boundaries to give each stroke one full column changes the outlines but gives consistent displayed stroke weights.
This is a tradeoff between geometric fidelity and small-size legibility, rather than a change to the stored Unicode text. Grid fitting operates on the geometry supplied to the rasterization step; glyph substitution and glyph positioning address the forms and layout that precede it.
Figure 1.
Pixel coverage before and after grid fitting
. Original ideal area-coverage antialiasing model of rectangular strokes, not measurements of a particular computer font. The unfitted strokes both have width 1.2 pixels, but their placements give different column coverage. The fitted strokes each occupy one full column; their changed geometry is explicit. Red dashed lines mark the geometric stroke boundaries. Details.
Kerning 2026-11-05
Kerning adjusts spacing for particular combinations of glyphs. For example, the open region beneath an overhanging “T” can allow a following round glyph to be placed closer than a uniform spacing rule would suggest. The OpenType kern feature provides context-dependent adjustments for horizontal layout; the separate vkrn feature addresses vertical layout.[ref]
In a simplified horizontal pair model with default glyph advances and adjustment , the total advance is . A negative reduces the gap for that pair, while a positive increases it. The numerical value depends on the computer font, its scale and the applicable layout rules; a particular letter pair does not have one universal adjustment.
Kerning is one application of glyph positioning. It can preserve the same glyph indices while changing their arrangement. A typographic ligature instead selects a combined form through glyph substitution. Selecting an appropriate form and placing it well are complementary parts of text shaping.
Text shaping 2026-11-05
Text shaping turns a sequence of Unicode text characters into a layout of glyphs from a chosen computer font. The result includes glyph indices, positions and glyph advances. A text character therefore does not determine a visible shape independently of its neighbors, writing system and selected computer font.[ref]
For example, the stored sequence f followed by i can become a single typographic ligature. Contextual Arabic forms illustrate a different requirement: a letter's neighbors influence the selected glyph. Glyph substitution chooses forms, while glyph positioning places the chosen forms; kerning adjusts their spacing. These operations can preserve the original Unicode text, so copying text should not be implemented by reading glyph indices as if they were code points.[ref]
Text shaping precedes rasterization: first determine what shapes to draw and where; then determine the pixels that represent those shapes at the requested size.
Typographic ligature 2026-11-05
A typographic ligature combines two or more written forms into a single glyph. A familiar example is an “fi” shape joining the end of “f” to the following “i”. Its use can improve spacing or avoid a collision between the two shapes.
An OpenType shaping system can first map the separate text characters “f” and “i” to their default glyph indices, then apply a glyph substitution that replaces that pair by one ligature glyph index. The stored text need not be replaced by a special ligature character. Selection and copying can therefore preserve the original two-character sequence even though the display contains one glyph.[ref]
A typographic ligature also need not be produced merely by moving two glyphs closer together: substitution changes the selected form, whereas positioning changes where selected forms are drawn.