Important: The information in this document is obsolete and should not be used for new development.
DrawString
TheDrawStringprocedure draws the specified Pascal string at the pen location in the current graphics port (GrafPortorCGrafPort).
PROCEDURE DrawString (s: Str255);
s- A Pascal string consisting of the text to be drawn.
DESCRIPTION
TheDrawStringprocedure 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
DrawStringonly for a Pascal string containing a single style run.
If you specify values in the graphics port
- 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
StringWidthfunction to determine the length of the string before callingDrawString.![]()
spExtraorchExtrafields to change the width of space or nonspace characters,DrawStringtakes 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,
DrawStringsubstitutes the proper ligatures, reversals, and compound characters as needed.
- Note
- Inside a picture definition,
DrawStringcan't have abyteCountgreater than 255.![]()