Important: The information in this document is obsolete and should not be used for new development.
About WorldScript I
Script systems developed prior to system software version 7.1 contain their own code to handle language-specific text processing. Each script system also has its own initialization and configuration code, installing itself at startup and adding its own modifications to the system. This process can result in a layering of patches to the same traps, inconsistent behavior, and inefficient use of memory.WorldScript I redefines what a script system consists of by combining the executable code for many routines for all 1-byte script systems. It includes initialization and formatting routines that support all contextual forms required by all 1-byte scripts; script-specific behavior is encoded in resource-based tables. This approach reduces memory requirements for multiscript systems and avoids layering of patches.
WorldScript I routes script-aware calls through each universal script's own dispatch table; the dispatch table initially points back to the script utility routines in WorldScript I. This indirection allows your application to add to or replace existing routines on a script-by-script basis. Script Manager calls allow you to modify or add to any script's utility routine or patch. You can even replace an individual script system's routine completely if you need features significantly different from those provided by WorldScript I. Script utilities and dispatch tables are described in the next section and under "Flexible Dispatching Method" beginning on page A-28.
Shared Script Utilities and QuickDraw Patches
The script utilities are the low-level routines through which an individual script system implements script-aware Text Utilities, QuickDraw, and Script Manager routines. When an application makes a script-aware call, the script management system converts it to a script utility call and passes it on to the appropriate script system. Previous to system software version 7.1, individual script systems provided their own script utilities. With WorldScript I, a single set of script utilities can work with all 1-byte complex scripts.Two Script Manager routines,
GetScriptUtilityAddress
andSetScriptUtilityAddress,
allow you to access and override a script's
utility routines.Table A-11 lists the script utilities implemented by WorldScript I, along with the chapters in this book that describe their corresponding high-level routines.
Script utilities supported by WorldScript I (Continued) Script utility Chapter in this book CharacterByteType Script Manager CharacterType Script Manager CharToPixel QuickDraw Text DrawJustified QuickDraw Text FillParseTable Script Manager FindScriptRun[9] Text Utilities FindWordBreaks [9] Text Utilities GetScriptQDPatchAddress Script Manager GetScriptUtilityAddress Script Manager GetScriptVariable[10] Script Manager HiliteText QuickDraw Text MeasureJustified QuickDraw Text PixelToChar QuickDraw Text PortionLine QuickDraw Text SetScriptQDPatchAddress Script Manager SetScriptUtilityAddress Script Manager SetScriptVariable Script Manager TransliterateText Script Manager VisibleLength QuickDraw Text WorldScript I 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
).WorldScript I also patches four standard QuickDraw text-handling routines:
StdText
,StdTxMeas
,MeasureText
, andFontMetrics
. (FontMetrics
is a Font Manager routine, but for simplicity all four routines and patches are referred to in this appendix as QuickDraw routines and patches.) The purpose of the QuickDraw patches is to lay out text according to context and line direction. The original QuickDraw routine is called after the text is laid out properly. The QuickDraw dispatch table has special entries to support developer patching of routines for printing as well as for display.Two Script Manager routines,
GetScriptQDPatchAddress
andSetScriptQDPatchAddress
, allow you to access and override a script's
QuickDraw patches.Table A-12 lists the QuickDraw patches implemented by WorldScript I, along with the chapters in this book that describe the original routines.
Table A-12 QuickDraw patches supported by WorldScript I QuickDraw patch Chapter in this book FontMetrics Font Manager MeasureText QuickDraw Text StdText QuickDraw Text StdTxMeas QuickDraw Text Table-Based Script Behavior
The shared script utilities determine script-specific characteristics from the tables in each script system's international resources.WorldScript I uses tables in a script system's string-manipulation (
'itl2'
) resource for analyzing character types, finding word breaks, and performing case conversion. This use of tables predates the existence of WorldScript I, but WorldScript I extends the use of tables to all routines for 1-byte complex script systems. New tables that are required are put in the script's encoding/rendering ('itl5'
) resource, using a tagged-table index for storage and retrieval. For example, the contextual formatting routines (described in the next section) uses tables in the encoding/rendering resource.The international resources are described in the appendix "International Resources" in this book.
Contextual Formatting Routines
WorldScript I uses a set of table-driven routines to format text according to each script's requirements and attributes. The WorldScript I script utilities and QuickDraw patches that perform text formatting and layout rely on these table-driven routines. Each script has several tables in its encoding/rendering ('itl5'
) resource to specify the display characteristics of its text.Flexible Dispatching Method
Each enabled script system has a script record, a private data structure that holds information and addresses pertinent to that script. When an application makes a script-aware call, the script management system determines the current script and consults that script's script record for the address of the script's dispatch routine (which is actually part of WorldScript I). It passes the call to the dispatch routine, which uses the script's dispatch table to execute the proper script utility. Every script system has its own pointer to the dispatch routine and its own dispatch table, separate from other scripts. When the application makes a script-aware QuickDraw call, WorldScript I uses the script's QuickDraw dispatch table to execute the proper QuickDraw patch.At run time, the application call has been converted to a lower-level script utility call or QuickDraw call. Each script utility call includes a script utility selector, a number that the dispatch routine uses to select the proper routine from the dispatch table.
[9] The Script Manager handles these routines directly if the necessary tables are in the script's'itl2'
resource. Otherwise, they are passed to WorldScript I.
[10] The Script Manager handles these routines directly if the standard selectors documented in this book are used. The routines are passed to WorldScript I if private selectors are used.