GSUB and GPOS

GSUB and GPOS

Last updated 2026-11-02

  • GSUB
  • GPOS
  • GDEF
  • 连字
  • 字偶距
  • kern
  • 特性
  • locl
  • 小型大写
On this page

cmap only answers "which glyph for this code point". Whether f and i become one ligature, whether A and V move closer, whether Chinese punctuation narrows — all of that lives in three other tables. Their structure is far more complex, but the ideas are only three.

Division of labour

Table Full name Job
GSUB Glyph Substitution Replace one glyph with another
GPOS Glyph Positioning Move glyphs around
GDEF Glyph Definition Classify glyphs as base, ligature or mark for the two above

Shared structure

Both tables use the same four levels:

  1. ScriptList: grouped by writing system, tagged latn (Latin), hani (Han), DFLT (default);
  2. LangSys: language variants inside a script, e.g. ZHS (Simplified Chinese), ZHT (Traditional), JAN (Japanese);
  3. FeatureList: which features each language has, tagged with four letters;
  4. LookupList: the actual lookups a feature points at — substitution or positioning rules.

So "does this font support small caps" means "is there an smcp feature in some language system of GSUB".

What GSUB can do

Lookup type Effect Example
Single substitution One glyph becomes another a → a.alt
Multiple substitution One glyph becomes several decompose a connected æ back to a e
Alternate substitution Several candidates for one slot stylistic alternates (salt)
Ligature substitution Several glyphs merge into one f + i → fi
Contextual substitution Decide by surrounding glyphs digits swapped inside a fraction
Chained contextual More involved context rules Indic conjuncts
f i fi → two glyphs one glyph (liga)
A GSUB ligature substitution: two adjacent glyphs become one. The boxes stand for glyph slots, not design spacing.

What GPOS can do

Lookup type Effect Example
Single adjustment Move a glyph as a whole raising a superscript
Pair adjustment Add or remove space between two glyphs kerning (kern)
Attachment Attach marks to a base accents, Arabic vowel marks
Cursive attachment Joining script forms Arabic
Mark-to-mark A mark on a mark stacked diacritics

Common feature tags

Tag Meaning Default
liga Standard ligatures (fi, fl) on
clig Contextual ligatures on
dlig Discretionary ligatures off
smcp Small caps off
onum / lnum Oldstyle / lining figures off / on
tnum / pnum Tabular / proportional figures off / on
frac Fractions off
subs / sups Subscript / superscript off
salt / ss01–ss20 Stylistic alternates / sets off
locl Localised forms (per language) language-driven
kern Kerning (in GPOS) on
palt Proportional widths for CJK punctuation off

The "default" column reflects usual engine behaviour, not a hard requirement; engines differ, especially around dlig.

One character, different shapes

locl makes the same code point draw differently in Simplified Chinese, Traditional Chinese and Japanese contexts.

Classic cases are characters like 骨, 直, 门: the standard stroke order differs between Chinese and Japanese, but the code point is identical. So "this font looks like this in Chinese and like that in Japanese" is not a bug; locl swapped the glyph according to the language system.

Which is why, in multilingual typesetting, the lang attribute is not only for spell checking.

Having the table is not enough

Rules in GSUB need three things before you see anything:

  1. the renderer actually consults the table (some simplified engines ignore it);
  2. the text contains the sequence;
  3. the feature is on by default, or turned on explicitly.

So "this font has ligatures" and "this paragraph shows ligatures" are two different claims.

Why this site sidesteps them

Building specimen images needs glyph outlines. Some older libraries throw when they meet GSUB (the glyph data is post-substitution and no longer matches the raw outlines), so this site falls back to fetching each glyph individually when that happens.

Which also means specimens do not show ligatures — they show what the glyphs look like, not how a paragraph sets.

Further reading

  • OpenType spec: GSUB, GPOS, GDEF
  • OpenType spec: the full feature tag registry
  • This site: The cmap table