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: | | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

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.

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.)

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.