Carbon


Selectors for Script Variables

Header: Script.h

enum {
    smScriptVersion = 0,
    smScriptMunged = 2,
    smScriptEnabled = 4,
    smScriptRight = 6,
    smScriptJust = 8,
    smScriptRedraw = 10,
    smScriptSysFond = 12,
    smScriptAppFond = 14,
    smScriptBundle = 16,
    smScriptNumber = 16,
    smScriptDate = 18,
    smScriptSort = 20,
    smScriptFlags = 22,
    smScriptToken = 24,
    smScriptEncoding = 26,
    smScriptLang = 28
};

Constant descriptions

smScriptVersion

(2 bytes) The script system’s version number. When the Script Manager loads the script system, the script system puts its current version number into this variable. The high-order byte contains the major version number, and the low-order byte contains the minor version number.

smScriptMunged

(2 bytes) The modification count for this script system’s script variables. The Script Manager increments the variable accessed by the smScriptMunged selector each time the SetScriptVariable function is called for this script system. You can check this variable at any time to see whether any of your own data structures that depend on this script system’s script variables need to be updated.

smScriptEnabled

(1 byte) The script-enabled flag, a Boolean value that indicates whether the script has been enabled. It is set to $FF when enabled and to 0 when not enabled. Note that this variable is not equivalent to the Script Manager variable accessed by the smEnabled selector, which is a count of the total number of enabled script systems.

smScriptRight

(1 byte) The right-to-left flag, a Boolean value that indicates whether the primary line direction for text in this script is right-to-left or left-to-right. It is set to $FF for right-to-left text (used in Arabic and Hebrew script systems) and to 0 for left-to-right (used in Roman and other script systems).

smScriptJust

(1 byte) The script alignment flag, a byte that specifies the default alignment for text in this script system. It is set to $FF for right alignment (common for Arabic and Hebrew), and it is set to 0 for left alignment (common for Roman and other script systems). This flag usually has the same value as the smScriptRight flag.

smScriptRedraw

(1 byte) The script-redraw flag, a byte that provides redrawing recommendations for text of this script system. It describes how much of a line should be redrawn when a user adds, inserts, or deletes text. It is set to 0 when only a character should be redrawn (used by the Roman script system), to 1 when an entire word should be redrawn (used by the Japanese script system), and to –1 when the entire line should be redrawn (used by the Arabic and Hebrew script systems). These constants are available for the script-redraw flag:

smScriptSysFond

(2 bytes) The preferred system font, the font family ID of the system font preferred for this script. In the Roman script system, this variable specifies Chicago font, whose font family ID is 0 if Roman is the system script. The preferred system font in the Japanese script system is 16384, the font family ID for Osaka.

This variable holds similar information to the variable accessed through the smScriptSysFondSize selector. However, changing the value of this variable has no effect on the value accessed through smScriptSysFondSize.

Remember that in all localized versions of system software the special value of 0 is remapped to the system font ID. Thus, if an application running under Japanese system software specifies a font family ID of 0 in a function or in the txFont field of the current graphics port, Osaka will be used. However, the variable accessed by smScriptSysFond will still show the true ID for Osaka (16384).

smScriptAppFond

(2 bytes) The preferred application font; the font family ID of the application font preferred for this script. In the Roman script system, the value of this variable is the font family ID for Geneva.

This variable holds similar information to the variable accessed through the smScriptAppFondSize selector. However, changing the value of this variable has no effect on the value accessed through smScriptAppFondSize.

Remember that in all localized versions of system software the special value of 1 is remapped to the application font ID. For example, if an application running under Arabic system software specifies a font family ID of 1 in a function, Nadeem will be used. However, the variable accessed by smScriptSysFond will still show the true ID for Nadeem (17926).

smScriptBundle
smScriptNumber

(2 bytes) The resource ID of the script’s numeric-format ('itl0') resource. The numeric-format resource includes formatting information for the correct display of numbers, times, and short dates. The value of this variable is initialized from the script system’s international bundle resource.

smScriptDate

(2 bytes) The resource ID of the script’s long-date-format ('itl1') resource. The long-date-format resource includes formatting information for the correct display of long dates (dates that include month or day names). The value of this variable is initialized from the script system’s international bundle resource.

smScriptSort

(2 bytes) The resource ID of the script’s string-manipulation ('itl2') resource. The string-manipulation resource contains functions for sorting and tables for word selection, line breaks, character types, and case conversion of text. The value of this variable is initialized from the script system’s international bundle resource.

smScriptFlags

(2 bytes) The script flags word, which contains bit flags specifying attributes of the script. The value of this variable is initialized from the script system’s international bundle resource. The “Script Attribute Constants” constants are available for examining attributes in the script flags word. Bits above 8 are nonstatic, meaning that they may change during program execution. (Note that the constant values represent bit numbers in the flags word, not masks.)

The smsfIntellCP flag is set if this script system uses spaces as word delimiters. In such a script system it is possible to implement intelligent cut and paste, in which extra spaces are removed when a word is cut from text, and any needed spaces are added when a word is pasted into text. Macintosh Human Interface Guidelines recommends that you implement intelligent cut and paste in script systems that support it.

If you use the CharToPixel function to determine text widths, such as for line breaking, you need to clear the smsfReverse bit first.

smScriptToken

(2 bytes) The resource ID of the script’s tokens ('itl4') resource. The tokens resource contains information for tokenizing and number formatting. The value of this variable is initialized from the script system’s international bundle resource.

smScriptEncoding

(2 bytes) The resource ID of the script’s (optional) encoding/rendering ('itl5') resource. For 1-byte scripts, the encoding/rendering resource specifies text-rendering behavior; for 2-byte scripts, it specifies character-encoding information. The value of this variable is taken from the script system’s international bundle resource.

smScriptLang

(2 bytes) The language code for this version of the script. A language is a specialized variation of a specific script system. Constants for all defined language codes are listed in “Language Codes A”. The value of this variable is initialized from the script system’s international bundle resource.

This section lists and describes the selector constants for accessing script variables through calls to the GetScriptManagerVariable and SetScriptManagerVariable functions. In every case the variable parameter passed to or from the function is a long integer (4 bytes); the number in parentheses indicates how many of the 4 bytes are necessary to hold the input or return value for that variable. If fewer than 4 bytes are needed, the low byte or low word contains the information.

In many cases the value of a script variable is taken from the script system’s international bundle ('itlb') resource.


© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)