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 /
Chapter 1 - Introduction to Text on the Macintosh / Writing Systems and Script Systems


Components of a Script System

The Macintosh script management system, as described in the previous section, is designed to manipulate text according to information contained in script systems. This section describes how script systems are organized.

A Macintosh script system is a collection of resources, mostly tables of data, that defines the behavior of a particular writing system. The script system specifies the character set, sorting orders, date and number formats, line direction, character reordering, accent placement, and other writing-system-specific features. Your application uses the information in a script system when it makes a script-aware text-handling call, and it can also access the resources of a script system directly, to inspect or modify its behavior.

Each Macintosh script system consists of a set of international resources and a set of keyboard resources. In addition, a script system requires one or more fonts in order to display its text. A script system may also have a control panel device through which the user can configure the individual characteristics of the script at any time.

Resources in general are described in the chapter "Resource Manager," in Inside Macintosh: More Macintosh Toolbox.

International Resources

The international resources are a set of Macintosh resources that specify text handling and display information for a particular writing system, language, or region. Such information includes number and currency formats, long and short date formats, preferred sorting order, character type, case conversion, and word-boundary information.

Table 1-1 lists the international resources, shows their resource types, and summarizes their contents.
The international resources (Continued)
NameResource typeContent
International configuration'itlc'Configuration of the system script, plus Script Manager flags, and the region code for the system script
Script sorting'itlm'Tables showing sorting order and mapping among script systems, languages, and regions
International bundle'itlb'IDs of all required resources for a script system, plus bit flags, default language, and other settings
Numeric format'itl0'Number and currency formats, short date and time formats, unit of measurement for a script system, plus a region code
Long-date format'itl1'Long date and time formats, names of days and months for a script system, plus a region code
String manipulation'itl2'Sorting routines, tables for character type, case conversion, and word boundaries for a script system
Tokens'itl4'Tables and code for converting characters to tokens and back in a script system, and for formatting numbers
Encoding/rendering'itl5'Tables for character rendering (for 1-byte script systems); tables for character encoding (for 2-byte script systems)
Transliteration'trsl'Tables for phonetic conversion among subscripts of a 2-byte script system

International resources reside in the resource fork of the Macintosh System file. However, not every installed script system requires a complete set of them:

A single script system may have multiple localized versions of its 'itl0', 'itl1', 'itl2', 'itl4', 'itl5', and 'trsl' resources, in order to represent different languages or regional variations of the script. You can manipulate text in different formats within that script system by switching among the multiple versions of the resources. See "Installing Modifications to a Script System" beginning on page 1-103.

See the appendix "International Resources" in this book for more information on international resources.

Keyboard Resources

The keyboard resources are a set of Macintosh resources that specify how keyboard input is converted to text for a particular writing system, language, or region. The Event Manager, the Script Manager, and the Menu Manager use the information in these resources to convert keypresses to character codes, to switch input among different script systems, and to display the icon of the current keyboard in the Keyboard menu. The Resource Manager, the Event Manager and the Menu Manager are described in Inside Macintosh: Macintosh Toolbox Essentials; the Resource Manager is described
in Inside Macintosh: More Macintosh Toolbox.

Table 1-2 lists the keyboard resources, shows their resource types, and summarizes
their purpose.
The keyboard resources (Continued)
NameResource typeContent
Key map'KMAP'Maps hardware-dependent raw key codes to hardware-independent virtual key codes
Key remap'itlk'Remaps some virtual key codes from certain keyboards for use by some keyboard-layout resources
Keyboard layout'KCHR'Maps virtual key codes to character codes; represents the character set for a script system
Keyboard icons'kcs#'Keyboard icon list for black-and-white icon display in the Keyboard menu
 'kcs4'Keyboard icon list for 4-bit color/gray-scale icon display in the Keyboard menu
 'kcs8'Keyboard icon list for 8-bit color/gray-scale icon display in the Keyboard menu
Keyboard swap'KSWP'Specifies modifier-plus-key combinations to let the user change keyboard layout, keyboard script, or input method
Key caps'KCAP'Determines keyboard display for a given physical keyboard (in Key Caps desk accessory)

Keyboard resources reside in the resource fork of the Macintosh System file. Some are script-related, but others are hardware-related and script-independent:

See the appendix "Keyboard Resources" in this book for more information.

Fonts

A font is not technically part of a script system. The script's international bundle resource does not have to specify any particular font resource IDs, and even if it does, their presence is not guaranteed. Nevertheless, no script system can be used unless one or more fonts accompany it.

A Macintosh font implements the character set and other written forms such as ligatures for a given script system. Each font contains a particular set of glyphs that share certain design characteristics. Those glyphs constitute a typeface, and the typeface has a name, such as Times, Helvetica\xC6, or Kyoto. A font may be a plain implementation of a typeface, or it may be styled--such as bold or italic. (QuickDraw can also produce styled versions of the characters of a typeface from a plain font.)

Glyphs in a font represent each of the characters of a character set. Additional glyphs may be present to represent ligatures, and other contextual forms. In some fonts there may be more contextual glyphs than character glyphs.

A font maps character codes to glyphs, and may contain tables that map special glyph codes to the glyphs of contextual forms. When laying out and drawing text, the script management system uses information in the font to convert character codes in memory to a properly formatted series of glyphs on the screen or on the page.

Macintosh fonts are either bitmapped (meaning that each glyph is a single bitmap) or outline (meaning that each glyph is a mathematical outline that is size-independent). A bitmapped font contains a single set of glyphs at a fixed size, whereas one outline font can produce glyphs of any size.

Fonts are either 1-byte--meaning that they have glyphs for 256 or fewer characters--or 2-byte, meaning that they can have glyphs for thousands of characters. The 1-byte fonts represent character codes that are 1 byte long, and include all fonts of the Roman script system. The 2-byte fonts represent character codes that are 1 byte or 2 bytes long, and include fonts of the Chinese, Japanese, and Korean script systems. The script management system supports 2-byte fonts, and can correctly handle mixtures of 1-byte and 2-byte characters in text.

Each font is a Macintosh resource. For ease of reference, fonts are grouped into font families (resource type 'FOND'). Each family consists of all the available sizes and styled variations of a single named typeface. For example, "Courier 10", "Courier 12 Italic", and "Courier Semibold" could be two bitmapped fonts and one outline font belonging to the single font family "Courier". Whenever you supply a font ID to a script management call, it is the 'FOND' resource ID that you supply (unless you supply the special font designators 0 or 1; see page 1-61).

As with other script-related resources, the ID numbers for fonts are in a range that defines the script system they belong to. See, for example, Figure 1-35 on page 1-50. In fact, the script management system relies fundamentally on font family ID to determine the script system associated with any text that is to be manipulated or drawn.

See the section "Font Handling" beginning on page 1-60 of this chapter for more information and programming suggestions involving fonts. See the chapter "Font Manager" for more specific information on font structure and use. For more complete information on both 1-byte and 2-byte TrueType fonts, see The TrueType Font Format Specification, available from APDA.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996