Important: The information in this document is obsolete and should not be used for new development.
DrawString
TheDrawString
procedure draws the specified Pascal string at the pen location in the current graphics port (GrafPort
orCGrafPort
).
PROCEDURE DrawString (s: Str255);
s
- A Pascal string consisting of the text to be drawn.
DESCRIPTION
TheDrawString
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.
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
StringWidth
function to determine the length of the string before callingDrawString
.spExtra
orchExtra
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 abyteCount
greater than 255.