Shaping Text
The glyphs stored in a font are material for setting text. A shaping engine chooses and positions that material according to the characters, the writing system, the font's rules, and the application's settings. Designing the glyphs and designing those rules are complementary parts of making a usable font.
The Shaping Engine
A shaping engine is the software that turns a text run into a sequence of glyphs with positions and advances. An operating system or application uses it when laying out text. The font supplies data; it does not execute its own rules.
OpenType Layout provides two central kinds of operation: substitution and positioning. Substitution changes which glyphs represent a sequence. Positioning changes where the resulting glyphs appear and how far the layout advances.
A metal-type case offers a useful starting comparison. It contains physical sorts: pieces carrying particular letterforms, each with a body that occupies space in the line. The typesetter does more than choose one ordinary sort for each letter. A combination such as fi may work better as a ligature sort. An alternate form can be selected for a particular context. A troublesome pair may need its spacing adjusted instead of being accepted simply because the individual sorts fit other neighbors.
An accent supplies a third way to see the distinction. Where the required accented form is not available as one sort, a separate mark and letter have to form a coordinated result. The choice of pieces and their placement are related but separate decisions. Having the pieces available does not determine their final relationship.
Digital substitution performs the form-selection part of that analogy: it can choose a ligature, alternate, or contextual form. Positioning establishes distances and attachments among the forms that remain. The font supplies the relationships, and the shaping engine applies the relevant ones to the text run. These are the substitution and positioning ideas introduced in Font Structures, now developed into a precise account of OpenType Layout.
The comparison is motivation, not a limit on shaping. Connected and complex scripts require coordinated substitutions, reordering, and attachments that are part of ordinary readable text. Their behavior cannot be understood as a collection of optional decorative sorts. A font must describe the relationships needed by its writing systems, while the engine organizes those operations according to the text context.
The application first establishes a text context, including font, script, language, and direction. Its shaping engine then applies the relevant font data to that context. A different language setting or enabled feature can therefore produce different glyphs from the same characters.

Feature controls identify enabled tags and the shaping context. The available tags depend on the current font.
HarfBuzz is one shaping engine used in font workflows. Authoring and compilation are covered in Authoring OpenType Layout.
From Characters to Glyphs
A character is an abstract text identity; a glyph is a drawing used to represent text. Their relationship need not be one to one. Several characters can produce one ligature glyph, and one character can be represented by a base and one or more marks.
The character assignments discussed in Managing Glyph Names and Codepoints feed the font's cmap, which maps character codes to initial glyphs. The engine processes those glyphs as a glyph run: a sequence that can be rewritten and then positioned. A useful working model is:
- Establish the text run's font, script, language, direction, and variation location.
- Map characters to initial glyphs through
cmap, with the engine's script-specific preparation. - Apply relevant glyph substitutions through
GSUBstages. - Apply positioning and attachment through
GPOS, along with the engine's other layout behavior. - Render the resulting glyphs at their calculated positions.
Real shaping can include normalization, reordering, and other script-specific work around these stages. The model distinguishes the tasks; it does not mean every engine follows one identical implementation sequence for every script.
OpenType lookup rules operate on glyph identities in the run. They do not contain general tests such as “this is the third Unicode character in the user's word.” The engine still knows character and cluster information, script, and language, and uses that context to choose and apply the glyph-level operations.
After substitution, positioning works with the glyphs that remain. This is why the substitution Part precedes the kerning and mark-positioning Parts. A small-cap replacement needs appropriate spacing and kerning as a small-cap glyph. A mark following a substituted base needs an attachment for that base. Testing only the original glyphs misses those dependencies.
Defaults and Guarantees
A font supplies defaults such as advances, kerning adjustments, and line metrics. A typesetting application can change tracking, line spacing, and feature settings. The font does not determine the complete page layout.
Some behavior is an optional design choice: discretionary ligatures, swashes, or a stylistic set. Other behavior is necessary for readable text in a script, such as joining forms or essential mark placement. Required behavior belongs in the font's core script support rather than depending on the user discovering a decorative-feature switch.
This is a design responsibility, not a promise that every application honors every table or control. A rule under a plausible feature tag is not sufficient if the engine never reaches its input glyphs or selects a different language system.
The kerning-as-patching principle from Designing the Whitespace still applies: ordinary spacing establishes the default fit, and pair adjustments refine particular combinations. Directly displaying an alternate proves that its drawing exists, while shaping determines whether the character sequence reaches it.