|
Mac OS 9
|
Quickdraw Text Interfaces. More...
Go to the source code of this file.
Data Structures | |
| struct | FontInfo |
Macros | |
| #define | NewStyleRunDirectionUPP(userRoutine) |
| #define | DisposeStyleRunDirectionUPP(userUPP) DisposeRoutineDescriptor(userUPP) |
| #define | InvokeStyleRunDirectionUPP(styleRunIndex, dirParam, userUPP) |
| #define | NewStyleRunDirectionProc(userRoutine) NewStyleRunDirectionUPP(userRoutine) |
| #define | CallStyleRunDirectionProc(userRoutine, styleRunIndex, dirParam) InvokeStyleRunDirectionUPP(styleRunIndex, dirParam, userRoutine) |
Typedefs | |
| typedef short | JustStyleCode |
| typedef short | TruncCode |
| typedef SInt8 | StyledLineBreakCode |
| typedef struct FontInfo | FontInfo |
| typedef short | FormatOrder[1] |
| typedef FormatOrder * | FormatOrderPtr |
| typedef void * | dirParam |
Enumerations | |
| enum | { leftCaret = 0 , rightCaret = -1 , kHilite = 1 } |
| enum | { smLeftCaret = 0 , smRightCaret = -1 , smHilite = 1 } |
| enum | { onlyStyleRun = 0 , leftStyleRun = 1 , rightStyleRun = 2 , middleStyleRun = 3 , smOnlyStyleRun = 0 , smLeftStyleRun = 1 , smRightStyleRun = 2 , smMiddleStyleRun = 3 } |
| enum | { truncEnd = 0 , truncMiddle = 0x4000 , smTruncEnd = 0 , smTruncMiddle = 0x4000 } |
| enum | { notTruncated = 0 , truncated = 1 , truncErr = -1 , smNotTruncated = 0 , smTruncated = 1 , smTruncErr = -1 } |
| enum | { smBreakWord = 0 , smBreakChar = 1 , smBreakOverflow = 2 } |
| enum | { tfAntiAlias = 1 << 0 , tfUnicode = 1 << 1 } |
| enum | { uppStyleRunDirectionProcInfo = 0x00000390 } |
Functions | |
| OSStatus | StandardGlyphs (void *dataStream, ByteCount size) |
| typedef | CALLBACK_API (Boolean, StyleRunDirectionProcPtr)(short styleRunIndex |
| typedef | STACK_UPP_TYPE (StyleRunDirectionProcPtr) StyleRunDirectionUPP |
| StyleRunDirectionUPP | NewStyleRunDirectionUPP (StyleRunDirectionProcPtr userRoutine) |
| void | DisposeStyleRunDirectionUPP (StyleRunDirectionUPP userUPP) |
| Boolean | InvokeStyleRunDirectionUPP (short styleRunIndex, void *dirParam, StyleRunDirectionUPP userUPP) |
| short | Pixel2Char (Ptr textBuf, short textLen, short slop, short pixelWidth, Boolean *leadingEdge) |
| short | Char2Pixel (Ptr textBuf, short textLen, short slop, short offset, short direction) |
| short | PixelToChar (Ptr textBuf, long textLength, Fixed slop, Fixed pixelWidth, Boolean *leadingEdge, Fixed *widthRemaining, JustStyleCode styleRunPosition, Point numer, Point denom) |
| short | CharToPixel (Ptr textBuf, long textLength, Fixed slop, long offset, short direction, JustStyleCode styleRunPosition, Point numer, Point denom) |
| void | DrawJustified (Ptr textPtr, long textLength, Fixed slop, JustStyleCode styleRunPosition, Point numer, Point denom) |
| void | MeasureJustified (Ptr textPtr, long textLength, Fixed slop, Ptr charLocs, JustStyleCode styleRunPosition, Point numer, Point denom) |
| Fixed | PortionLine (Ptr textPtr, long textLen, JustStyleCode styleRunPosition, Point numer, Point denom) |
| void | HiliteText (Ptr textPtr, short textLength, short firstOffset, short secondOffset, OffsetTable offsets) |
| void | DrawJust (Ptr textPtr, short textLength, short slop) |
| void | MeasureJust (Ptr textPtr, short textLength, short slop, Ptr charLocs) |
| Fixed | PortionText (Ptr textPtr, long textLength) |
| Determine how to distribute the slop value for a line. More... | |
| long | VisibleLength (Ptr textPtr, long textLength) |
| void | GetFormatOrder (FormatOrderPtr ordering, short firstFormat, short lastFormat, Boolean lineRight, StyleRunDirectionUPP rlDirProc, Ptr dirParam) |
| void | TextFont (short font) |
| Select font for subsequent text drawing. More... | |
| TextFace (bold|italic) | |
| Select a style for subsequent text drawing. More... | |
| TextFace (thePort->txFace|bold) | |
| TextFace (thePort->txFace &~bold) | |
| TextFace (0) | |
| void | TextMode (short mode) |
| Set text-drawing transfer mode. More... | |
| void | TextSize (short size) |
| Set the point size for subsequent text drawing. More... | |
| void | SpaceExtra (Fixed extra) |
| Space out text for left/right justification. More... | |
| void | DrawChar (CharParameter ch) |
| void | DrawString (ConstStr255Param s) |
| void | MacDrawText (const void *textBuf, short firstByte, short byteCount) |
| short | CharWidth (CharParameter ch) |
| short | StringWidth (ConstStr255Param s) |
| short | TextWidth (const void *textBuf, short firstByte, short byteCount) |
| void | MeasureText (short count, const void *textAddr, void *charLocs) |
| void | GetFontInfo (FontInfo *info) |
| void | CharExtra (Fixed extra) |
| Space to widen all text characters, excluding space band. More... | |
| void | StdText (short count, const void *textAddr, Point numer, Point denom) |
| short | StdTxMeas (short byteCount, const void *textAddr, Point *numer, Point *denom, FontInfo *info) |
| StyledLineBreakCode | StyledLineBreak (Ptr textPtr, long textLen, long textStart, long textEnd, long flags, Fixed *textWidth, long *textOffset) |
| short | TruncString (short width, Str255 theString, TruncCode truncWhere) |
| short | TruncText (short width, Ptr textPtr, short *length, TruncCode truncWhere) |
| void | drawstring (const char *s) |
| short | stringwidth (const char *s) |
| void | stdtext (short count, const void *textAddr, const Point *numer, const Point *denom) |
Variables | |
| The condense and extend variations change the spacing between characters to an arbitrary value set by the Font Manager Another way to compress expand text is to call SetFScaleDisable and use a smaller or larger font You may use SpaceExtra for spacing | control |
| e | g |
| e as an aid in displaying right justified text</pre > *par | Copyright |
Quickdraw Text Interfaces.
For bug reports, consult the following page on the World Wide Web:
http://developer.apple.com/bugreporter/
| #define InvokeStyleRunDirectionUPP | ( | styleRunIndex, | |
| dirParam, | |||
| userUPP | |||
| ) |
| #define NewStyleRunDirectionProc | ( | userRoutine | ) | NewStyleRunDirectionUPP(userRoutine) |
support for pre-Carbon UPP routines: New...Proc and Call...Proc
| #define NewStyleRunDirectionUPP | ( | userRoutine | ) |
pascal 1_byte Func(2_bytes, 4_bytes)
| typedef short JustStyleCode |
type for styleRunPosition parameter in PixelToChar etc.
| typedef short TruncCode |
Type for truncWhere parameter in TruncString, TruncText
| anonymous enum |
| anonymous enum |
| anonymous enum |
| anonymous enum |
| anonymous enum |
| anonymous enum |
| typedef CALLBACK_API | ( | Boolean | , |
| StyleRunDirectionProcPtr | |||
| ) |
FormatStatus was moved to TextUtils.i OffsetTable moved to IntlResources.i
| short Char2Pixel | ( | Ptr | textBuf, |
| short | textLen, | ||
| short | slop, | ||
| short | offset, | ||
| short | direction | ||
| ) |
| void CharExtra | ( | Fixed | extra | ) |
Space to widen all text characters, excluding space band.
CharExtra specifies how much additional width to give all characters . extrais a Fixed value, specifying the average number of pixels and fractional pixels to be added to each non-space character
none
This modifies the charExtra field of the current CGrafPort structure. The initial value of this field is 0, but both positive and negative number can be used. This is a cGrafPort-specific procedure and has no effect when used in conjunction with an old-style grafPort.
| short CharToPixel | ( | Ptr | textBuf, |
| long | textLength, | ||
| Fixed | slop, | ||
| long | offset, | ||
| short | direction, | ||
| JustStyleCode | styleRunPosition, | ||
| Point | numer, | ||
| Point | denom | ||
| ) |
| short CharWidth | ( | CharParameter | ch | ) |
| void DisposeStyleRunDirectionUPP | ( | StyleRunDirectionUPP | userUPP | ) |
| void DrawChar | ( | CharParameter | ch | ) |
| void DrawJust | ( | Ptr | textPtr, |
| short | textLength, | ||
| short | slop | ||
| ) |
| void DrawJustified | ( | Ptr | textPtr, |
| long | textLength, | ||
| Fixed | slop, | ||
| JustStyleCode | styleRunPosition, | ||
| Point | numer, | ||
| Point | denom | ||
| ) |
| void drawstring | ( | const char * | s | ) |
| void DrawString | ( | ConstStr255Param | s | ) |
| void GetFontInfo | ( | FontInfo * | info | ) |
| void GetFormatOrder | ( | FormatOrderPtr | ordering, |
| short | firstFormat, | ||
| short | lastFormat, | ||
| Boolean | lineRight, | ||
| StyleRunDirectionUPP | rlDirProc, | ||
| Ptr | dirParam | ||
| ) |
| void HiliteText | ( | Ptr | textPtr, |
| short | textLength, | ||
| short | firstOffset, | ||
| short | secondOffset, | ||
| OffsetTable | offsets | ||
| ) |
| Boolean InvokeStyleRunDirectionUPP | ( | short | styleRunIndex, |
| void * | dirParam, | ||
| StyleRunDirectionUPP | userUPP | ||
| ) |
| void MacDrawText | ( | const void * | textBuf, |
| short | firstByte, | ||
| short | byteCount | ||
| ) |
[Mac]DrawText()
| void MeasureJust | ( | Ptr | textPtr, |
| short | textLength, | ||
| short | slop, | ||
| Ptr | charLocs | ||
| ) |
| void MeasureJustified | ( | Ptr | textPtr, |
| long | textLength, | ||
| Fixed | slop, | ||
| Ptr | charLocs, | ||
| JustStyleCode | styleRunPosition, | ||
| Point | numer, | ||
| Point | denom | ||
| ) |
| void MeasureText | ( | short | count, |
| const void * | textAddr, | ||
| void * | charLocs | ||
| ) |
| StyleRunDirectionUPP NewStyleRunDirectionUPP | ( | StyleRunDirectionProcPtr | userRoutine | ) |
| short Pixel2Char | ( | Ptr | textBuf, |
| short | textLen, | ||
| short | slop, | ||
| short | pixelWidth, | ||
| Boolean * | leadingEdge | ||
| ) |
CALL_NOT_IN_CARBON Pixel2Char()
| short PixelToChar | ( | Ptr | textBuf, |
| long | textLength, | ||
| Fixed | slop, | ||
| Fixed | pixelWidth, | ||
| Boolean * | leadingEdge, | ||
| Fixed * | widthRemaining, | ||
| JustStyleCode | styleRunPosition, | ||
| Point | numer, | ||
| Point | denom | ||
| ) |
CALL_NOT_IN_CARBON PixelToChar()
| Fixed PortionLine | ( | Ptr | textPtr, |
| long | textLen, | ||
| JustStyleCode | styleRunPosition, | ||
| Point | numer, | ||
| Point | denom | ||
| ) |
| Fixed PortionText | ( | Ptr | textPtr, |
| long | textLength | ||
| ) |
Determine how to distribute the slop value for a line.
| textPtr | a pointer to the text to be justified The PortionText procedure indicates the correct proportion of justification to be allocated to given text when compared to other text; used to determine how to distribute the slop of a line among the style runs on the line |
| void SpaceExtra | ( | Fixed | extra | ) |
Space out text for left/right justification.
SpaceExtra tells the Font Manager how much additional space to add when displaying the space character (ASCII 0x20). It can be useful in fully-justifying text. extraSpace is a 4-byte Fixed value, specifying the average number of pixels and fractional pixels to be added to each space character (ASCII 0x32).
none
SpaceExtra modifies the spExtra field of the current GrafPort structure. The initial value of this field is 0. To justify a given text string to a specific line width: 1Use StringWidth to get the unadjusted size of the string. 2Subtract the returned value from the width between the margins; the difference is the amount of adjustment needed. 3Count the number of spaces in the line. 4Use FixRatio to find the ratio between the results of steps 2 and 3. 5Call SpaceExtra , specifying the ratio returned from step 4. 6Position the pen ( MoveTo ) and draw the text ( DrawString ).
| OSStatus StandardGlyphs | ( | void * | dataStream, |
| ByteCount | size | ||
| ) |
new CGrafPort bottleneck ("newProc2") function, used in Unicode Text drawing StandardGlyphs()
CALL_NOT_IN_CARBON stdtext()
| short StdTxMeas | ( | short | byteCount, |
| const void * | textAddr, | ||
| Point * | numer, | ||
| Point * | denom, | ||
| FontInfo * | info | ||
| ) |
| short stringwidth | ( | const char * | s | ) |
| short StringWidth | ( | ConstStr255Param | s | ) |
| StyledLineBreakCode StyledLineBreak | ( | Ptr | textPtr, |
| long | textLen, | ||
| long | textStart, | ||
| long | textEnd, | ||
| long | flags, | ||
| Fixed * | textWidth, | ||
| long * | textOffset | ||
| ) |
| TextFace | ( | bold| | italic | ) |
Select a style for subsequent text drawing.
TextFace selects the test-style variation(s) (bold, italic, underline, etc.) for the current GrafPort . newStyle is an integer value (declared as an enum with a typedef of Style). A value 0 indicates a "plain" unmodified version of the current font. You can use bit-manipulation operations to combine any of the following styles using the constants defined in Quickdraw.h: bold1increased width on vertical strokes italic2slanted toward the right underline 4underscored, with breaks on descending letters outline 8outlined shadow 16Shadowed (outlined, heavier on right bottom) condense 32less space between characters extend64more space between characters
none
TextFace modifies the txFace field of the current GrafPort . It is initially set to 0 (plain text). The variation you select affects all subsequent text drawing and text measuring. You can read the current style setting by accessing the txFace field of the current GrafPort : curStyle = thePort -> txFace; Here are some examples of usage: TextFace ( bold ); /* set to bold
| void TextFont | ( | short | font | ) |
Select font for subsequent text drawing.
TextFont sets the txFont field of the current GrafPort . Subsequent text drawing will use the specified font. fontNois a font number. The following Standard Fonts are available as system-defined constants: systemFont 0System default font; "Chicago" applFont 1default application font; initially "Geneva" newYork 2 geneva3 monaco 4 venice5 london6 athens7 sanFran 8 toronto 9 cairo 11 losAngeles 12 times20These are all helvetica 21 designed for courier 22 use on the symbol 23 LaserWriter mobile 24 See Standard Fonts for a graphic depiction of these fonts. Use GetFNum if you know the font's name, but not its number.
none
Be sure to call InitFonts (once, early in the program, after InitGraf and before InitWindows ). This ensures that the Font Manager is properly initialized for text drawing. The initial value for txFont is 0, specifying the system font, Chicago. You can read the current value from the GrafPort structure: curFont = thePort->txFont; The appearance of the text is also affected by the txFace, txSize, and txMode fields of the current GrafPort . Refer to TextFace , TextMode , and TextSize .
| void TextMode | ( | short | mode | ) |
Set text-drawing transfer mode.
TextMode selects the bit-transfer mode to be used in subsequent text-drawing. Used for writing white characters on a black background, etc. newMode selects the transfer mode. It must be one of the " srcXxx" modes. Use one of the following constants, as defined in Quickdraw.h : srcCopy 0overwrite background entirely srcOr1overwrite where character is black srcXor 2invert where character is black srcBic3force white where character is black notSrcCopy 4invert character, then srcCopy notSrcOr 5invert character, then srcOr notSrcXor 6invert character, then srcXor notSrcBic 7invert character, then srcBic
none
TextMode changes the txMode field of the current GrafPort structure. See Transfer Modes for a graphical representation of the effects of the various modes. The default mode is srcOr, which causes characters to be drawn over the background, while allowing the background pattern to show through in the empty parts of each letter. The original Mac toolbox supported only srcOr, srcXor, and srcBic.
| void TextSize | ( | short | size | ) |
Set the point size for subsequent text drawing.
TextSize selects the size, in points, for subsequently-drawn text. newSize is the desired size, in typographical points. Values from 1 to 127 are allowed. A value of 0 specifies the system font size (12 points).
none
TextSize sets the txSize field of the current GrafPort structure. The initial value is 0, specifying the system font size (12-point). If the font used in subsequent text drawing is not available in size points, the Font Manager will use a font it does have, scaling it to the desired size. Such "scaled" fonts have a jagged look to them. See SetFScaleDisable for more information font scaling. You may use SetFScaleDisable to space text as if it were a different point size, while continuing to use a “real” (unscaled) font. To see if an unscaled version of a font exists as a system resource, use GetFNum to learn its font reference number, then call RealFont . A typographical point is approximately 1/72 of an inch; very nearly the size of a pixel on the Mac screen.
| short TextWidth | ( | const void * | textBuf, |
| short | firstByte, | ||
| short | byteCount | ||
| ) |
| short TruncString | ( | short | width, |
| Str255 | theString, | ||
| TruncCode | truncWhere | ||
| ) |
| short TruncText | ( | short | width, |
| Ptr | textPtr, | ||
| short * | length, | ||
| TruncCode | truncWhere | ||
| ) |
| long VisibleLength | ( | Ptr | textPtr, |
| long | textLength | ||
| ) |
CALL_NOT_IN_CARBON VisibleLength()