Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Text /
Chapter 3 - QuickDraw Text / QuickDraw Text Reference
Routines / Drawing Text


DrawString

The DrawString procedure draws the specified Pascal string at the pen location in the current graphics port (GrafPort or CGrafPort).

PROCEDURE DrawString (s: Str255);
s
A Pascal string consisting of the text to be drawn.
DESCRIPTION
The DrawString procedure draws the string with its left edge at the current pen location, extending right. The final position of the pen location, after the text is drawn, is to the right of the rightmost glyph in the string. QuickDraw does not do any formatting, such as handling of carriage returns or line feeds.

Note that you can use DrawString only for a Pascal string containing a single style run.

Drawing text visible on the screen
QuickDraw temporarily stores on the stack all of the text you ask it to draw, even if the text is to be clipped. When drawing large font sizes or complex style variations, draw only what is visible on the screen. You can determine the number of characters whose corresponding glyphs actually fit on the screen by calling the StringWidth function to determine the length of the string before calling DrawString.
If you specify values in the graphics port spExtra or chExtra fields to change the width of space or nonspace characters, DrawString takes these values into account.

SPECIAL CONSIDERATIONS
For right-to-left text, such as Hebrew or Arabic, QuickDraw draws the final (leftmost) glyph first, then moves to the right through all the glyphs, drawing the initial (rightmost) glyph last.

Note that you should not change the width of nonspace characters for 1-byte simple script systems with zero-width characters or 1-byte complex script systems. For more information, see "CharExtra" on page 3-72.

For contextual script systems, DrawString substitutes the proper ligatures, reversals, and compound characters as needed.

Note
Inside a picture definition, DrawString can't have a byteCount greater than 255.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996