#1998·stb

Support `valueFormat1 == (X_ADVANCE | X_ADVANCE_DEVICE)` case in `stbtt__GetGlyphGPOSInfoAdvance`. Support GPOS table V1.1

Author: EasyVulkanCreated Sep 7, 2026Updated Sep 7, 2026
Labels4 enhancement1 stb_truetype

Support GPOS table V1.1

The GPOS header V1.1 only added a field at the end of the V1.0 header:

Spec: GPOS Header Which means the current code logic is also applicable to GPOS V1.1.

Support valueFormat1 == (X_ADVANCE | X_ADVANCE_DEVICE)

Some font may have a PairPos subtable, with valueFormat1 equals to X_ADVANCE | X_ADVANCE_DEVICE, which means it contains both kerning values, related and unrelated to the output font size. (e.g. NotoSansSC-VF.ttf) The Device table could just be ignored.

I checked every font pre-installed with WIN10 and some other fonts I downloaded (mainly CJK, Latin). Following situations are rare:

  • valueFormat1 contains both X_PLACEMENT and X_ADVANCE (usually for symbols, e.g. dash)
  • valueFormat1 contains both X_ADVANCE and Y_ADVANCE (maybe superscript or subscript?)

So, I assume supporting GPOS V1.1 and valueFormat1 == X_ADVANCE | X_ADVANCE_DEVICE may cover most glyph pairs in most fonts. And it only needs a bit change. Code from my branch

(Update: The font is NotoSansSC-VF.ttf)