Skip to content

Lookup Type 1 — Single Substitution

Single Substitution is a GSUB rule that replaces a single glyph with another single glyph.

sub a by a.sc;

Rules are written inside a feature block. Used in the smcp feature, for example:

feature smcp {
sub a by a.sc;
} smcp;
sub <glyph> by <glyph>; # format A
sub <glyphclass> by <glyph>; # format B
sub <glyphclass> by <glyphclass>; # format C
  • <glyph> — a single glyph.
  • <glyphclass> — a glyph class.

Format B replaces every glyph in the target glyph class with the same single glyph. Format C replaces each glyph in the target glyph class with the glyph at the same position in the replacement glyph class. Format C requires the target and replacement glyph classes to have the same number of glyphs. When the replacement glyph class has only one glyph, it is treated the same as a format B rule.

A single format C line produces the same result in the font as writing out format A rules glyph by glyph. The following two are the same:

sub [a b c] by [a.sc b.sc c.sc];
sub a by a.sc;
sub b by b.sc;
sub c by c.sc;

sub is the short form of substitute. These two rules are the same:

substitute a by a.sc;
sub a by a.sc;

The syntax is similar to Lookup Type 3, but there is no need to state the Lookup Type. The compiler determines it from the shape of the rule.

# every glyph in the class → the same single glyph = Single Substitution (Lookup Type 1)
sub [ampersand.1 ampersand.2 ampersand.3] by ampersand;
# a single glyph → one candidate from the class = Alternate Substitution (Lookup Type 3)
sub ampersand from [ampersand.1 ampersand.2 ampersand.3];
Without rules
Small Caps
With rules
Small Caps
Compiling…
Without rules
2026
With rules
2026
Compiling…

The OpenType specification recommends implementing more than 50 features with this lookup type. The following are representative examples.

  • smcp — Small Capitals. Replaces lowercase letters with small capitals.
  • c2sc — Small Capitals From Capitals. Replaces capital letters with small capitals.
  • lnum — Lining Figures. Replaces figures with lining figures.
  • onum — Oldstyle Figures. Replaces figures with oldstyle figures.
  • zero — Slashed Zero. Replaces the lining zero with a slashed form.
  • ss01–ss20 — Stylistic Sets. Replaces the default form with a variant for each set.
  • vert — Vertical Alternates. In vertical writing, replaces the default glyph with its vertical form.
  • jp90 — JIS90 Forms. Replaces JIS78 and JIS83 forms with JIS90 forms.

Features where several replacement candidates are possible, such as salt (Stylistic Alternates), also use this lookup type for one-to-one substitutions, and use Lookup Type 3 for substitutions that let the application choose among candidates.