Mac OS 9
QuickdrawText.h
Go to the documentation of this file.
1 
19 #ifndef __QUICKDRAWTEXT__
20 #define __QUICKDRAWTEXT__
21 
22 #ifndef __MACTYPES__
23 #include <MacTypes.h>
24 #endif
25 
26 #ifndef __MIXEDMODE__
27 #include <MixedMode.h>
28 #endif
29 
30 #ifndef __INTLRESOURCES__
31 #include <IntlResources.h>
32 #endif
33 
34 #if PRAGMA_ONCE
35 #pragma once
36 #endif
37 
38 #ifdef __cplusplus
39 extern "C"
40 {
41 #endif
42 
43 #if PRAGMA_IMPORT
44 #pragma import on
45 #endif
46 
47 #if PRAGMA_STRUCT_ALIGN
48 #pragma options align = mac68k
49 #elif PRAGMA_STRUCT_PACKPUSH
50 #pragma pack(push, 2)
51 #elif PRAGMA_STRUCT_PACK
52 #pragma pack(2)
53 #endif
54 
65  OSStatus
66  StandardGlyphs(void *dataStream, ByteCount size);
67 
68  enum
69  {
71  leftCaret = 0,
72  rightCaret = -1,
73  kHilite = 1
74  };
75 
76  enum
77  {
78  smLeftCaret = 0,
79  smRightCaret = -1,
80  smHilite = 1
81  };
82 
83  enum
84  {
95  smMiddleStyleRun = 3
96  };
97 
99  typedef short JustStyleCode;
101  typedef short TruncCode;
102  enum
103  {
105  truncEnd = 0,
106  truncMiddle = 0x4000,
108  smTruncMiddle = 0x4000
109  };
110 
111  enum
112  {
115  truncated = 1,
116  truncErr = -1,
119  smTruncErr = -1
120  };
121 
122  typedef SInt8 StyledLineBreakCode;
123  enum
124  {
125  smBreakWord = 0,
126  smBreakChar = 1,
127  smBreakOverflow = 2
128  };
129 
131  enum
132  {
134  tfAntiAlias = 1 << 0,
135  tfUnicode = 1 << 1
136  };
137 
138  struct FontInfo
139  {
140  short ascent;
141  short descent;
142  short widMax;
143  short leading;
144  };
145  typedef struct FontInfo FontInfo;
146 
147  typedef short FormatOrder[1];
148  typedef FormatOrder *FormatOrderPtr;
152  typedef CALLBACK_API(Boolean, StyleRunDirectionProcPtr)(short styleRunIndex,
153  void *dirParam);
154  typedef STACK_UPP_TYPE(StyleRunDirectionProcPtr) StyleRunDirectionUPP;
163  StyleRunDirectionUPP
164  NewStyleRunDirectionUPP(StyleRunDirectionProcPtr userRoutine);
165 #if !OPAQUE_UPP_TYPES
166  enum
167  {
168  uppStyleRunDirectionProcInfo = 0x00000390
169  };
170 #ifdef __cplusplus
171  inline StyleRunDirectionUPP
172  NewStyleRunDirectionUPP(StyleRunDirectionProcPtr userRoutine)
173  {
174  return (StyleRunDirectionUPP)NewRoutineDescriptor(
175  (ProcPtr)(userRoutine), uppStyleRunDirectionProcInfo,
176  GetCurrentArchitecture());
177  }
178 #else
179 #define NewStyleRunDirectionUPP(userRoutine) \
180  (StyleRunDirectionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), \
181  uppStyleRunDirectionProcInfo, \
182  GetCurrentArchitecture())
183 #endif
184 #endif
185 
194  void
195  DisposeStyleRunDirectionUPP(StyleRunDirectionUPP userUPP);
196 #if !OPAQUE_UPP_TYPES
197 #ifdef __cplusplus
198  inline void DisposeStyleRunDirectionUPP(StyleRunDirectionUPP userUPP)
199  {
200  DisposeRoutineDescriptor((UniversalProcPtr)userUPP);
201  }
202 #else
203 #define DisposeStyleRunDirectionUPP(userUPP) DisposeRoutineDescriptor(userUPP)
204 #endif
205 #endif
206 
215  Boolean
216  InvokeStyleRunDirectionUPP(short styleRunIndex, void *dirParam,
217  StyleRunDirectionUPP userUPP);
218 #if !OPAQUE_UPP_TYPES
219 #ifdef __cplusplus
220  inline Boolean InvokeStyleRunDirectionUPP(short styleRunIndex, void *dirParam,
221  StyleRunDirectionUPP userUPP)
222  {
223  return (Boolean)CALL_TWO_PARAMETER_UPP(userUPP, uppStyleRunDirectionProcInfo,
224  styleRunIndex, dirParam);
225  }
226 #else
227 #define InvokeStyleRunDirectionUPP(styleRunIndex, dirParam, userUPP) \
228  (Boolean) CALL_TWO_PARAMETER_UPP((userUPP), uppStyleRunDirectionProcInfo, \
229  (styleRunIndex), (dirParam))
230 #endif
231 #endif
232 
233 #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
235 #define NewStyleRunDirectionProc(userRoutine) \
236  NewStyleRunDirectionUPP(userRoutine)
237 #define CallStyleRunDirectionProc(userRoutine, styleRunIndex, dirParam) \
238  InvokeStyleRunDirectionUPP(styleRunIndex, dirParam, userRoutine)
239 #endif
241 #if CALL_NOT_IN_CARBON
250  short
251  Pixel2Char(Ptr textBuf, short textLen, short slop, short pixelWidth,
252  Boolean *leadingEdge);
253 
262  short
263  Char2Pixel(Ptr textBuf, short textLen, short slop, short offset,
264  short direction);
265 
266 #endif
276  short
277  PixelToChar(Ptr textBuf, long textLength, Fixed slop, Fixed pixelWidth,
278  Boolean *leadingEdge, Fixed *widthRemaining,
279  JustStyleCode styleRunPosition, Point numer, Point denom);
280 
289  short
290  CharToPixel(Ptr textBuf, long textLength, Fixed slop, long offset,
291  short direction, JustStyleCode styleRunPosition, Point numer,
292  Point denom);
293 
302  void
303  DrawJustified(Ptr textPtr, long textLength, Fixed slop,
304  JustStyleCode styleRunPosition, Point numer, Point denom);
305 
314  void
315  MeasureJustified(Ptr textPtr, long textLength, Fixed slop, Ptr charLocs,
316  JustStyleCode styleRunPosition, Point numer, Point denom);
317 
326  Fixed
327  PortionLine(Ptr textPtr, long textLen, JustStyleCode styleRunPosition,
328  Point numer, Point denom);
329 
338  void
339  HiliteText(Ptr textPtr, short textLength, short firstOffset, short secondOffset,
340  OffsetTable offsets);
341 
342 #if CALL_NOT_IN_CARBON
351  void
352  DrawJust(Ptr textPtr, short textLength, short slop);
353 
362  void
363  MeasureJust(Ptr textPtr, short textLength, short slop, Ptr charLocs);
364 
377  Fixed
378  PortionText(Ptr textPtr, long textLength);
379 
380 #endif
390  long
391  VisibleLength(Ptr textPtr, long textLength);
392 
401  void
402  GetFormatOrder(FormatOrderPtr ordering, short firstFormat, short lastFormat,
403  Boolean lineRight, StyleRunDirectionUPP rlDirProc, Ptr dirParam);
404 
449  void
450  TextFont(short font);
451 
479  TextFace(bold | italic); /* set to bold and italic */
480  TextFace(thePort->txFace | bold); /* add bolding */
481  TextFace(thePort->txFace & ~bold); /* remove bolding */
482  TextFace(0); /* set to plain text */
483 The "condense" and "extend" variations change the spacing between
484 characters to an arbitrary value set by the Font Manager. Another way to
485 compress expand text is to call SetFScaleDisable and use a smaller or
486 larger font. You may use SpaceExtra for spacing control;
487 e.g., as an aid in
488  displaying right -
489  justified text.</ pre>
490  * \copyright THINK Reference © 1991 -
491  1992 Symantec Corporation
492  * \non_carbon_cfm in InterfaceLib 7.1 and
493  later
494  * \carbon_lib in CarbonLib 1.0 and
495  later
496  * \mac_os_x in version 10.0 and
497  later
498  * /
499  void
500  TextFace(StyleParameter face);
501 
533 void TextMode(short mode);
534 
562 void TextSize(short size);
563 
591 void SpaceExtra(Fixed extra);
592 
601 void DrawChar(CharParameter ch);
602 
611 void DrawString(ConstStr255Param s);
612 
621 #if TARGET_OS_MAC
622 #define MacDrawText DrawText
623 #endif
624  void
625  MacDrawText(const void *textBuf, short firstByte, short byteCount);
626 
635  short
636  CharWidth(CharParameter ch);
637 
646  short
647  StringWidth(ConstStr255Param s);
648 
657  short
658  TextWidth(const void *textBuf, short firstByte, short byteCount);
659 
668  void
669  MeasureText(short count, const void *textAddr, void *charLocs);
670 
679  void
681 
701  void
702  CharExtra(Fixed extra);
703 
712  void
713  StdText(short count, const void *textAddr, Point numer, Point denom);
714 
723  short
724  StdTxMeas(short byteCount, const void *textAddr, Point *numer, Point *denom,
725  FontInfo *info);
726 
735  StyledLineBreakCode
736  StyledLineBreak(Ptr textPtr, long textLen, long textStart, long textEnd,
737  long flags, Fixed *textWidth, long *textOffset);
738 
747  short
748  TruncString(short width, Str255 theString, TruncCode truncWhere);
749 
758  short
759  TruncText(short width, Ptr textPtr, short *length, TruncCode truncWhere);
760 
761 #if CALL_NOT_IN_CARBON
770  void
771  drawstring(const char *s);
772 
781  short
782  stringwidth(const char *s);
783 
784 #endif
794  void
795  stdtext(short count, const void *textAddr, const Point *numer,
796  const Point *denom);
797 
798 #if OLDROUTINENAMES
799 #define NPixel2Char(textBuf, textLen, slop, pixelWidth, leadingEdge, \
800  widthRemaining, styleRunPosition, numer, denom) \
801  PixelToChar(textBuf, textLen, slop, pixelWidth, leadingEdge, widthRemaining, \
802  styleRunPosition, numer, denom)
803 #define NChar2Pixel(textBuf, textLen, slop, offset, direction, \
804  styleRunPosition, numer, denom) \
805  CharToPixel(textBuf, textLen, slop, offset, direction, styleRunPosition, \
806  numer, denom)
807 #define NDrawJust(textPtr, textLength, slop, styleRunPosition, numer, denom) \
808  DrawJustified(textPtr, textLength, slop, styleRunPosition, numer, denom)
809 #define NMeasureJust(textPtr, textLength, slop, charLocs, styleRunPosition, \
810  numer, denom) \
811  MeasureJustified(textPtr, textLength, slop, charLocs, styleRunPosition, \
812  numer, denom)
813 #define NPortionText(textPtr, textLen, styleRunPosition, numer, denom) \
814  PortionLine(textPtr, textLen, styleRunPosition, numer, denom)
815 #endif
817 #if PRAGMA_STRUCT_ALIGN
818 #pragma options align = reset
819 #elif PRAGMA_STRUCT_PACKPUSH
820 #pragma pack(pop)
821 #elif PRAGMA_STRUCT_PACK
822 #pragma pack()
823 #endif
824 
825 #ifdef PRAGMA_IMPORT_OFF
826 #pragma import off
827 #elif PRAGMA_IMPORT
828 #pragma import reset
829 #endif
830 
831 #ifdef __cplusplus
832 }
833 #endif
834 
835 #endif
836 * / endif
837  * /*/*/ * /*/*/
void SetFScaleDisable(Boolean fscaleDisable)
International Resource definitions.
Basic Macintosh data types.
long Fixed
Definition: MacTypes.h:153
unsigned char Boolean
Definition: MacTypes.h:318
Mixed Mode Manager Interfaces.
void DisposeRoutineDescriptor(UniversalProcPtr theUPP)
#define STACK_UPP_TYPE(name)
Definition: MixedMode.h:734
UniversalProcPtr NewRoutineDescriptor(ProcPtr theProc, ProcInfoType theProcInfo, ISAType theISA)
short Pixel2Char(Ptr textBuf, short textLen, short slop, short pixelWidth, Boolean *leadingEdge)
void MacDrawText(const void *textBuf, short firstByte, short byteCount)
short TruncText(short width, Ptr textPtr, short *length, TruncCode truncWhere)
TextFace(bold|italic)
Select a style for subsequent text drawing.
void drawstring(const char *s)
@ smOnlyStyleRun
Definition: QuickdrawText.h:92
@ smMiddleStyleRun
Definition: QuickdrawText.h:95
@ smRightStyleRun
Definition: QuickdrawText.h:94
@ onlyStyleRun
Definition: QuickdrawText.h:87
@ middleStyleRun
Definition: QuickdrawText.h:90
@ rightStyleRun
Definition: QuickdrawText.h:89
@ smLeftStyleRun
Definition: QuickdrawText.h:93
@ leftStyleRun
Definition: QuickdrawText.h:88
short StdTxMeas(short byteCount, const void *textAddr, Point *numer, Point *denom, FontInfo *info)
void DisposeStyleRunDirectionUPP(StyleRunDirectionUPP userUPP)
void DrawJustified(Ptr textPtr, long textLength, Fixed slop, JustStyleCode styleRunPosition, Point numer, Point denom)
short JustStyleCode
Definition: QuickdrawText.h:99
short PixelToChar(Ptr textBuf, long textLength, Fixed slop, Fixed pixelWidth, Boolean *leadingEdge, Fixed *widthRemaining, JustStyleCode styleRunPosition, Point numer, Point denom)
short TruncString(short width, Str255 theString, TruncCode truncWhere)
void MeasureText(short count, const void *textAddr, void *charLocs)
short TextWidth(const void *textBuf, short firstByte, short byteCount)
void TextMode(short mode)
Set text-drawing transfer mode.
void MeasureJust(Ptr textPtr, short textLength, short slop, Ptr charLocs)
void TextSize(short size)
Set the point size for subsequent text drawing.
#define NewStyleRunDirectionUPP(userRoutine)
Definition: QuickdrawText.h:179
short stringwidth(const char *s)
long VisibleLength(Ptr textPtr, long textLength)
Boolean InvokeStyleRunDirectionUPP(short styleRunIndex, void *dirParam, StyleRunDirectionUPP userUPP)
Fixed PortionText(Ptr textPtr, long textLength)
Determine how to distribute the slop value for a line.
void DrawChar(CharParameter ch)
void GetFontInfo(FontInfo *info)
StyledLineBreakCode StyledLineBreak(Ptr textPtr, long textLen, long textStart, long textEnd, long flags, Fixed *textWidth, long *textOffset)
@ tfAntiAlias
Definition: QuickdrawText.h:134
void CharExtra(Fixed extra)
Space to widen all text characters, excluding space band.
short Char2Pixel(Ptr textBuf, short textLen, short slop, short offset, short direction)
short CharToPixel(Ptr textBuf, long textLength, Fixed slop, long offset, short direction, JustStyleCode styleRunPosition, Point numer, Point denom)
void DrawJust(Ptr textPtr, short textLength, short slop)
void GetFormatOrder(FormatOrderPtr ordering, short firstFormat, short lastFormat, Boolean lineRight, StyleRunDirectionUPP rlDirProc, Ptr dirParam)
short TruncCode
Definition: QuickdrawText.h:101
@ smTruncEnd
Definition: QuickdrawText.h:107
@ truncEnd
Definition: QuickdrawText.h:105
@ truncMiddle
Definition: QuickdrawText.h:106
@ smTruncMiddle
Definition: QuickdrawText.h:108
short CharWidth(CharParameter ch)
void HiliteText(Ptr textPtr, short textLength, short firstOffset, short secondOffset, OffsetTable offsets)
void stdtext(short count, const void *textAddr, const Point *numer, const Point *denom)
void StdText(short count, const void *textAddr, Point numer, Point denom)
void SpaceExtra(Fixed extra)
Space out text for left/right justification.
void DrawString(ConstStr255Param s)
Fixed PortionLine(Ptr textPtr, long textLen, JustStyleCode styleRunPosition, Point numer, Point denom)
OSStatus StandardGlyphs(void *dataStream, ByteCount size)
@ smHilite
Definition: QuickdrawText.h:80
@ smRightCaret
Definition: QuickdrawText.h:79
void TextFont(short font)
Select font for subsequent text drawing.
short StringWidth(ConstStr255Param s)
void MeasureJustified(Ptr textPtr, long textLength, Fixed slop, Ptr charLocs, JustStyleCode styleRunPosition, Point numer, Point denom)
@ smNotTruncated
Definition: QuickdrawText.h:117
@ smTruncErr
Definition: QuickdrawText.h:119
@ notTruncated
Definition: QuickdrawText.h:114
@ truncErr
Definition: QuickdrawText.h:116
@ smTruncated
Definition: QuickdrawText.h:118
@ truncated
Definition: QuickdrawText.h:115
@ leftCaret
Definition: QuickdrawText.h:71
@ kHilite
Definition: QuickdrawText.h:73
@ rightCaret
Definition: QuickdrawText.h:72
typedef CALLBACK_API(Boolean, StyleRunDirectionProcPtr)(short styleRunIndex
Definition: QuickdrawText.h:139
Definition: MacTypes.h:520