#include <QD/QD.h>

//work

/*TextMode

Sets the transfer mode for drawing text in the current graphics port. (Deprecated in Mac OS X v10.4. Use ATSUI or Quartz instead.)

void TextMode (
   short mode
);
Parameters
mode

The transfer mode to be used to draw the text. 
Discussion

The TextMode function sets the transfer mode in the graphics port txMode field. The transfer mode determines the interplay between what an application is drawing (the source) and what already exists on the display device (the destination), resulting in the text display.

There are two basic kinds of modes: pattern (pat) and source (src). Source is the kind that you use for drawing text. There are four basic Boolean operations: Copy, Or, Xor, and Bic (bit clear), each of which has an inverse variant in which the source is inverted before the transfer, yielding eight operations in all. Original QuickDraw supports these eight transfer modes. Color QuickDraw enables your application to achieve color effects within those basic transfer modes, and offers an additional set of transfer modes that perform arithmetic operations on the RGB values of the source and destination pixels. Other transfer modes are grayishTextOr, transparent mode, and text mask mode.

To ensure future compatibility and benefit from any enhancements, always use this function to modify the txMode field, rather than directly change the field value. 
Availability
Available in Mac OS X v10.0 and later.
Deprecated in Mac OS X v10.4.
Declared In
QuickdrawText.h*/

void TextMode (
   short mode
){};

/*DrawString

Draws the text of the specified Pascal string at the pen location in the current graphics port (GrafPort or CGrafPort). (Deprecated in Mac OS X v10.4. Use ATSUI or Quartz instead.)

void DrawString (
   ConstStr255Param s
);
Parameters
s

A Pascal string consisting of the text to be drawn. 
Discussion

The DrawString function 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.

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.

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.

For contextual script systems, DrawString substitutes the proper ligatures, reversals, and compound characters as needed. Inside a picture definition, DrawString can’t have a byteCount greater than 255. 
Availability
Available in Mac OS X v10.0 and later.
Deprecated in Mac OS X v10.4.
Declared In
QuickdrawText.h*/
void DrawString (
   ConstStr255Param s
){};

/*TextSize

Sets the font size for text drawn in the current graphics port to the specified number of points. (Deprecated in Mac OS X v10.4. Use ATSUI or Quartz instead.)

void TextSize (
   short size
);
Parameters
size

The font size in points (0 to 32,767). The initial setting is 0, which specifies that the font size of the system font (normally 12 points) is to be used. 
Discussion

The TextSize function sets the font size in the text size (txSize) field of the current graphics port structure. To ensure future compatibility and benefit from any enhancements, always use this function to modify the txSize field, rather than directly change the field value. 
Availability
Available in Mac OS X v10.0 and later.
Deprecated in Mac OS X v10.4.
Declared In
QuickdrawText.h*/
void TextSize (
   short size
){};


/*TextFont

Sets the font of the current graphics port in which the text is to be rendered. (Deprecated in Mac OS X v10.4. Use ATSUI or Quartz instead.)

void TextFont (
   short font
);
Parameters
font

The font family ID. The initial font family ID is 0, which represents the system font. The value that you specify for this field is either an integer or a constant. The range of integers currently defined are from 0 to 32767. Currently, negative font family IDs are not supported, although they may be supported in the future.

The system font and application font have different font IDs and sizes on various script systems. However, the special designators 0 and 1 always map to the system font and the application font for the system script, respectively.

Discussion

The TextFont function sets the value of the graphics port text font (txFont) field. To ensure future compatibility and benefit from any enhancements, always use this function to modify the txFont field, rather than directly change the field value. 
Availability
Available in Mac OS X v10.0 and later.
Deprecated in Mac OS X v10.4.
Declared In
QuickdrawText.h*/
void TextFont (
   short font
){};


/*StringWidth

Returns the length, in pixels, of the specified text string. (Deprecated in Mac OS X v10.4. Use ATSUI instead.)

short StringWidth (
   ConstStr255Param s
);
Parameters
s

A Pascal string containing the text to be measured.
Return Value

The length, in pixels, of the specified text string. 
Discussion

You should not call StringWidth to measure scaled text. Although StringWidth takes into account the graphics port structure settings, it does not accept scaling parameters, and therefore cannot determine the correct text width result for text to be drawn using scaling factor parameters.

If you specify values in the graphics port spExtra or chExtra fields to change the width of space or nonspace characters, StringWidth takes these values into account.

Because this function measures text in the font, style, and size of the current graphics port, you need to call it once for each individual style run in any line of text that contains multiple style runs.

The StringWidth function works with all script systems. 
Availability
Available in Mac OS X v10.0 and later.
Deprecated in Mac OS X v10.4.
Declared In
QuickdrawText.h*/
short StringWidth (
   ConstStr255Param s
){};

/*DrawChar

Draws the glyph for a single 1-byte character at the current pen location in the current graphics port. (Deprecated in Mac OS X v10.4. Use ATSUI or Quartz instead.)

void DrawChar (
   CharParameter ch
);
Parameters
ch

The character code whose glyph is to be drawn. 
Discussion

The DrawChar function draws a single character’s glyph and then advances the pen by the width of the glyph. If the glyph isn’t in the font, the font’s missing symbol is drawn. 

If you’re drawing more than one character, it’s faster to make one DrawString or DrawText call rather than a series of DrawChar calls.

Because it takes a single-byte value as the ch parameter, DrawChar works only for 1-byte script systems. If you want to draw the glyph of a single character in a 2-byte script, call either DrawText, DrawString, or DrawJustified.

A series of calls to DrawChar in a 1-byte complex script system can give incorrect results because a text string is not always a simple concatenation of a series of characters. In a contextual script, two different glyphs may be used to represent a single character in its contextual form and alone. To draw a sequence of text in a 1-byte complex script system, use DrawText, DrawString, or DrawJustified instead.

For 1-byte complex scripts, you can use DrawChar for special purposes, such as to include the isolated glyph of a character in a book’s index, for example, to show a single glyph as it exists apart from contextual transformations. 
Availability
Available in Mac OS X v10.0 and later.
Deprecated in Mac OS X v10.4.
Declared In
QuickdrawText.h*/
void DrawChar (
   CharParameter ch
){};


/*TextFace

Sets the style of the font in which the text is to be drawn in the current graphics port. (Deprecated in Mac OS X v10.4. Use ATSUI or Quartz instead.)

void TextFace (
   StyleParameter face
);
Parameters
face

The style for text to be drawn in the current graphics port.
Discussion

The TextFace function sets the value for the style of the font in the text face ( txFace) field of the current graphics port. The Style data type allows you to specify a set of one or more of the following predefined constants: bold, italic, underline, outline, shadow, condense, and extend. In Pascal, you specify the constants within square brackets. For example:TextFace([bold]);
{bold}TextFace([bold,italic]);
{bold and italic}


The style is set to the empty set ( []) by default, which specifies plain.

To ensure future compatibility and benefit from any enhancements, always use this function to modify the txFace field, rather than directly change the field value. 
Availability
Available in Mac OS X v10.0 and later.
Deprecated in Mac OS X v10.4.
Declared In
QuickdrawText.h*/

void TextFace (
   StyleParameter face
){};


/*TruncString

Ensures that a Pascal string fits into the specified pixel width, by truncating the string as necessary. This function makes use of the current script and font. (Deprecated in Mac OS X v10.4. Use CFString instead.)

short TruncString (
   short width,
   Str255 theString,
   TruncCode truncWhere
);
Parameters
width

The number of pixels in which the string must be displayed in the current script and font. 
theString

The Pascal string to be displayed. On output, contains a version of the string that has been truncated (if necessary) to fit in the number of pixels specified by width.
truncWhere

A constant that indicates where the string should be truncated. If you supply the truncEnd value, characters are truncated off the end of the string. If you supply the truncMiddle value, characters are truncated from the middle of the string; this is useful when displaying pathnames. 

See “Truncation Positions” for a list of the constants you can supply.
Discussion

The TruncString function ensures that a Pascal string fits into the pixel width specified by the width parameter by modifying the string, if necessary, through truncation. TruncString uses the font script to determine how to perform truncation. If truncation occurs, TruncString inserts a truncation indicator, which is the ellipsis (…) in the Roman script system. You can specify which token to use for indicating truncation as the tokenEllipsis token type in the untoken table of a tokens ('itl4') resource.

To determine the width of a string in the current font and script, use the QuickDraw StringWidth function. 
Special Considerations

TruncString may move memory; your application should not call this function at interrupt time.
Availability
Available in Mac OS X v10.0 and later.
Deprecated in Mac OS X v10.4.
Declared In
QuickdrawText.h*/
short TruncString (
   short width,
   Str255 theString,
   TruncCode truncWhere
){};


/*CharWidth

Returns the width (horizontel extension), in pixels, of the specified character. (Deprecated in Mac OS X v10.4. Use ATSUI instead.)

short CharWidth (
   CharParameter ch
);
Parameters
ch

The character whose width is to be measured. 
Return Value

The width (horizontel extension), in pixels, of the specified character. 
Discussion

The CharWidth function includes the effects of the stylistic variations for the text set in the current graphics port. If you change any of these attributes after determining the glyph width but before actually drawing it, the predetermined width may not be correct. For a space character, CharWidth also includes the effect of SpaceExtra. For a nonspace character, CharWidth includes the effect of CharExtra.

Because it takes a single-byte value as the ch parameter, CharWidth works only for 1-byte simple script systems.

A series of calls to CharWidth in a contextual 1-byte font may give incorrect results, because the width of a text segment may be different from the sum of its individual character widths. In that case, to measure a line of text you should call TextWidth.

Do not use the CharWidth function for 2-byte script systems. If you want to measure the width of a single glyph in a 2-byte font, you should use TextWidth. 
Availability
Available in Mac OS X v10.0 and later.
Deprecated in Mac OS X v10.4.
Declared In
QuickdrawText.h*/
short CharWidth (
   CharParameter ch
){};

/*GetFontInfo

Returns information about the current graphics port’s font, taking into account the style and size in which the glyphs are to be drawn. (Deprecated in Mac OS X v10.4. Use ATSUI instead.)

void GetFontInfo (
   FontInfo * info
);
Parameters
info

Pointer to a font information structure that contains the font measurement information, in integer values. 
Discussion

The GetFontInfo function returns the ascent, descent, leading, and width of the largest glyph of the font in the text font, size, and style specified in the current graphics port. If the script system specified by the current graphics port txFont field has an associated font, as do Hebrew and Arabic, GetFontInfo returns combined information based on both fonts. This is to accommodate text written in the Roman script when the primary script system is non-Roman. However, even if all of the text is written in a non-Roman script, if there is an associated font, GetFontInfo always bases its information on the combined fonts. You can determine the line height, in pixels, by adding the values of the ascent, descent, and leading fields.

The GetFontInfo function is similar to the Font Manager’s FontMetrics function, except that the GetFontInfo function returns integer values. See FontInfo for a description of the structure and its fields. 
Availability
Available in Mac OS X v10.0 and later.
Deprecated in Mac OS X v10.4.
Declared In
QuickdrawText.h*/

void GetFontInfo (
   FontInfo * info
){};



/*DrawText

Draws the specified text at the current pen location in the current graphics port. (Deprecated. Use ATSUI or Quartz instead.)

void DrawText (
   const void * textBuf,
   short firstByte,
   short byteCount
);
Parameters
textBuf

A pointer to a buffer containing the text to be drawn. 
firstByte

An offset from the start of the text buffer (textBuf) to the first byte of the text to be drawn. 
byteCount

The number of bytes of text to be drawn. Inside a picture definition, DrawText cannot have a byteCount greater than 255.

For 2-byte script systems, note that byteCount is the number of bytes to be drawn, not the number of glyphs. Because 2-byte script systems also include characters consisting of only 1 byte, do not simply multiply the number of characters by 2 to determine this value; you must determine and specify the correct number of bytes.
Discussion

The DrawText function draws the text with the leftmost glyph at the current pen location, extending right. After QuickDraw draws the text, it sets the pen location to the right of the rightmost glyph.

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 a range of text, it’s best to draw only what is visible on the screen. If an entire text string does not fit on a line, truncate the text at a word boundary. If possible, avoid truncating within a style run. You can determine the number of characters whose glyphs actually fit on the screen by calling the TextWidth function before calling DrawText.

If you specify values in the graphics port spExtra and chExtra fields to change the width of nonspace and space characters, both TextWidth and DrawText take these values into account.

For 1-byte complex script systems, DrawText substitutes the proper ligatures, reversals, and compound characters as needed.

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 characters, drawing the initial (rightmost) glyph last. 
Declared In
QuickdrawText.h*/

void DrawText (
   const void * textBuf,
   short firstByte,
   short byteCount
){};


/*TextWidth

Returns the length, in pixels, of the specified text. (Deprecated in Mac OS X v10.4. Use ATSUI instead.)

short TextWidth (
   const void * textBuf,
   short firstByte,
   short byteCount
);
Parameters
textBuf

A pointer to a buffer that contains the text to be measured. 
firstByte

An offset from textBuf to the first byte of the text to be measured. 
byteCount

The number of bytes of text to be measured.
Return Value

The length, in pixels, of the specified text. 
Discussion

You can use TextWidth to measure the screen pixel width of any text segment that has uniform character attributes. You can use it to measure the style runs in a line of text, whether you intend to draw the line using DrawText or DrawJustified. The TextWidth function takes into account the character attributes set in the graphics port. If you change any of these attributes after determining the text width but before actually drawing the text, the predetermined width may not be correct. For a space character, TextWidth also includes the effect of SpaceExtra. For a nonspace character, TextWidth includes the effect of CharExtra.

Because this function measures text in the font, style, and size of the current graphics port, you need to call it once for each individual style run in any line of text that contains multiple style runs.

The TextWidth function works with text in all script systems because the script management system modifies the function if necessary to give the proper results.

To draw justified lines of text that include multiple style runs, you calculate the amount of extra pixels, or slop, that remains to be distributed throughout the line. This process entails measuring the screen pixel width of each style run on the line: you can use TextWidth for this purpose.

For 1-byte complex script systems, TextWidth calculates the widths of any ligatures, reversals, and compound characters that need to be drawn.

Note that byteCount is the number of bytes to be measured, not the number of characters. Because 2-byte script systems also include characters consisting of only one byte, you should not simply multiply the number of characters by 2 to determine this value; you must determine and specify the correct number of bytes. 
Availability
Available in Mac OS X v10.0 and later.
Deprecated in Mac OS X v10.4.
Declared In
QuickdrawText.h*/
short TextWidth (
   const void * textBuf,
   short firstByte,
   short byteCount
){};




