TrueEdit Technical Reference


This appendix documents miscellaneous internal technical details of TrueEdit which may be of interest to font developers.

TrueEdit source table formats

Much of the binary data in the mort, kern, and just tables is compiled from source-format tables. These source tables have names of the form TRnn, where nn is a two-digit number. (The EDT0 and EDT1 tables are not used by TrueEdit.)

In general, source tables are introduced only when necessary; whenever possible, the binary data is decompiled instead. One kind of data that is very difficult (or impossible) to decompile is a state table; therefore, for each kind of state table that may be present in a font, a corresponding source table has been defined.

The usage and formats of all the TRnn tables currently used by TrueEdit are documented below.

TR00: Required Ligatures

The TR00 table is used to compile the mort subtable that implements the Required Ligatures feature setting. It has the following format:

Type

Name

Description

uint16

nLigs

The number of ligatures in the table

SrcLig

ligArray[nLigs]

The ligatures list, sorted in increasing dictionary order of the component glyph ids. (By "dictionary order", what is meant is the ordering of strings as in a dictionary, i.e. sorting on the first glyph, then on the second, then on the third, and so on.)

Each SrcLig has the following format:

Type

Name

Description

uint16

ligGlyphId

The glyph ID of the ligature

uint16

nComps

The number of component glyphs in the ligature (2 or 3)

uint16

compGlyphIds[3]

The glyph IDs of the component glyphs

TR01: Common Ligatures

The TR01 table is used to compile the mort subtable that implements the Common Ligatures feature setting. It has the same format as the TR00 table.

TR02: Rare Ligatures

The TR02 table is used to compile the mort subtable that implements the Rare Ligatures feature setting. It has the same format as the TR00 table.

TR03: Logos

The TR03 table is used to compile the mort subtable that implements the Logos feature setting. It has the same format as the TR00 table.

TR04: Rebus Pictures

The TR04 table is used to compile the mort subtable that implements the Rebus Pictures feature setting. It has the same format as the TR00 table.

TR05: Cursive

The TR05 table is used to compile the mort subtable that implements the Cursive feature setting.

At the moment, this table is capable of implementing only the kind of cursive script found in Arabic text. It is not capable of implementing Roman cursive text. At some point in the future TrueEdit may support Roman cursive, at which time the format of this table will have to change.


The TR05 table currently has the following format:

Type

Name

Description

int32

numQuadruples

The number of cursive entries in the table

int32

numKashidas

The number of kashida glyphs in the table

int32

numVowels

The number of vowel glyphs in the table

uint16

firstKashida

The smallest kashida glyph ID in the table

uint16

lastKashida

The largest kashida glyph ID in the table

uint16

firstVowel

The smallest vowel glyph ID in the table

uint16

lastVowel

The largest vowel glyph ID in the table

uint16

firstSole

The smallest standalone glyph ID in the table

uint16

lastSole

The largest standalone glyph ID in the table

uint16

firstFinal

The smallest final glyph ID in the table

uint16

lastFinal

The largest final glyph ID in the table

uint16

kashidas[numKashidas]

The glyph IDs of the kashidas in the table, in increasing glyph ID order

uint16

vowels[numVowels]

The glyph IDs of the vowels in the table, in increasing glyph ID order

QuadrupleRec

quads[numQuadruples]

The list of cursive entries in the table, sorted in increasing order of the glyph ID of the standalone form of the glyph in each cursive entry


Each QuadrupleRec has the following format:

Type

Name

Description

uint16

sole

The glyph ID of the standalone form of the glyph

uint16

final

The glyph ID of the final form of the glyph

uint16

medial

The glyph ID of the medial form of the glyph

uint16

initial

The glyph ID of the initial form of the glyph

TR06: Show Diacritics

The TR06 table is used to compile the mort subtable that implements the Show Diacritics feature setting. It has the same format as the TR00 table.

TR07: Hide Diacritics

The TR07 table is used to compile the mort subtable that implements the Hide Diacritics feature setting. It has the same format as the TR00 table.

TR08: Ordinals

The TR08 table is used to compile the mort subtable that implements the Ordinals feature setting. It has the following format:

Type

Name

Description

uint16

numDigits

The number of digit glyphs in the table

uint16

numLetters

The number of (letter, superior) entries in the table

uint16

firstDigit

The smallest digit glyph ID in the table

uint16

lastDigit

The largest digit glyph ID in the table

uint16

firstLetter

The smallest letter glyph ID in the table

uint16

lastLetter

The largest letter glyph ID in the table

DigitRec

digits[numDigits]

The list of digits that can take ordinals, sorted in increasing glyph ID order

LetterRec

letters[numLetters]

The list of (letter, superior) entries, sorted in increasing order of letter glyph ID


Each DigitRec has the following format:

Type

Name

Description

uint16

digit

The glyph ID of a digit

Boolean

selectionFlag

A flag indicating whether the corresponding cell in the TrueEdit edit window is currently selected (i.e., highlighted)



Each LetterRec has the following format:

Type

Name

Description

uint16

letter

The glyph ID of a letter

uint16

superior

The glyph ID of the superior form of the letter

Boolean

selectionFlag

A flag indicating whether the corresponding cell in the TrueEdit edit window is currently selected (i.e., highlighted)

TR09: Vertical Fractions

The TR09 table is used to compile the mort subtable that implements the Vertical Fractions feature setting. It has the same format as the TR00 table.

TR10: Diagonal Fractions

The TR10 table is used to compile the mort subtable that implements the Diagonal Fractions feature setting. It has the following format:

Type

Name

Description

uint16

numTriplets

The number of (digit, numerator, denominator) entries in the table

uint16

numSlashes

The number of slash glyphs in the table

uint16

firstSlash

The smallest slash glyph ID in the table

uint16

lastSlash

The largest slash glyph ID in the table

uint16

firstDigit

The smallest digit glyph ID in the table

uint16

lastDigit

The largest digit glyph ID in the table

uint16

firstLower

The smallest denominator glyph ID in the table

uint16

lastLower

The largest denominator glyph ID in the table

SlashRec

slashes[numSlashes]

The list of slashes, sorted in increasing glyph ID order

TripletRec

triplets[numTriplets]

The list of (digit, numerator, denominator) entries, sorted in increasing order of the digit glyph IDs



Each SlashRec has the following format:

Type

Name

Description

uint16

glyphId

The glyph ID of the slash

Boolean

selectionFlag

A flag indicating whether the corresponding cell in the TrueEdit edit window is currently selected (i.e. highlighted)



Each TripletRec has the following format:

Type

Name

Description

uint16

digit

The glyph ID of a digit

uint16

upper

The glyph ID of the numerator form of that digit

uint16

lower

The glyph ID of the denominator form of that digit

Boolean

selectionFlag

A flag indicating whether the corresponding cell in the TrueEdit edit window is currently selected (i.e. highlighted)

TR11: Contextual Kerning

The TR11 table is used to compile the kern subtable that implements Contextual Kerning. It has the following format:

Type

Name

Description

KernOctalRec

octals[]

The list of contextual kerning entries. Each entry describes a sequence of up to eight glyphs, as well as the kerning values between these glyphs. The number of entries in the table is determined by dividing the size of the table by the size of an entry


Each KernOctalRec has the following format:

Type

Name

Description

unsigned short

numGlyphs

The number of glyphs in the contextual kerning string

unsigned short

glyphs[8]

The glyph IDs of the glyphs composing the string

int16

kernVals[7]

The kerning values that apply between the glyphs in the string

Boolean

selectionFlag

A flag indicating whether the corresponding row in the TrueEdit edit window is currently selected (i.e. highlighted)

 

TR12: Class-Based Kerning

The TR12 table is used to compile the kern subtable that implements Class-Based Kerning. Its format is not documented here because this table may be removed in future versions of TrueEdit.

[Sticky!]

TR13: Justification

The TR13 table is used to compile the just table, which implements Justification. Its format is not documented here at this time because:

(1) It is quite complex

(2) It will probably change with future versions of the just editor in TrueEdit.

[Sticky!]

TR14: Smart Swashes

The TR14 table is used to compile the mort subtables that implement the various Smart Swashes feature settings (Word Initial Swashes, Word Final Swashes, Line Initial Swashes, Line Final Swashes, and Non-Final Swashes). It has the following format:

Type

Name

Description

Boolean

subtableType[5]

Five flags indicating whether each of the corresponding five Smart Swashes settings currently exists in the mort table

int32

numSwash

The number of swash entries in the table

int32

numPunc

The number of punctuation glyphs in the table

int32

numSpec

The number of special glyphs in the table

uint16

firstGlyph

The smallest normal, i.e. non- swash, glyph ID in the table

uint16

lastGlyph

The largest normal, i.e. non- swash, glyph ID in the table

uint16

firstPunc

The smallest punctuation glyph ID in the table

uint16

lastPunc

The largest punctuation glyph ID in the table

uint16

firstSpec

The smallest special glyph ID in the table

uint16

lastSpec

The largest special glyph ID in the table

uint16

punc[numPunc]

The glyph IDs of the punctuation glyphs, sorted in increasing glyph ID order

uint16

spec[numSpec]

The glyph IDs of the special glyphs, sorted in increasing glyph ID order

MortSwashRec

swashRecs[numSwash]

The swash entries, sorted in increasing glyph ID order of the normal, i.e. non-swash, form of the glyph in each swash entry

Each MortSwashRec record has the following format:

Type

Name

Description

long

glyph

The glyph ID of the normal, i.e. non-swash, form of the glyph

long

wordInitial

The glyph ID of the Word Initial swash form of the glyph

long

wordFinal

The glyph ID of the Word Final swash form of the glyph

long

lineInitial

The glyph ID of the Line Initial swash form of the glyph

long

lineFinal

The glyph ID of the Line Final swash form of the glyph

long

nonFinal

The glyph ID of the Non Final swash form of the glyph

TR15: Diphthong Ligatures

The TR15 table is used to compile the mort subtable that implements the Diphthong Ligatures feature setting. It has the same format as the TR00 table.

TR16: Prevent Overlap

The TR16 table is used to compile the mort subtable that implements the Prevent Overlap feature setting. Information on its format will be added to a later version of this document.

TR17: Hyphens to Em Dash

The TR17 table is used to compile the mort subtable that implements the Hyphens to Em Dash feature setting. It has the following format:

Type

Name

Description

long

hyphen

The glyph ID of the hyphen

long

emDash

The glyph ID of the em dash


TR18: Hyphen to En Dash

The TR18 table is used to compile the mort subtable that implements the Hyphen to En Dash feature setting. It has the following format:

Type

Name

Description

long

hyphen

The glyph ID of the hyphen

long

enDash

The glyph ID of the en dash

int16

numSpaces

The number of space glyphs in the table

int16

numDigits

The number of digit glyphs in the table

uint16

firstSpace

The smallest space glyph ID in the table

uint16

lastSpace

The largest space glyph ID in the table

uint16

firstDigit

The smallest digit glyph ID in the table

uint16

lastDigit

The largest digit glyph ID in the table

uint16

spaces[numSpaces]

The glyph IDs of the space glyphs, sorted in increasing glyph ID order

uint16

digits[numDigits]

The glyph IDs of the digit glyphs, sorted in increasing glyph ID order


TR19: Asterisk to Multiply

The TR19 table is used to compile the mort subtable that implements the Asterisk to Multiply feature setting. It has the following format:

Type

Name

Description

long

star

The glyph ID of the asterisk

long

multSign

The glyph ID of the multiplication sign

int16

numSpaces

The number of space glyphs in the table

uint16

firstSpace

The smallest space glyph ID in the table

uint16

lastSpace

The largest space glyph ID in the table

uint16

spaces[numSpaces]

The glyph IDs of the space glyphs, sorted in increasing glyph ID order


TR20: Exponent

The TR20 table is used to compile the mort subtable that implements the Exponent feature setting. It has the following format:

Type

Name

Description

long

caret

The glyph ID of the caret

int16

numDigits

The number of digit glyphs in the table

uint16

firstDigit

The smallest digit glyph ID in the table

uint16

lastDigit

The largest digit glyph ID in the table

MortExpDigitRec

expDigitRecs[numDigits]

The list of (digit, exponent) entries in the table, sorted in increasing glyph ID order of the digits



Each MortExpDigitRec has the following format:

Type

Name

Description

long

digit

The glyph ID of the digit

long

superiorForm

The glyph ID of the corresponding exponent


TR21: Hyphen to Minus

The TR21 table is used to compile the mort subtable that implements the Hyphen to Minus feature setting. It has the following format:

Type

Name

Description

long

hyphen

The glyph ID of the hyphen

long

minusSign

The glyph ID of the minus sign

int16

numSpaces

The number of space glyphs in the table

uint16

firstSpace

The smallest space glyph ID in the table

uint16

lastSpace

The largest space glyph ID in the table

uint16

spaces[numSpaces]

The glyph IDs of the space glyphs, sorted in increasing glyph ID order


TR22: Slash to Divide

The TR22 table is used to compile the mort subtable that implements the Slash to Divide feature setting. It has the following format:

Type

Name

Description

long

slash

The glyph ID of the slash

long

divSymbol

The glyph ID of the divide sign

int16

numSpaces

The number of space glyphs in the table

uint16

firstSpace

The smallest space glyph ID in the table

uint16

lastSpace

The largest space glyph ID in the table

uint16

spaces[numSpaces]

The glyph IDs of the space glyphs, sorted in increasing glyph ID order


TR23: Inequality Ligatures

The TR23 table is used to compile the mort subtable that implements the Inequality Ligatures feature setting. It has the following format:

Type

Name

Description

long

greaterThan

The glyph ID of the "greater than" sign

long

lessThan

The glyph ID of the "less than" sign

long

equal

The glyph ID of the equal sign

long

greaterThanOrEqualTo

The glyph ID of the "greater than or equal to" sign

long

lessThanOrEqualTo

The glyph ID of the "less than or equal to" sign


TR24: Initial Caps

The TR24 table is used to compile the mort subtable that implements the Initial Caps feature setting. It has the following format:

Type

Name

Description

int16

numPairs

The number of (lower case, upper case) glyph pairs in the table

int16

numSpaces

The number of space glyphs in the table

uint16

firstLower

The smallest lower case glyph ID in the table

uint16

lastLower

The largest lower case glyph ID in the table

uint16

firstSpace

The smallest space glyph ID in the table

uint16

lastSpace

The largest space glyph ID in the table

MortUpperPairRec

pairRecs[numPairs]

The list of (lower case, upper case) glyph pairs, sorted in increasing order of the lower case glyph ids

uint16

spaces[numSpaces]

The glyph IDs of the spaces, in increasing glyph ID order


Each MortUpperPairRec has the following format:

Type

Name

Description

long

lower

The glyph ID of a lower case glyph

long

upper

The glyph ID of the corresponding upper case glyph


TR25

Information on this table will be added to a later version of this document.

TR26: Smart Quotes

Information on this topic will be added to a later version of this document.

TrueEdit and the mort table

The format of the mort table is specified in QuickDraw GX Font Formats. In addition, TrueEdit makes some assumptions about how the mort table is laid out. If these assumptions are not valid for a particular font, then TrueEdit will not be able to open the mort table properly.

TrueEdit at present does not check the layout of the mort table first; it just goes ahead and tries to open it, and typically hangs or bombs if the layout of the table is not as expected.


The following are the assumptions made by TrueEdit regarding the overall layout of the mort table:

Currently, the only feature setting that requires more than one subtable to implement is Diagonal Fractions. It requires two subtables: one to scan the run in the forward direction, and one to scan the run in the reverse direction.

TrueEdit makes no assumptions about how many subtables are used to implement each feature setting; it can deduce this information from the Subfeature Flags of the subtables, and the Enable Flags of the Feature List entries (more on this below).

The CHMP resource

The "Build & Add" option available in TrueEdit for adding a cmap subtable is useful because it allows the user to add a complete subtable, without having to specify any of the new subtable's entries. The entries in the new subtable are determined by the platform, script, and language IDs specified by the user. TrueEdit determines the format (0, 4, or 6) of the new subtable based on its contents.

The new subtable is built by using a CHMP resource (from TrueEdit's resource file) in conjunction with an existing cmap subtable in the font. Details of the CHMP resource follow.

How it works

The CHMP resource maps character codes in a source (src) encoding to those in a destination (dest) encoding. For example, one CHMP might map Mac-Roman-English character codes to their Unicode-Roman-English equivalents, another might map Mac-Roman-Dutch codes to Microsoft-Roman-Dutch codes, etc. There may be one CHMP resource for each mapping from one set of encoding IDs to another. If CHMP resources with duplicate encoding IDs exist, the first applicable CHMP will be used.

The following diagram shows how an existing cmap subtable in an sfnt and a CHMP which shares a similar set of encoding IDs (differing only in platform) can be used to generate a new cmap subtable. The new cmap subtable maps each destination character code in the CHMP to the glyph index which is mapped to in the existing cmap subtable by the corresponding source (Mac) character code in the CHMP.


In the Add cmap Subtable dialog, TrueEdit allows the user to specify the platform, script, and language IDs of the cmap subtable to be added. The Build & Add button in this dialog will be highlighted, enabling a cmap subtable to be built from a CHMP resource and an existing cmap subtable, if the following conditions hold:

Format

ResEdit should be used to create or modify CHMP resources.

If a CHMP is being created outside of the TrueEdit resource file, create a new resource file or open an existing one in ResEdit and choose "Create New Resource" from the Resource menu. Enter CHMP in the text field, and a new window (a hex window) will appear.

If a resource file which already contains CHMPs is being used, double-click CHMP in the list and choose "Create New Resource".

In either case, the new CHMP can be built once a hex window has been created for it in ResEdit. The following is a representation of the format of the CHMP resource.


Note that:

Below is a screen snapshot taken in ResEdit. It shows an actual CHMP with its components labeled. This particular CHMP maps 256 Macintosh-Roman-English character codes to the equivalent 256 Unicode-Roman-English codes. Notice the block of FFFFs, which denote those codes which exist in the source encoding (Mac-Roman-English) but not in the destination encoding (Unicode-Roman-English).


It is simple, though a bit tedious, to create CHMPs. The benefit of spending the time creating a CHMP is that TrueEdit users will not have to spend time on painful and repetitive entry of character codes and their associated glyph indices; this process is automated by the presence of CHMP resources.

For more information

Consult the documents TrueType Font Format Specification and QuickDraw GX Font Formats for more information on cmaps. The latter document offers an in-depth explanation of the different cmap formats, including format 2, which might be useful in working with cmaps.




Arleigh Movitz (movitz@applelink.apple.com)
Dave Opstad (opstad@apple.com)
Kristian Walsh (walsh.k@euro.apple.com)