Appearance
GSUB table
Defines glyph substitution rules — ligatures, alternates, contextual forms, and other replacements.
Scope
- Format family: Shared SFNT
- Table tag in JSON:
GSUB
Specs
- https://learn.microsoft.com/en-us/typography/opentype/spec/gsub
- OpenType table registry: https://learn.microsoft.com/en-us/typography/opentype/spec/otff#font-tables
JSON Skeleton
This skeleton reflects fields currently parsed/written by Font Flux JS for this table.
json
{
"tables": {
"GSUB": {
"majorVersion": 0,
"minorVersion": 0,
"scriptList": null,
"featureList": null,
"lookupList": null,
"featureVariations": null,
"_checksum": 0
}
}
}Top-level Fields
majorVersion- number (0..65535)minorVersion- number (0..65535)scriptList- implementation-definedfeatureList- implementation-definedlookupList- implementation-definedfeatureVariations- implementation-defined
Nested JSON Structure
Top-level layout matches OpenType Layout GSUB container:
json
{
"majorVersion": 1,
"minorVersion": 1,
"scriptList": { "scriptRecords": [] },
"featureList": { "featureRecords": [] },
"lookupList": {
"lookups": [
{
"lookupType": 4,
"lookupFlag": 0,
"subtables": [
{
"format": 1,
"coverage": { "format": 1, "glyphArray": [30] },
"ligatureSets": [
[
{ "ligatureGlyph": 400, "componentCount": 3, "componentGlyphIDs": [31, 32] }
]
]
}
]
}
]
},
"featureVariations": { "featureVariationRecords": [] }
}Lookup subtable families by lookupType:
1SingleSubst:deltaGlyphID(format 1) orsubstituteGlyphIDs[](format 2).2MultipleSubst:sequences[][].3AlternateSubst:alternateSets[][].4LigatureSubst:ligatureSets[][]withligatureGlyphand component list.5ContextSubst and6ChainedContextSubst: shared Sequence/ChainedSequence context structures.7ExtensionSubst: wraps another substitution subtable insubtablewithextensionLookupType.8ReverseChainSingleSubst:backtrackCoverages[],lookaheadCoverages[],substituteGlyphIDs[].
Validation Constraints
majorVersionis typically1.minorVersion >= 1may includefeatureVariations.- Each lookup's
lookupTypemust match the subtable shapes it contains. - Coverage arrays should align with replacement/substitution arrays by index.
- Extension lookups (type 7) must point to a valid wrapped subtable type.
Authoring Example
json
{
"tables": {
"GSUB": {
"majorVersion": 1,
"minorVersion": 0,
"scriptList": { "scriptRecords": [] },
"featureList": { "featureRecords": [] },
"lookupList": { "lookups": [] },
"_checksum": 0
}
}
}Additional Nested Keys Seen In Implementation
scriptListfeatureListlookupListfeatureVariations
Notes
- Preserve
_checksumfor stable round-tripping. - If a table is only partially understood, prefer keeping unknown bytes in
_rawinstead of dropping data. - Validate with
.validate()after edits.