Important: The information in this document is obsolete and should not be used for new development.
Font and Keyboard Script Synchronization
TextEdit handles synchronization of the font script, the script system that corresponds to the font of the current graphics port, and the keyboard script, the script system used for keyboard input, for multistyled and monostyled text.For monostyled text, the primary script system determines whether or not TextEdit synchronizes the font script and the keyboard script, based on the value of a flag in the script system's international bundle resource (
'itlb'
). TextEdit uses this flag, without requiring any action on the part of your application.For multistyled text, TextEdit always synchronizes the font script and the keyboard script. (If the font script at the selection range or insertion point is the same as
the keyboard script, then this font is used.) The following sections explain the conditions that determine whether TextEdit matches the keyboard script to the font script or
vice versa. TextEdit synchronizes the keyboard script with the font script under the following conditions:
TextEdit synchronizes the font script with the keyboard script under the following condition:
- When your application calls a TextEdit routine to change the font of a text selection or to process a mouse-down event in text as either an insertion point or a selection. This means, for example, that if a user types Arabic text followed by Roman text and clicks in the Arabic text, the keyboard adjusts and changes to Arabic without the user's needing to change the keyboard manually. Similarly, if a user clicks in the Roman text, the keyboard changes to Roman without the user's altering the keyboard.
- If the selection range encompasses text--if it is not an insertion point--then TextEdit uses the font corresponding to the first character of the selected text to determine the keyboard script. When an insertion point falls on a script boundary, the keyboard is synchronized to the font of the character preceding the boundary (in storage order). (A selection range is a series of characters, selected by the user or the application, where the next editing operation is to occur. Although the character representations are contiguous in memory, they can be discontinuous on the display screen when the text is bidirectional. For more information, see "The Selection Range, the Insertion Point, and Highlighting in TextEdit" on page 2-9.)
- When your application calls a TextEdit routine to input a character and if the keyboard script is different from the font script at the selection range (or insertion point). If a font was selected and never used, thus remaining in the scrap that TextEdit uses for character attributes (null scrap) and if the font script coincides with the keyboard script, then this font is used. Otherwise, TextEdit searches through the preceding fonts in the style run table until it locates a font that corresponds to the keyboard. If one does not exist, then it uses the application font. For more information about the null scrap, see "The TextEdit Private, Null, and Style Scraps" on page 2-13.