Mac OS 8.6 (original) (raw)
QuickDraw Text
| | QuickDraw Text is the part of the MacOS used for drawing and displaying textual information on the screen and other raster devices. Along with several performance improvements, the following changes have been implemented: | | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
- A variety of QuickDraw Text bug fixes related to drawing text at large font sizes (greater than 200 point) have been added. This allows drawing of antialiased text over 200 point.
DrawString
performance has been improved.- The size of the font table fragment cache has been changed to accommodate larger, more complex fonts. Normally, when the font table fragment cache is allocated, its size used to be determined by computation purely based on available physical RAM. This determination gave a default size of 144K cache for systems with up to 48MB of RAM, 216K for systems with up to 96MB of RAM, and 288K above that. While this works well for simple Latin fonts, there are some fonts that are so complex that they exceeded this cache size. There was no recourse in these cases; the font would not render correctly, because the entire metamorphosis table could not be loaded all at once. So the system now checks for the presence of an optional
'fcsz'
resource, 4 bytes long, which contains an override to the calculated limit described above. The value in this resource may be whatever is desired; however, there are two constraints. First, if the value in the resource is less than the calculated value, then the calculated value is used and the resource value is ignored. Second, the value in the resource is constrained to being no greater than 1/16th the size of physical RAM. If the resource value is greater than this, it will be reduced to exactly this value. - The new calls
SetAntialiasedTextEnabled
,IsAntiAliasedTextEnabled
,QDTextBounds
, andFetchFontInfo
have been added to InterfaceLib. These routines are documented below.
Compatibility Warning:
Developers linking against the routinesSetAntialiasedTextEnabled
,IsAntiAliasedTextEnabled
,QDTextBounds
, andFetchFontInfo
in InterfaceLib who would like to have their products run with previous versions of the system software should weak-link against these new symbols. Unless this is done, the Code Fragment Manager will refuse to launch applications using the new symbols when an older version of InterfaceLib is being used. Developers weak-linking against any of the new symbols in InterfaceLib should check to ensure that the routines they weak link against are defined before calling them.
- A new routine for retrieving the pixel dimensions of text that will be drawn on the screen have been added to QuickDraw Text. This routine can be called from PowerPC applications linking against the shared library
InterfaceLib
in the System file. The new routines are defined as follows:FetchFontInfo
OSErr FetchFontInfo(SInt16 fontID,
SInt16 fontSize,
SInt16 fontStyle,
fontID
is the font ID number for a font.fontSize
is the font size in pixels.fontStyle
contains the font style flags for the font.info
is a pointer to a font information record where the result will be stored.FetchFontInfo
returns the same information as GetFontInfo,
except, rather than gathering information about the font settings from the current GrafPort,
this information is provided as parameters to the routine. IfFetchFontInfo
returns an error, the fields in the FontInfo
record will be set to zero. (The error code returned is the value returned byFMSwapFont
.)
- A new routine for retrieving the pixel dimensions of text that will be drawn on the screen have been added to QuickDraw Text. This routine can be called from PowerPC applications linking against the shared library
InterfaceLib
in the System file. The new routines are defined as follows:QDTextBounds
void QDTextBounds(short byteCount,
const void* textAddr,
byteCount
is the number of bytes of text contained in the buffer located at the address contained in the value textAddr
.textAddr
points to byteCount
bytes of textual data.bounds
is a pointer to aRect
structure whose coordinates will be calculated by QDTextBounds
. On return, bounds will contain the bounding coordinates for the entire image (including parts of the image that may extend beyond the first and last pen positions after the text has been drawn) that will be drawn for the text (given the font settings in the currentGrafPort
). Note that the coordinates returned are relative to the current pen position (as if the pen were located at the origin). For example, in Listing 3, we use QDTextBounds
to draw a rectangle around the text's image. Notice how in this example the bounds returned by QDTextBounds
are offset using the current pen position, so that the text drawing and the rectangle drawing occur using the same coordinate system.
Listing 3. Using QDTextBounds
to discover where text will be drawn.
Rect bounds;
char *text = "sample text";
Point where;
SetPt(&where, 100, 100);
MoveTo(where.h, where.v);
PenSize(1,1);
QDTextBounds(text, strlen(text), &bounds);
OffsetRect(&bounds, where.h, where.v);
InsetRect(&bounds, -1, -1);
FrameRect(&bounds);
The leftmost edge of the text's image can either be to the right or the left of the pen position, and the rightmost edge of the text's image may be to the left or the right of the final pen position.
- A variety of bug fixes allowing ATM to behave correctly in the system.
- A number of bugs affecting the drawing and measurement of double-byte text were fixed.