RealFont
RealFont
Check if a font-and-size combination exists short fontNum ; font number to check
short size ; font size to check (e.g., 12 for 12-pt)
returns Does this font size exist in this size?
RealFont lets you determine whether or not a specified size of a font exists. If it doesn't exist, draw operations using that font/size will be scaled.
fontNum is a valid font number (see GetFNum). Don't use applFont (1) here (see Notes).
size is a typo graphical point-size such as 12 (for 12-pt). Valid values
range from 1 to 127.
FALSE Either fontNum doesn't exist or it is not defined for size points. To satisfy operations with this font/size a
related font or size will be scaled.
TRUE The fontNum /size combination exists in a resource file. No scaling will be needed.
Notes: All character-drawing operations will succeed, regardless of
the specified font or size. If an exact match for the font and/or size cannot
be found, the Font Manager uses the following steps in satisfying the request:
1 It looks for a font size that's twice as large and scales it down.
2 It looks for a font size that's half the size and scales it up.
3 It looks for next larger size and scales it down.
4 It looks for next smaller size and scales it up.
5 If the font does not exist in any size, the application font is used
(scaled, if necessary, using the above steps).
6 If the application font does not exist, the system font is used.
When you have a choice, try to use font sizes that return TRUE; when unable to do that, try to use a font that exists in a size that is a whole
number multiple or divisor of the desired size.
when characters are drawn. Rather than transforming a font, a smaller
version is found and additional padding is added around each character.
When presenting a menu of font sizes, you may wish to use RealFont and show the menu items for non-scaled font sizes in outlined characters (see
Don't use fontNum = applFont (i.e., 1) since that is not a real font number.
To check valid sizes of the application font, read its true font number from
the global variable ApFontID (at 0x0984); e.g.:
. . . a 9-pt version of the application font exists . . .
}