#1997·stb

stb_truetype: Support lookupType 9 table in `stbtt__GetGlyphGPOSInfoAdvance`

Author: EasyVulkanCreated Sep 7, 2026Updated Sep 7, 2026
Labels4 enhancement

Really simple structure:

Spec: Lookup type 9 subtable: positioning subtable extension

      if (lookupType != 2 && // Pair Adjustment Positioning Subtable
          lookupType != 9)   // Positioning Subtable Extension
         continue;

      for (sti=0; sti<subTableCount; sti++) {
         stbtt_uint16 subtableOffset = ttUSHORT(subTableOffsets + 2 * sti);
         stbtt_uint8 *table = lookupTable + subtableOffset;
         if (lookupType == 9) {
            stbtt_uint16 exLookupType = ttUSHORT(table + 2);
            if (exLookupType != 2)
               continue;
            stbtt_uint32 exOffset = ttULONG(table + 4);
            table += exOffset;
         }

Code from my branch There's only one PosExtension table format, I skipped the format checking.

Tested with calibri.ttf (all its PairPos tables must be accessed through PosExtension tables), following code returns -38: stbtt__GetGlyphGPOSInfoAdvance(&info, 4, 448)

Print something like 'LWAVAY' sees the difference. The code is really simple so I'd like to skip the screenshot of rendering results. Please review the code and I'll submit a PR.