Important: The information in this document is obsolete and should not be used for new development.
About WorldScript II
The 2-byte script systems developed prior to system software version 7.1 contain their own code to handle language-specific text processing. Each also has its own initialization and configuration code, installing itself at startup and adding its own modifications to the system. Each script system patches three different areas of system software: QuickDraw, the Event Manager, and the script management system. This can result in a layering of patches to the same traps, inconsistent behavior, and inefficient use of memory.WorldScript II, working with the Text Services Manager and other parts of system software, eliminates code duplication and provides for the special text-input needs of the 2-byte systems:
WorldScript II redefines what a 2-byte script system consists of. WorldScript II combines the executable code for many routines for all 2-byte script systems. Script-specific behavior is encoded in resource-based tables. This reduces memory requirements for multiscript systems and avoids layering of patches.
- Enhancements to QuickDraw and the Font Manager now support the display of the thousands of Chinese, Korean, and Japanese characters. To handle a character set that is larger than the 256-character ASCII range, the Font Manager and other parts of system software contain the code necessary to retrieve and render the characters.
- The Text Services Manager, using enhancements to the Event Manager, provides broad support for input methods. Input methods that employ the Text Services Manager intercept every key-down event, map the event to a character code, and pass the result to the application.
- WorldScript II provides language-specific capabilities for script-aware text-handling routines called script utilities. For instance, WorldScript II provides routines that tell whether a byte in a string is a 1-byte or 2-byte character.
Shared Script Utilities
WorldScript II contains the code for all script utilities. Script-specific behavior is determined by tables in each script's international resources. In a multiscript environment, WorldScript II loads only one copy of its code into memory. Furthermore, the user needs only the WorldScript II file in the Extensions folder, rather than one extension file per script system. This eases memory requirements and saves disk space.Table A-11 lists the script utilities implemented by WorldScript II, along with the chapters in this book that describe their corresponding high-level routines.
Table A-15 Script utilities supported by WorldScript II (Continued) Script utility Chapter in this book CharacterByteType Script Manager CharacterType Script Manager CharToPixel QuickDraw Text DrawJustified QuickDraw Text FillParseTable Script Manager FindScriptRun[11] Text Utilities FindWordBreaks[11] Text Utilities GetScriptVariable[12] Script Manager HiliteText QuickDraw Text MeasureJustified QuickDraw Text PixelToChar QuickDraw Text PortionLine QuickDraw Text SetScriptVariable[12] Script Manager TransliterateText Script Manager VisibleLength QuickDraw Text WorldScript II supports the following script utilities for backward compatibility. They call newer versions of themselves to handle their tasks. They are: Pixel2Char
(callsPixelToChar
),Char2Pixel
(callsCharToPixel
),DrawJust
(callsDrawJustified
),MeasureJust
(callsMeasureJustified
),PortionText
(callsPortionLine
),CharByte
(callsCharacterByteType
),CharType
(callsCharacterType
),ParseTable
(callsFillParseTable
),Transliterate
(callsTransliterateText
).Table-Based Script Behavior
Script-specific text behavior is controlled by tables in each script system's international resources. The encoding/rendering resource (type'itl5'
) contains character encoding information, and the transliteration resource (type'trsl'
) contains information for character conversion among subscripts of a 2-byte script.For example, the byte-type table in a script's encoding/rendering resource typically contains information about the type of a specific byte in the range of $00-$FF--whether it can be the high-order byte of a 2-byte character, the low-order byte of a 2-byte character, or a 1-byte character. The character-type table in the same resource gives more detailed information about a character in a particular coding scheme.
Currently, there are two transliteration formats used by WorldScript II and supported by tables in a script's transliteration resource. One of them is used to transliterate Jamo to Hangul (and Hangul to Jamo) in the Korean system. The other is a more general rule-based transliteration. You cannot customize the Jamo-to-Hangul transliteration. You can customize the rule-based transliteration by supplying the proper tables in a transliteration resource.
The encoding/rendering resource and the transliteration resource are described in the appendix "International Resources" in this book.
[11] The Script Manager handles these routines directly if the necessary tables are in the script's 'itl2' resource. Otherwise, they are passed to WorldScript II.
[12] The Script Manager handles these routines directly if the standard selectors documented in this book are used. The routines are passed to WorldScript II if private selectors are used.