User Guide
Making OpenType Fonts
663
Single Substitution
This is the simplest substitution – it replaces a single glyph with another
glyph or a class of glyphs with another class. The Class form of the
substitution requires that the number of glyphs in the source and
destination classes be the same.
A single substitution rule is specified in one of the following formats:
substitute <glyph> by <glyph>; # format A
substitute <glyphclass> by <glyph>; # format B
substitute <glyphclass> by <glyphclass>; # format C
You can use the codeword “sub” instead of the longer “substitute”.
Format B specifies that all glyphs in the target glyph class will be replaced
by the same replacement glyph.
Format C specifies that any of the glyphs in the target glyph class must be
replaced by its corresponding glyph (in the order of glyphs in the glyph
classes) in the replacement glyph class. If the replacement is a singleton
glyph class, then the rule will be treated identically to a format B rule. If
the replacement class has more than one glyph, then the number of
elements in the target and replacement glyph classes must be the same.
For example:
sub a by Asmall; # format A
sub [one.fitted oneoldstyle one.taboldstyle] by one; # format B
sub [a - z] by [Asmall - Zsmall]; # format C
sub @Capitals by @CapSwashes; # format C
The third line in the above example produces the same effect in the font as:
sub a by Asmall;
sub b by Bsmall;
sub c by Csmall;
# ...
sub z by Zsmall;