LookupType 3: Alternate Substitution Subtable

An Alternate Substitution (AlternateSubst) subtable identifies any number of aesthetic alternatives from which a user can choose a glyph variant to replace the input glyph. For example, if a font contains four variants of the ampersand symbol, the cmap table will specify the index of one of the four glyphs as the default glyph index, and an AlternateSubst subtable will list the indices of the other three glyphs as alternatives. A text-processing client would then have the option of replacing the default glyph with any of the three alternatives.

The subtable has one format: AlternateSubstFormat1. The subtable contains a format identifier (SubstFormat), an offset to a Coverage table containing the indices of glyphs with alternative forms (Coverage), a count of offsets to AlternateSet tables (AlternateSetCount), and an array of offsets to AlternateSet tables (AlternateSet).

For each glyph, an AlternateSet subtable contains a count of the alternative glyphs (GlyphCount) and an array of their glyph indices (Alternate). Because all the glyphs are functionally equivalent, they can be in any order in the array.

Example 5 at the end of this chapter shows how to replace the default ampersand glyph with alternative glyphs.

AlternateSubstFormat1 subtable: Alternative output glyphs

Type

Name

Description

uint16

SubstFormat

Format identifier

—format = 1

Offset

š Coverage

Offset to Coverage table

—from beginning of Substitution table

uint16

AlternateSetCount

Number of AlternateSet tables

Offset

š AlternateSet

Array of offsets to AlternateSet tables

[AlternateSetCount]

—from beginning of Substitution table

—ordered by Coverage Index


AlternateSet table

Type

Name

Description

uint16

GlyphCount

Number of GlyphIDs in the Alternate array

GlyphID

Alternate[GlyphCount]

Array of alternate GlyphIDs

—in arbitrary order