Two more optional layout tables, organised by script and language like
GSUB and
GPOS. BASE gives the
positions of the different baselines scripts sit on, so that mixed Latin, Devanagari,
Tibetan and Chinese text lines up, plus the extent of glyphs per script.
JSTF lists, in order of preference, which lookups to switch on or off to
make a justified line shorter or longer. All numbers are big-endian; values are in font
units.
BASE
| Offset | Type | Name | Description |
|---|---|---|---|
0 | uint16 × 2 | majorVersion, minorVersion | 1.0 or 1.1. |
4 | Offset16 | horizAxisOffset | Axis table for horizontal text, or NULL. |
6 | Offset16 | vertAxisOffset | Axis table for vertical text, or NULL. |
8 | Offset32 | itemVarStoreOffset | Version 1.1: item variation store for variable fonts, or NULL. |
| Structure | Fields | Meaning |
|---|---|---|
| Axis | Offset16 baseTagListOffset, Offset16 baseScriptListOffset | Offsets from the Axis table; the tag list may be NULL. |
| BaseTagList | uint16 baseTagCount, Tag baselineTags[] | The baselines given for this direction, in alphabetical order. |
| BaseScriptList | uint16 baseScriptCount, records of Tag baseScriptTag, Offset16 baseScriptOffset | One per script, alphabetical; offsets from the list. |
| BaseScript | Offset16 baseValuesOffset, Offset16 defaultMinMaxOffset, uint16 baseLangSysCount, records of Tag baseLangSysTag, Offset16 minMaxOffset | The script’s baseline values and extents, with per-language extents; offsets from the BaseScript. |
| BaseValues | uint16 defaultBaselineIndex, uint16 baseCoordCount, Offset16 baseCoordOffsets[] | The script’s own baseline (an index into BaseTagList) and a position for every tag, in tag-list order. |
| MinMax | Offset16 minCoordOffset, Offset16 maxCoordOffset, uint16 featMinMaxCount, records of Tag featureTag, Offset16 minCoordOffset, Offset16 maxCoordOffset | Lowest and highest extent of the glyphs (for line spacing), and overrides when particular features are on; offsets from the MinMax table, any may be NULL. |
| BaseCoord format | Fields after uint16 format | Meaning |
|---|---|---|
| 1 | int16 coordinate | A position in font units (y for the horizontal axis, x for the vertical). |
| 2 | int16 coordinate, uint16 referenceGlyph, uint16 baseCoordPoint | Also a contour point of a glyph, whose hinted position is used. |
| 3 | int16 coordinate, Offset16 deviceOffset | Also a Device table, or in a variable font a VariationIndex table into this table’s store. |
JSTF
A justifying application first applies its normal features, then, if the line is the wrong length, tries the font’s suggestions from priority 0 upwards until it fits. Each suggestion stands alone. If a suggestion changes a lookup already applied, it is applied to the unmodified glyphs.
| Structure | Fields | Meaning |
|---|---|---|
| Header | uint16 majorVersion (1), uint16 minorVersion (0), uint16 jstfScriptCount, records of Tag jstfScriptTag, Offset16 jstfScriptOffset | Scripts in alphabetical order, matching the GSUB/GPOS script tags; offsets from the start of JSTF. |
| JstfScript | Offset16 extenderGlyphOffset, Offset16 defJstfLangSysOffset, uint16 jstfLangSysCount, records of Tag jstfLangSysTag, Offset16 jstfLangSysOffset | Extender glyphs, the default suggestions and per-language suggestions; offsets from the JstfScript, the first two may be NULL. |
| ExtenderGlyph | uint16 glyphCount, uint16 extenderGlyphs[] | Glyphs such as the Arabic kashida that may be inserted to lengthen a line, in increasing order. |
| JstfLangSys | uint16 jstfPriorityCount, Offset16 jstfPriorityOffsets[] | Suggestions in priority order, offsets from the JstfLangSys. |
| JstfModList | uint16 lookupCount, uint16 lookupIndices[] | GSUB or GPOS lookup indexes, in increasing order, to switch on or off. |
| JstfMax | uint16 lookupCount, Offset16 lookupOffsets[] | Lookups stored inside JSTF in GPOS format (any type but contextual), whose values are the most a glyph may be moved; the application may use any amount up to that. |
A JstfPriority table is ten Offset16 fields, each from the start of the
JstfPriority and each may be NULL:
| Offset | Name | Points to |
|---|---|---|
0 | gsubShrinkageEnableOffset | JstfModList of GSUB lookups to turn on to shorten the line. |
2 | gsubShrinkageDisableOffset | GSUB lookups to turn off to shorten it. |
4 | gposShrinkageEnableOffset | GPOS lookups to turn on to shorten it. |
6 | gposShrinkageDisableOffset | GPOS lookups to turn off to shorten it. |
8 | shrinkageJstfMaxOffset | JstfMax for shortening. |
10 | gsubExtensionEnableOffset | GSUB lookups to turn on to lengthen the line. |
12 | gsubExtensionDisableOffset | GSUB lookups to turn off to lengthen it. |
14 | gposExtensionEnableOffset | GPOS lookups to turn on to lengthen it. |
16 | gposExtensionDisableOffset | GPOS lookups to turn off to lengthen it. |
18 | extensionJstfMaxOffset | JstfMax for lengthening. |
In variable fonts, values in JstfMax lookups vary through the item variation store
in GDEF, and the lookups that
count as already applied are those actually used after any FeatureVariations.
Example
Arial (Arial.ttf, macOS) has a 30-byte JSTF table:
000AB9C8 00 01 00 00 00 01 61 72 61 62 00 0C 00 06 00 00
000AB9D8 00 00 00 05 02 F0 03 1B 04 67 04 68 04 69
| Bytes | Meaning |
|---|---|
00 01 00 00 00 01 | Version 1.0, one script. |
61 72 61 62 00 0C | arab, its JstfScript at 12. |
00 06 00 00 00 00 | Extender glyphs 6 bytes on; no default suggestions; no languages. |
00 05 02 F0 03 1B 04 67 04 68 04 69 | Five extender glyphs: 752, 795, 1127, 1128, 1129. |
So Arial offers no lookup suggestions, only the glyphs (kashida forms) that may be inserted into Arabic words to stretch them.