JSTF Table Examples

The rest of this chapter describes examples of all the JSTF table formats. All the examples reflect unique parameters described below, but the samples provide a useful reference for building tables specific to other situations.

The examples have three columns showing hex data, source, and comments.

Example 1: JSTF Header Table and JstfScriptRecord

Example 1 demonstrates how a script is defined in the JSTF Header with a JstfScriptRecord that identifies the script and references its JstfScript table.

Example 1

Hex Data

Source

Comments

JSTFHeader

TheJSTFHeader

;JSTFHeader table definition

00010000

0x00010000

;version

0001

1

;JstfScriptCount

;JstfScriptRecord[0]

74686169

"thai"

;JstfScriptTag

000C

ThaiScript

;offset to JstfScript table


Example 2: JstfScript Table, ExtenderGlyph Table, JstfLangSysRecord, and JstfLangSys Table

Example 2 shows a JstfScript table for the Arabic script and the tables it references. The DefJstfLangSys table defines justification data to apply to the script in the absence of language-specific information. In the example, the table lists two justification suggestions in priority order.

JstfScript also supplies language-specific justification data for the Farsi language. The JstfLangSysRecord identifies the language and references its JstfLangSys table. The FarsiJstfLangSys lists one suggestion for justifying Farsi text.

The ExtenderGlyph table in JstfScript lists the indices of all the extender glyphs used in the script.

Example 2

Hex Data

Source

Comments

JstfScript

ArabicScript

;JstfScript table definition

000C

ArabicExtenders

;ExtenderGlyph

0012

ArabicDefJstfLangSys

;offset to DefJstfLangSys table

0001

1

;JstfLangSysCount

;JstfLangSysRecord[0]

50455220

"FAR "

;JstfLangSysTag

0018

FarsiJstfLangSys

;JstfLangSys

ExtenderGlyph

ArabicExtenders

;ExtenderGlyph table definition

0002

2

;GlyphCount

01D3

TatweelGlyphID

;ExtenderGlyph[0]

01D4

LongTatweelGlyphID

;ExtenderGlyph[1]

JstfLangSys

ArabicDefJstfLangSys

;JstfLangSys table definition

0002

2

;JstfPriorityCnt

000A

ArabicScriptJstfPriority1

;offset to JstfPriority[0] table

001E

ArabicScriptJstfPriority2

;offset to JstfPriority[1] table

JstfLangSys

FarsiJstfLangSys

;JstfLangSys table definition

0001

1

;JstfPriorityCnt

002C

FarsiLangJstfPriority1

;offset to JstfPriority[0] table


Example 3: JstfPriority Table, JstfGSUBModList Table,
and JstfGPOSModList Table

Example 3 shows the JstfPriority and JstfModList table definitions for two justification suggestions defined in priority order. The first suggestion uses ligature substitution to shrink the lengths of text lines, and it extends line lengths by replacing ligatures with their individual glyph components. Other lookup actions are not recommended at this priority level and are set to NULL. The associated JstfModList tables enable and disable three substitution lookups.

The second suggestion enables glyph kerning to reduce line lenths and disables glyph kerning to extend line lengths. Each action uses three lookups. This suggestion also includes a JstfMax table to extend line lengths, called WordSpaceExpandMax, which is described in Example 4.

Example 3

Hex Data

Source

Comments

JstfPriority

USEnglishFirstJstfPriority

;JstfPriority table definition

0028

EnableGSUBLookupsToShrink

;offset to ShrinkageEnableGSUB

; JstfGSUBModList table

0000

NULL

;offset to ShrinkageDisableGSUB

; JstfGSUBModList table

0000

NULL

;offset to ShrinkageEnableGPOS

; JstfGPOSModList table

0000

NULL

;offset to ShrinkageDisableGPOS

; JstfGPOSModList table

0000

NULL

;offset to Shrinkage JstfMax

; table

0000

NULL

;offset to ExtensionEnableGSUB

; JstfGSUBModList table

0038

DisableGSUBLookupsToExtend

;offset to ExtensionDisableGSUB

; JstfGSUBModList table

0000

NULL

;offset to ExtensionEnableGPOS

; JstfGPOSModList table

0000

NULL

;offset to ExtensionDisableGPOS

; JstfGPOSModList table

0000

NULL

;offset to Extension JstfMax

; table

JstfPriority

USEnglishSecondJstfPriority

;JstfPriority table definition

0000

NULL

;offset to ShrinkageEnableGSUB

; JstfGSUBModList table

0000

NULL

;offset to ShrinkageDisableGSUB

; JstfGSUBModList table

0000

NULL

;offset to ShrinkageEnableGPOS

; JstfGPOSModList table

001C

DisableGPOSLookupsToShrink

;offset to ShrinkageDisableGPOS

; JstfGPOSModList table

0000

NULL

;offset to Shrinkage JstfMax

; table

0000

NULL

;offset to ExtensionEnableGSUB

; JstfGSUBModList table

0000

NULL

;offset to ExtensionDisableGSUB

; JstfGSUBModList table

002C

EnableGPOSLookupsToExtend

;offset to ExtensionEnableGPOS

; JstfGPOSModList table

0000

NULL

;offset to ExtensionDisableGPOS

; JstfGPOSModList table

0000

NULL

;offset to Extension JstfMax

; table

JstfGSUBModList

EnableGSUBLookupsToShrink

;JstfGSUBModList table

; definition

; enable three ligature

; substitution lookups

0003

3

;LookupCount

002E

46

;LookupIndex[0]

0035

53

;LookupIndex[1]

0063

99

;LookupIndex[2]

JstfGPOSModList

DisableGPOSLookupsToShrink

;JstfGPOSModList table

; definition

; disable three tight kerning

; lookups

0003

3

;LookupCount

006C

108

;LookupIndex[0]

006E

110

;LookupIndex[1]

0070

112

;LookupIndex[2]

JstfGSUBModList

DisableGSUBLookupsToExtend

;JstfGSUBModList table

; definition

; disable three ligature

; substitution lookups

0003

3

;LookupCount

002E

46

;LookupIndex[0]

0035

53

;LookupIndex[1]

0063

99

;LookupIndex[2]

JstfGPOSModList

EnableGPOSLookupsToExtend

;JstfGPOSModList table

; definition

; enable three tight kerning

; lookups

0003

3

;LookupCount

006C

108

;LookupIndex[0]

006E

110

;LookupIndex[1]

0070

112

;LookupIndex[2]


Example 4: JstfMax Table

The JstfMax table in Example 4 defines a lookup to expand the advance width of the word space glyph and extend line lengths. The lookup definition is identical to the SinglePos lookup type in the GPOS table although it is enabled only when justifying text. The ValueRecord in the WordSpaceExpand lookup subtable specifies an XAdvance adjustment of 360 units, which is the maximum value the font developer recommends for acceptable text rendering. The text-processing client may implement the lookup using any value between zero and the maximum.

Example 4

Hex Data

Source

Comments

JstfMax

WordSpaceExpandMax

;JstfMax table definition

0001

1

;LookupCount

0004

WordSpaceExpandLookup

;offset to Jstf Lookup[0] table

Lookup

WordSpaceExpandLookup

;Jstf Lookup table definition

0001

1

;LookupType

; SinglePos Lookup

0000

0x0000

;LookupFlag

0001

1

;SubTableCount

0008

WordSpaceExpandSubtable

;offset to Subtable[0]

; SinglePos subtable

SinglePosFormat1

WordSpaceExpandSubtable

;SinglePos subtable definition

0001

1

;PosFormat

0008

WordSpaceCoverage

;offset to Coverage table

0004

0x0004

;ValueFormat

; XAdvance only

0168

360

;Value

; XAdvance value

; in Jstf, this is a max value

; expand word space from zero

; to this amount

CoverageFormat1

WordSpaceCoverage

;Coverage table definition

0001

1

;CoverageFormat

0001

1

;GlyphCount

0022

WordSpaceGlyphID

;GlyphArray[0]