Carbon


FMSwapFont

Header: Fonts.h Carbon status: Supported

Returns a handle to a font and information about that font. This function is used by QuickDraw and other parts of the system software to access font handles.

FMOutPtr FMSwapFont (
    const FMInput *inRec
);
Parameter descriptions
inRec

A pointer to a font input structure, which contains the font family ID, the style requested, scaling factors, and other information. The inRec parameter specifies the characteristics of the font that is requested. QuickDraw fills in the fields of the CurFmInput global variable and passes that structure in this parameter.

function result

A handle to a font and information about that font. The font output structure contains a handle to a font resource that fulfills the font request, along with information about the font, such as the ascent, descent, and leading measurements.

The pointer to the font output structure returned as the value of FMSwapFont points to a structure allocated in low memory by the Font Manager. The same structure is reused for each call made to FMSwapFont. Do not free the memory allocated for this structure.

DISCUSSION

The FMSwapFont function takes a font request and returns a pointer to a font output structure. FMSwapFont is the heart of the Font Manager: it does all of the hard work of preparing font data for text measuring and text drawing.

QuickDraw calls the FMSwapFont function every time a QuickDraw text function is used. If you want to call the FMSwapFont function in order to get a handle to a font resource or information about that font, you must build a font input structure and then use the pointer returned to access the resulting font output structure.

You cannot assume that the font resource pointed to by the fontHandle field of the font output structure returned by this function is of any particular type, such as 'NFNT' or 'sfnt'. If you need to access specific information in the font resource, call the Resource Manager function GetResInfo with the handle returned in the font output structure to determine the font resource type.

For descriptions of the structures themselves, see FMOutput and FMInput.

AVAILABILITY

Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.


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