![]() |
WidthTable |
Header: Fonts.h |
struct WidthTable { Fixed tabData[256]; Handle tabFont; SInt32 sExtra; SInt32 style; SInt16 fID; SInt16 fSize; SInt16 face; SInt16 device; Point inNumer; Point inDenom; SInt16 aFID; Handle fHand; Boolean usedFam; UInt8 aFace; SInt16 vOutput; SInt16 hOutput; SInt16 vFactor; SInt16 hFactor; SInt16 aSize; SInt16 tabSize; }; typedef WidthTable WidthTablePtr;
The widths for the glyphs in the font, in standard 32-bit fixed-point format. If a glyph is missing in the font, its entry contains the width of the missing-character glyph.
A handle to the font resource used to build this table.
The average number of pixels by which QuickDraw widens each space in a line of text.
The average number of pixels by which QuickDraw widens a line of text after applying a style.
The font family ID of the font represented by this table. This is the ID that was used in the request to build the table. It may be different from the ID of the font family that was used, which is indicated by the aFID field.
The point size that was originally requested for the font represented by this table. The actual size used is specified in the aSize field.
The font style that was originally requested for the font represented by this table. The actual style used is specified in the aFace field.
The device ID of the device on which these widths may be used.
The numerators of the vertical and horizontal scaling factors. The numer field is of type Point and contains two integers: the first is the numerator of the ratio for vertical scaling and the second is the numerator of the ratio for horizontal scaling.
The denominators of the vertical and horizontal scaling factors. The denom field is of type Point and contains two integers: the first is the denominator of the ratio for vertical scaling and the second is the denominator of the ratio for horizontal scaling.
The font family ID of the font family actually used to build this table. If the Font Manager could not find the font requested, this value may be different from the value of the fID field.
The handle to the font family resource used to build this table.
Set to TRUE if the fixed-point family glyph widths were used rather than integer glyph widths.
The font style of the font whose widths are contained in this table.
The factor by which glyphs are to be expanded vertically in the current graphics port. This is a 16-bit fixed-point number, with the integer part in the high-order byte and a fractional part in the low-order byte.
The factor by which glyphs are to be expanded horizontally in the current graphics port. This is a 16-bit fixed-point number, with the integer part in the high-order byte and a fractional part in the low-order byte.
The factor by which widths of the chosen font, after a style has been applied, have been increased vertically in the current graphics port. This is a 16-bit fixed-point number, with the integer part in the high-order byte and a fractional part in the low-order byte. The value of the vFactor field is not used by the Font Manager.
The factor by which widths of the chosen font, after a style has been applied, have been increased horizontally in the current graphics port. This is a 16-bit fixed-point number, with the integer part in the high-order byte and a fractional part in the low-order byte.
The size of the font actually used to build this table. Both the point size and the font used to build this table may be different from the requested point size and font. If font scaling is disabled, the Font Manager may use a size different from the size requested and add more or less space to approximate the appearance of the font requested.
The total size of the global width table.
The global width table structure, of data type WidthTable, contains the widths of all the glyphs of one font. The font family, point size, and style of this font are specified in this table. Your application should use the widths found in the global width table for placement of glyphs and words both on the screen and on the printed page. You can use the FontMetrics function to get a handle to the global width table. However, you should not assume that the table is the same size as shown in the structure declaration; it may be larger because of some private system-specific information that is attached to it.
Multiplying the values of the hOutput and vOutput fields by the values of the hFactor and vFactor fields, respectively, gives the font scaling. (Because the value of the vFactor field is ignored, the Font Manager multiplies the value of the vOutput field by 1.) The product of the value of the hOutput field and an entry in the global width table is the scaled width for that glyph.
The Font Manager gathers data for the global width table from one of three data structures:
Your application should obtain glyph widths either from the global width table or from the QuickDraw function MeasureText. The MeasureText function works only with text to be displayed on the screen, not with text to be printed. You can get the individual widths of glyphs of an outline font using the OutlineMetrics function. The FontMetrics function returns only the width of the largest glyph in a font contained in a bitmapped font resource.
Do not use the values from the global width table if your application is running on a computer on which non-Roman script systems are installed. You can check to see if a non-Roman script system is present by calling the GetScriptManagerVariable function with a selector of smEnabled; if the function returns a value greater than 0, at least one non-Roman script system is present and you need to call MeasureText to measure text that is displayed on the screen. Measuring text from a non-Roman script system for printing is handled by the printer driver.
For more information about the MeasureText function, see the documentation on QuickDraw Text. See also the FontMetrics and OutlineMetrics functions.
© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)