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 / How Script Systems Work


Font Handling

As discussed under "Fonts" on page 1-44, a Macintosh font provides a specifically designed set of glyphs that implement the character set and other written forms that belong to a given script system. Fonts can be classified as 1-byte and 2-byte, and as bitmapped or outline. Some fonts provide plain (unstyled) glyphs, whereas others provide styled variations, such as bold or italic. This section summarizes some of the basic font issues to keep in mind when working with text, and especially multiscript text.

Font Availability and Selection

You cannot display text in a given script system without a font for that script system. A font is available only if its file resides in the Fonts folder within the System Folder, or if its resources are installed in the System file itself.

In terms of font availability and font selection for text, remember these points:

System Font and Application Font

Macintosh system software recognizes two special fonts that should always be present: the system font and the application font. The system font is the font used for menus, dialog boxes, and other messages to the user from the Finder or Operating System. The application font is the suggested default font for use by monostyled TextEdit and by applications that do not support user selection of fonts. In all unmodified Roman versions of Macintosh system software, the system font is 12-point Chicago and the application font is 12-point Geneva.

In all localized versions of Macintosh system software, whether Roman or not, the system font has a special font designator of 0, and the application font has a special designator of 1. These special designators are not actual font family resource ID numbers and cannot be used as such in Resource Manager calls; however, you can use them in place of a font family ID in the txFont field of the graphics port, and in text-related calls that take a font family ID, such as FontToScript. The system maps the special designators to the actual font family IDs for the system font and application font. You can use the Font Manager to determine the actual ID numbers of the system font and application font for any system script.

Remember these points about the system font and the application font, in relation to Chicago font, Geneva font, and the special designators:

Perhaps the most common mistake developers make in adapting their applications to global markets is to assume that the application font is always Geneva. Do not assume that different script systems have the same system and application fonts.

Roman Characters and Associated Fonts

All Macintosh script systems include the low-ASCII Roman characters and control characters as part of their character sets. Most non-Roman fonts provide glyphs for those low-ASCII Roman characters. If the font itself does not contain those characters, the script system substitutes characters from an associated font--a Roman font that is associated with that script system--for character codes (mostly in the low-ASCII range) that the script system determines are Roman. Some contextual script systems must use associated fonts because they need more glyphs than can fit into the high-ASCII range normally available for native glyphs.

Note
A script system specifies the associated font for its system font and application font, but may allow the user to select a single Roman font to associate with all other fonts of the script system.
In most cases your application does not have to account for associated fonts; glyphs from the associated font are substituted automatically when you draw text that contains Roman characters. However, keep in mind that font measurements (such as the results of the GetFontInfo and FontMetrics procedures) always account for the width and height characteristics of both the current font and the associated font. This can sometimes cause unexpected results, such as a line height that is greater than the current font's expected line height. The GetFontInfo procedure is described in the chapter "QuickDraw Text" in this book; font measurement and the FontMetrics procedure are further described in the chapter "Font Manager" in this book.

There are several other issues to keep in mind related to Roman characters and Roman fonts:

Other Font Issues

In general, when drawing text, you set the font characteristics before you make a call, and the script management system makes sure that the font you specify is used. However, there are some issues and complications to keep in mind:


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996