Important: The information in this document is obsolete and should not be used for new development.
How QuickDraw Requests a Font
When your application calls a QuickDraw routine that does anything with text (for example,DrawText
orTextFont
), QuickDraw gets information from the Font Manager about the font specified in the current graphics port record and the individual glyphs of that font. The Font Manager performs any necessary calculations and returns the requested information to QuickDraw.QuickDraw makes its request for font information using a font input record (of data type
FMInput
), which is described on page 4-36. This record contains the font family ID, the size, the style, and the scaling factors of the font request.QuickDraw makes a font request by filling in a font input record and calling the
FMSwapFont
function. If your application needs to make a font request in the same way that QuickDraw does, you can callFMSwapFont
. Since responding to a font request can be a lot of work,FMSwapFont
has been optimized to return as quickly as possible if the request is for the same font as was most recently requested. Building the global width table, which is described in "How the Font Manager Calculates Glyph Widths" on page 4-22, is one of the more time-consuming tasks in this process, which is why the Font Manager maintains a cache of up to 12 width tables.The Font Manager looks for the font family resource of the requested font and from that determines information about which font it can use to meet the request. If necessary, the Font Manager calls the Resource Manager to read the font.
For certain types of devices, such as a screen or the ImageWriter printer, the Font Manager uses the font characterization table from the device driver to determine any additional information that QuickDraw may need. The font characterization table contains information about the dots per vertical inch and dots per horizontal inch for that device, along with information about the different styles that the device can produce. Non-QuickDraw devices, such as the LaserWriter printer, return an error when the Font Manager requests their font characterization table.
- WARNING
- Never assume that the font resource is a bitmapped font resource or outline font resource. If you need to read information from the resource, you should first call the Resource Manager
GetResInfo
procedure with the handle to the resource. TheGetResInfo
procedure is described in the Resource Manager chapter in Inside Macintosh: More Macintosh Toolbox.