Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Text /
Appendix B - International Resources / Encoding/Rendering Resource (Type 'itl5')


Tables for 1-Byte Script Systems

In 1-byte script systems, the encoding/rendering resource specifies character-rendering behavior. In general, only 1-byte complex script systems--those that work with the WorldScript I script extension--include an encoding/rendering resource. The defined table types at this time are

Script Configuration Table

The script configuration table (OSType = 'info') defines certain settings that affect the characteristics of a script system. The table exists so that user preferences for script configuration can be saved in a preferences file, called the script preferences file, between system restarts.

The script configuration table consists of a 6-byte header followed by a set of table entries, each of which contains a SetScriptVariable selector. The table entries correspond to script settings that the user can make, typically through a script-system control panel.

The format of the script configuration table is shown in Figure B-14.

Figure B-14 Format of the script configuration table

The resource header consists of three elements:

The entries immediately follow the header. Each entry has four elements:

For most entries in the script configuration table, the tag is 'long', the parameter length is 4 (the length of a SetScriptVariable parameter), and the parameter element contains the SetScriptVariable parameter. However, a table entry may reference variable-length data, such as a string representing the name of a script system. Such data follows the last entry in the table, and its location is specified--as an offset from the beginning of the table--in the parameter element of the table entry that references it. The data length in bytes is specified in the parameter length element of that table entry.

For example, a Hebrew encoding/rendering resource might have a script configuration table with the information shown in Table B-8.
Table B-8 A script configuration table for a Hebrew encoding/rendering resource (Continued)
OffsetValueExplanation
000x0100Version number (first release = 1.0)
020x0000(reserved)
040x0004Four tables follow
   
(The table entries start here)
06'long'The data type is a long
100x006SetScriptVariable selector smScriptRight
120x0004Four bytes follow
160xFFFF-1 = right-to-left line direction
   
20'long'The data type is a long
240x0008SetScriptVariable selector smScriptJust
260x0004Four bytes follow
300xFFFF-1 = right-aligned
   
34'long'The data type is a long
380x000ASetScriptVariable selector smScriptRedraw
400x0004Four bytes follow
440xFFFF-1 = redraw entire line for each character
   
48'pstr'The data type is a Pascal string
520x002CSetScriptVariable selector smScriptName
540x0008The string is 8 bytes long (with length byte and pad)
5862Offset from beginning of table to data
   
620x6,'Hebrew'The data string

In this case, the script configuration table causes the execution of four SetScriptVariable calls, to set the script's line direction, alignment, redraw characteristics, and name.

Each script system generally has two versions of the script configuration table: one in the encoding/rendering resource and one in a script preferences file in the Preferences folder within the user's System Folder. The table in the encoding/rendering resource has an OSType tag of 'info'; the corresponding table in the preferences file is a resource of type 'CNFG'. The script preferences file is a file of type 'pref' with creator 'univ'.

Both script configuration tables are used at startup. When installing a 1-byte complex script system, WorldScript I locates the script configuration table in the script's encoding/rendering resource, and loops through the table for as many times as there are entries in it, making a SetScriptVariable call for each entry. WorldScript I then looks for a 'CNFG' resource for that script system in the script preferences file, and loops through that table. Thus a script system is always configured to its default settings at initialization, and then those settings are modified to reflect any user changes that have been saved. WorldScript I is described in the appendix "Built-in Script Support" in
this book.

Line-Layout Metamorphosis Table

The line-layout metamorphosis table (OSType = 'mort') specifies a set of transformations that the WorldScript I contextual formatting routines can apply to
the glyphs of a font. WorldScript I is described in the appendix "Built-in Script Support" in this book.

A transformation can be something simple, such as a ligature, or something complex, such as a number of changes (ligatures plus ornateness of style plus positioning of glyphs in a word). These transformations are called text features in the context of the metamorphosis table. Each text feature can have different settings, or levels of operation.

These are the text features and settings currently supported by the contextual formatting routines in WorldScript I:

The line-layout metamorphosis table is identical in format to the "glyph metamorphosis table" described in the currently unpublished document TrueType GX Font Table Formats, available from Macintosh Developer Technical Support.

Line-Layout Glyph-Properties Table

The line-layout glyph properties table (OSType = 'prop') defines the properties associated with each glyph in a font. Examples of a glyph's properties are its line direction and whether or not it is a space character.

The line-layout glyph properties table is identical in format to the "glyph properties table" described in the currently unpublished document TrueType GX Font Table Formats, available from Macintosh Developer Technical Support.

Character Expansion Table

The character expansion table (OSType = 'c2c#') gives multiple-character equivalents to compound characters in a script system's character set. This table expands ligatures into their component characters, analogous to expanding the Roman ligature "\xDE" into "f" and "i". The contextual formatting routines need the character expansion table
because they are specifically designed to work with a script system's fundamental
character codes.

Figure B-15 shows the format of the character expansion table.

Figure B-15 Format of the character expansion table

The table has these elements:

The character entries immediately follow the offsets. Because the table always covers a continuous range of a character set, the character code corresponding to each character entry is calculated as (first character) + (entry number), where the first character entry is numbered 0. Each character entry has these elements:

Any character within the range of character codes for this table that does not have an expanded equivalent has a value of 0 for its offset.

Glyph-to-Character Table

The glyph-to-character table (OSType = 'pamc') maps 2-byte glyph indexes to 1-byte character codes, or to 1-byte glyph codes in bitmapped fonts whose font layouts do not exactly correspond to their script system's character encoding. The glyph-to-character table is conceptually the opposite of the TrueType character-code mapping table (type 'cmap'). It is used by the WorldScript I contextual formatting routines.

Figure B-16 shows the format of the glyph-to-character table.

Figure B-16 Format of the glyph-to-character table

The table header has these elements:

The table header is followed by an array of character code records. There is one record for each glyph index, which ranges from zero to a maximum value that can be greater than $FF. Each character code record has two elements:

Break-Table Directory

The break-table directory (OSType = 'fwrd') provides access to one or more break tables (of type NBreakTable) for use by the Text Utilities FindWordBreaks procedure. It consists of a header, followed by entries that give offsets to the break tables, followed by the break tables themselves. Figure B-17 shows the format of the break-table directory.

Figure B-17 Format of the break-table directory

The directory header has these elements:

The table entries consist of three elements each:

The break tables themselves follow the table entries.

Most script systems' break tables are in their string-manipulation ('itl2') resources. For some 1-byte complex script systems, break tables are in the encoding/rendering resource so that the Script Manager routines for replacing the WorldScript I script utilities will function correctly. See the discussions of the GetScriptUtilityAddress and SetScriptUtilityAddress routines in the chapter "Script Manager" in this book, and the discussion of WorldScript I in the appendix "Built-in Script Support."

Script Run Tables

Typically, tables to control the Text Utilities FindScriptRun function are in a script system's string-manipulation ('itl2') resource. For some 1-byte complex script systems, the script run tables (OSType = 'fstb') are in the encoding/rendering resource so that the Script Manager routines for replacing the WorldScript I script utilities will function correctly.

The set of script run tables in the encoding/rendering resource consists of a header followed by one or more tables. The header has this format:

The header is followed by one or more tables. Each script run table consists of a table flags element (4 bytes), followed by a table identical to the new-format script run table in the string-manipulation resource. See "Script Run Table Format" beginning on page B-40.

For more information, see the discussions of the GetScriptUtilityAddress and SetScriptUtilityAddress routines in the chapter "Script Manager" in this book, and the discussion of WorldScript I in the appendix "Built-in Script Support."

Kashida Preferences Table

The kashida preferences table (OSType = 'kash'), used in Arabic versions of the encoding/rendering resource, maps each glyph code to a kashida priority class. It specifies which glyphs can have kashida inserted between them, in what priority, when justifying Arabic text.

Feature List Table

The feature list table (OSType = 'flst') contains information used to override default line-layout behaviors (features) specified in the metamorphosis table (page B-63). It includes an array of feature entries, each of which specifies a feature type and a setting for that feature.

Reordering Table

The reordering table (OSType = 'reor') is a state table that specifies the classes and states used to reorder glyphs for contextual formatting. The reordering table contains offsets to three state tables and two arrays of level adjustments. The WorldScript I contextual formatting routine makes a first pass to resolve ordering of numbers, a second pass to resolve neutrals (whitespace, number separators, and terminators), and a third pass (using the values in the level adjustments arrays) to adjust nesting levels for each glyph. Finally, the routine reorders the line according to the resolved nesting levels.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996