Overview

Complex glyph positioning becomes an issue in writing systems, such as Vietnamese, that use diacritical and other marks to modify the sound or meaning of characters. These writing systems require controlled placement of all marks in relation to one another for legibility and linguistic accuracy.

Figure 4a. Vietnamese words with marks.

Other writing systems require sophisticated glyph positioning for correct typographic composition. For instance, Urdu glyphs are calligraphic and connect to one another along a descending, diagonal text line that proceeds from right to left. To properly render Urdu, a text-processing client must modify both the horizontal (X) and vertical (Y) positions of each glyph.

Figure 4b. Urdu layout requires glyph positioning control, as well as contextual substitution

With the GPOS table, a font developer can define a complete set of positioning adjustment features in a TrueType Open font. GPOS data, organized by script and language system, is easy for a text-processing client to use to position glyphs.

Positioning Glyphs with TrueType 1.0

Glyph positioning in TrueType 1.0 uses only two values, placement and advance, to specify a glyph's position for text layout. If glyphs are positioned with respect to a virtual "pen point" that moves along a line of text, placement describes the glyph's position with respect to the current pen point, and advance describes where to move the pen point to position the next glyph (see Figure 4c). For horizontal text, placement corresponds to the left side bearing, and advance corresponds to the advance width.

Figure 4c. Glyph positioning with TrueType 1.0

TrueType 1.0 specifies placement and advance only in the X direction for horizontal layout and only in the Y direction for vertical layout. For simple Latin text layout, these two values may be adequate to position glyphs correctly. But, for texts that require more sophisticated layout, the values must cover a richer range. Placement and advance may need adjustment vertically, as well as horizontally.

The only positioning adjustment defined in TrueType 1.0 is pair kerning, which modifies the horizontal spacing between two glyphs. A typical kerning table lists pairs of glyphs and specifies how much space a text-processing client should add or remove between the glyphs to properly display each pair. It does not provide specific information about how to adjust the glyphs in each pair, and cannot adjust contexts of more than two glyphs.

Positioning Glyphs with TrueType Open

TrueType Open supplies more control and flexibility for positioning a single glyph and for positioning multiple glyphs in relation to one another. By using both X and Y values that the GPOS table defines for placement and advance and by using glyph attachment points, a client can more precisely adjust the position of a glyph.

To improve kerning, the GPOS table offers both horizontal and vertical values for independently adjusting each glyph in a pair. For each glyph, the table also explicitly describes the type, size, and direction of the adjustment. For example, to kern two glyphs horizontally, the table might say to reduce the total advance units of the first glyph by 20 units in the X direction, reduce the left side bearing of the second glyph by 20 units, or to do both but by 10 units instead of 20.

Similarly, the GPOS table can specify adjustments to the positions of three or more glyphs. This is useful for triplet kerning or other adjustments that depend on a glyph string context.

In addition, the GPOS table can reference a Device table to define subtle, device-dependent adjustments to any placement or advance value at any font size and device resolution. For example, a Device table can specify adjustments at 51 pixels per em (ppem) that do not occur at 50 ppem.

Other GPOS features can define attachment points to combine glyphs and position them with respect to one another. A glyph might have multiple attachment points. The point used will depend on the glyph to be attached. For instance, a base glyph could have attachment points for different diacritical marks.

To reduce the size of the font file, a base glyph may use the same attachment point for all mark glyphs assigned to a particular class. For example, a base glyph could have two attachment points, one above and one below the glyph. Then all marks that attach above glyphs would be attached at the high point, and all marks that attach below glyphs would be attached at the low point. Attachment points are useful in scripts, such as Arabic, that combine numerous glyphs with vowel marks.

Attachment points also are useful for connecting cursive-style glyphs. Glyphs in cursive fonts can be designed to attach or overlap when rendered. Alternatively, the font developer can use TrueType Open to create a cursive attachment feature and define explicit exit and entry attachment points for each glyph (see Figure 4d).

Figure 4d. Entry and exit points marked on contextual Urdu glyph variations

The GPOS table supports seven types of actions for positioning and attaching glyphs:

A single adjustment positions one glyph, such as a superscript or subscript.

A pair adjustment positions two glyphs with respect to one another. Kerning is an example of pair adjustment.

A cursive attachment describes cursive scripts and other glyphs that are connected with attachment points when rendered.

A MarkToBase attachment positions combining marks with respect to base glyphs, as when positioning vowels, diacritical marks, or tone marks in Arabic, Hebrew, and Vietnamese.

A MarkToLigature attachment positions combining marks with respect to ligature glyphs. Because ligatures may have multiple points for attaching marks, the font developer needs to associate each mark with one of the ligature glyph's components.

A MarkToMark attachment positions one mark relative to another, as when positioning tone marks with respect to vowel diacritical marks in Vietnamese.

Contextual positioning describes how to position one or more glyphs in context, within an identifiable sequence of specific glyphs, glyph classes, or varied sets of glyphs. One or more positioning operations may be performed on "input" context sequences. Figure 4e illustrates a context for positioning adjustments.

Figure 4e. Contextual positioning lowered the accent over a vowel glyph that followed an overhanging uppercase glyph