home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 January: Mac OS SDK / Dev.CD Jan 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / CIncludes / QuickdrawText.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  9.5 KB  |  315 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        QuickdrawText.h
  3.  
  4.      Contains:    Quickdraw Text Interfaces.
  5.  
  6.      Version:    Technology:    Mac OS 8
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1983-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __QUICKDRAWTEXT__
  18. #define __QUICKDRAWTEXT__
  19.  
  20. #ifndef __MACTYPES__
  21. #include <MacTypes.h>
  22. #endif
  23. #ifndef __MIXEDMODE__
  24. #include <MixedMode.h>
  25. #endif
  26.  
  27.  
  28.  
  29. #if PRAGMA_ONCE
  30. #pragma once
  31. #endif
  32.  
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36.  
  37. #if PRAGMA_IMPORT
  38. #pragma import on
  39. #endif
  40.  
  41. #if PRAGMA_STRUCT_ALIGN
  42.     #pragma options align=mac68k
  43. #elif PRAGMA_STRUCT_PACKPUSH
  44.     #pragma pack(push, 2)
  45. #elif PRAGMA_STRUCT_PACK
  46.     #pragma pack(2)
  47. #endif
  48.  
  49. /* new CGrafPort bottleneck ("newProc2") function, used in Unicode Text drawing */
  50. EXTERN_API_C( OSStatus )
  51. StandardGlyphs                    (void *                    dataStream,
  52.                                  ByteCount                 size);
  53.  
  54.  
  55.  
  56. enum {
  57.                                                                 /* CharToPixel directions */
  58.     leftCaret                    = 0,                            /*Place caret for left block*/
  59.     rightCaret                    = -1,                            /*Place caret for right block*/
  60.     kHilite                        = 1,                            /*Direction is SysDirection*/
  61.     smLeftCaret                    = 0,                            /*Place caret for left block - obsolete */
  62.     smRightCaret                = -1,                            /*Place caret for right block - obsolete */
  63.     smHilite                    = 1                                /*Direction is TESysJust - obsolete */
  64. };
  65.  
  66.  
  67. enum {
  68.                                                                 /*Constants for styleRunPosition argument in PortionLine, DrawJustified, MeasureJustified, CharToPixel, and PixelToChar.*/
  69.     onlyStyleRun                = 0,                            /* This is the only style run on the line */
  70.     leftStyleRun                = 1,                            /* This is leftmost of multiple style runs on the line */
  71.     rightStyleRun                = 2,                            /* This is rightmost of multiple style runs on the line */
  72.     middleStyleRun                = 3,                            /* There are multiple style runs on the line and this is neither the leftmost nor the rightmost. */
  73.     smOnlyStyleRun                = 0,                            /* obsolete */
  74.     smLeftStyleRun                = 1,                            /* obsolete */
  75.     smRightStyleRun                = 2,                            /* obsolete */
  76.     smMiddleStyleRun            = 3                                /* obsolete */
  77. };
  78.  
  79. /* type for styleRunPosition parameter in PixelToChar etc. */
  80. typedef short                             JustStyleCode;
  81.  
  82. struct FontInfo {
  83.     short                             ascent;
  84.     short                             descent;
  85.     short                             widMax;
  86.     short                             leading;
  87. };
  88. typedef struct FontInfo                    FontInfo;
  89.  
  90. typedef short                             FormatOrder[1];
  91. typedef FormatOrder *                    FormatOrderPtr;
  92. /* FormatStatus was moved to TextUtils.i */
  93.  
  94. struct OffPair {
  95.     short                             offFirst;
  96.     short                             offSecond;
  97. };
  98. typedef struct OffPair                    OffPair;
  99.  
  100. typedef OffPair                         OffsetTable[3];
  101. typedef CALLBACK_API( Boolean , StyleRunDirectionProcPtr )(short styleRunIndex, void *dirParam);
  102. typedef STACK_UPP_TYPE(StyleRunDirectionProcPtr)                 StyleRunDirectionUPP;
  103. enum { uppStyleRunDirectionProcInfo = 0x00000390 };             /* pascal 1_byte Func(2_bytes, 4_bytes) */
  104. #define NewStyleRunDirectionProc(userRoutine)                     (StyleRunDirectionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppStyleRunDirectionProcInfo, GetCurrentArchitecture())
  105. #define CallStyleRunDirectionProc(userRoutine, styleRunIndex, dirParam)  CALL_TWO_PARAMETER_UPP((userRoutine), uppStyleRunDirectionProcInfo, (styleRunIndex), (dirParam))
  106. EXTERN_API( short )
  107. Pixel2Char                        (Ptr                     textBuf,
  108.                                  short                     textLen,
  109.                                  short                     slop,
  110.                                  short                     pixelWidth,
  111.                                  Boolean *                leadingEdge)                        FOURWORDINLINE(0x2F3C, 0x820E, 0x0014, 0xA8B5);
  112.  
  113. EXTERN_API( short )
  114. Char2Pixel                        (Ptr                     textBuf,
  115.                                  short                     textLen,
  116.                                  short                     slop,
  117.                                  short                     offset,
  118.                                  short                     direction)                            FOURWORDINLINE(0x2F3C, 0x820C, 0x0016, 0xA8B5);
  119.  
  120. EXTERN_API( short )
  121. PixelToChar                        (Ptr                     textBuf,
  122.                                  long                     textLength,
  123.                                  Fixed                     slop,
  124.                                  Fixed                     pixelWidth,
  125.                                  Boolean *                leadingEdge,
  126.                                  Fixed *                widthRemaining,
  127.                                  JustStyleCode             styleRunPosition,
  128.                                  Point                     numer,
  129.                                  Point                     denom)                                FOURWORDINLINE(0x2F3C, 0x8222, 0x002E, 0xA8B5);
  130.  
  131. EXTERN_API( short )
  132. CharToPixel                        (Ptr                     textBuf,
  133.                                  long                     textLength,
  134.                                  Fixed                     slop,
  135.                                  long                     offset,
  136.                                  short                     direction,
  137.                                  JustStyleCode             styleRunPosition,
  138.                                  Point                     numer,
  139.                                  Point                     denom)                                FOURWORDINLINE(0x2F3C, 0x821C, 0x0030, 0xA8B5);
  140.  
  141. EXTERN_API( void )
  142. DrawJustified                    (Ptr                     textPtr,
  143.                                  long                     textLength,
  144.                                  Fixed                     slop,
  145.                                  JustStyleCode             styleRunPosition,
  146.                                  Point                     numer,
  147.                                  Point                     denom)                                FOURWORDINLINE(0x2F3C, 0x8016, 0x0032, 0xA8B5);
  148.  
  149. EXTERN_API( void )
  150. MeasureJustified                (Ptr                     textPtr,
  151.                                  long                     textLength,
  152.                                  Fixed                     slop,
  153.                                  Ptr                     charLocs,
  154.                                  JustStyleCode             styleRunPosition,
  155.                                  Point                     numer,
  156.                                  Point                     denom)                                FOURWORDINLINE(0x2F3C, 0x801A, 0x0034, 0xA8B5);
  157.  
  158. EXTERN_API( Fixed )
  159. PortionLine                        (Ptr                     textPtr,
  160.                                  long                     textLen,
  161.                                  JustStyleCode             styleRunPosition,
  162.                                  Point                     numer,
  163.                                  Point                     denom)                                FOURWORDINLINE(0x2F3C, 0x8412, 0x0036, 0xA8B5);
  164.  
  165. EXTERN_API( void )
  166. HiliteText                        (Ptr                     textPtr,
  167.                                  short                     textLength,
  168.                                  short                     firstOffset,
  169.                                  short                     secondOffset,
  170.                                  OffsetTable             offsets)                            FOURWORDINLINE(0x2F3C, 0x800E, 0x001C, 0xA8B5);
  171.  
  172. EXTERN_API( void )
  173. DrawJust                        (Ptr                     textPtr,
  174.                                  short                     textLength,
  175.                                  short                     slop)                                FOURWORDINLINE(0x2F3C, 0x8008, 0x001E, 0xA8B5);
  176.  
  177. EXTERN_API( void )
  178. MeasureJust                        (Ptr                     textPtr,
  179.                                  short                     textLength,
  180.                                  short                     slop,
  181.                                  Ptr                     charLocs)                            FOURWORDINLINE(0x2F3C, 0x800C, 0x0020, 0xA8B5);
  182.  
  183. EXTERN_API( Fixed )
  184. PortionText                        (Ptr                     textPtr,
  185.                                  long                     textLength)                            FOURWORDINLINE(0x2F3C, 0x8408, 0x0024, 0xA8B5);
  186.  
  187. EXTERN_API( long )
  188. VisibleLength                    (Ptr                     textPtr,
  189.                                  long                     textLength)                            FOURWORDINLINE(0x2F3C, 0x8408, 0x0028, 0xA8B5);
  190.  
  191. EXTERN_API( void )
  192. GetFormatOrder                    (FormatOrderPtr         ordering,
  193.                                  short                     firstFormat,
  194.                                  short                     lastFormat,
  195.                                  Boolean                 lineRight,
  196.                                  StyleRunDirectionUPP     rlDirProc,
  197.                                  Ptr                     dirParam)                            FOURWORDINLINE(0x2F3C, 0x8012, 0xFFFC, 0xA8B5);
  198.  
  199.  
  200.  
  201. EXTERN_API( void )
  202. TextFont                        (short                     font)                                ONEWORDINLINE(0xA887);
  203.  
  204. EXTERN_API( void )
  205. TextFace                        (StyleParameter         face)                                ONEWORDINLINE(0xA888);
  206.  
  207. EXTERN_API( void )
  208. TextMode                        (short                     mode)                                ONEWORDINLINE(0xA889);
  209.  
  210. EXTERN_API( void )
  211. TextSize                        (short                     size)                                ONEWORDINLINE(0xA88A);
  212.  
  213. EXTERN_API( void )
  214. SpaceExtra                        (Fixed                     extra)                                ONEWORDINLINE(0xA88E);
  215.  
  216. EXTERN_API( void )
  217. DrawChar                        (CharParameter             ch)                                    ONEWORDINLINE(0xA883);
  218.  
  219. EXTERN_API( void )
  220. DrawString                        (ConstStr255Param         s)                                    ONEWORDINLINE(0xA884);
  221.  
  222. #if TARGET_OS_MAC
  223.     #define MacDrawText DrawText
  224. #endif
  225. EXTERN_API( void )
  226. MacDrawText                        (const void *            textBuf,
  227.                                  short                     firstByte,
  228.                                  short                     byteCount)                            ONEWORDINLINE(0xA885);
  229.  
  230. EXTERN_API( short )
  231. CharWidth                        (CharParameter             ch)                                    ONEWORDINLINE(0xA88D);
  232.  
  233. EXTERN_API( short )
  234. StringWidth                        (ConstStr255Param         s)                                    ONEWORDINLINE(0xA88C);
  235.  
  236. EXTERN_API( short )
  237. TextWidth                        (const void *            textBuf,
  238.                                  short                     firstByte,
  239.                                  short                     byteCount)                            ONEWORDINLINE(0xA886);
  240.  
  241. EXTERN_API( void )
  242. MeasureText                        (short                     count,
  243.                                  const void *            textAddr,
  244.                                  void *                    charLocs)                            ONEWORDINLINE(0xA837);
  245.  
  246. EXTERN_API( void )
  247. GetFontInfo                        (FontInfo *                info)                                ONEWORDINLINE(0xA88B);
  248.  
  249. EXTERN_API( void )
  250. CharExtra                        (Fixed                     extra)                                ONEWORDINLINE(0xAA23);
  251.  
  252. EXTERN_API( void )
  253. StdText                            (short                     count,
  254.                                  const void *            textAddr,
  255.                                  Point                     numer,
  256.                                  Point                     denom)                                ONEWORDINLINE(0xA882);
  257.  
  258. EXTERN_API( short )
  259. StdTxMeas                        (short                     byteCount,
  260.                                  const void *            textAddr,
  261.                                  Point *                numer,
  262.                                  Point *                denom,
  263.                                  FontInfo *                info)                                ONEWORDINLINE(0xA8ED);
  264.  
  265.  
  266. #if CGLUESUPPORTED
  267. EXTERN_API_C( void )
  268. drawstring                        (const char *            s);
  269.  
  270. EXTERN_API_C( short )
  271. stringwidth                        (const char *            s);
  272.  
  273. EXTERN_API_C( void )
  274. stdtext                            (short                     count,
  275.                                  const void *            textAddr,
  276.                                  const Point *            numer,
  277.                                  const Point *            denom);
  278.  
  279. #endif  /* CGLUESUPPORTED */
  280.  
  281. #if OLDROUTINENAMES
  282. #define NPixel2Char(textBuf, textLen, slop, pixelWidth, leadingEdge, widthRemaining, styleRunPosition, numer, denom) \
  283.     PixelToChar(textBuf, textLen, slop, pixelWidth, leadingEdge, widthRemaining, styleRunPosition, numer, denom) 
  284. #define NChar2Pixel(textBuf, textLen, slop, offset, direction, styleRunPosition, numer, denom) \
  285.     CharToPixel(textBuf, textLen, slop, offset, direction, styleRunPosition, numer, denom)
  286. #define NDrawJust(textPtr, textLength, slop, styleRunPosition, numer, denom) \
  287.     DrawJustified(textPtr, textLength, slop, styleRunPosition, numer, denom)
  288. #define NMeasureJust(textPtr, textLength, slop, charLocs, styleRunPosition, numer, denom) \
  289.     MeasureJustified(textPtr, textLength, slop, charLocs, styleRunPosition, numer, denom)
  290. #define NPortionText(textPtr, textLen, styleRunPosition, numer, denom)\
  291.     PortionLine(textPtr, textLen, styleRunPosition, numer, denom)
  292. #endif  /* OLDROUTINENAMES */
  293.  
  294.  
  295. #if PRAGMA_STRUCT_ALIGN
  296.     #pragma options align=reset
  297. #elif PRAGMA_STRUCT_PACKPUSH
  298.     #pragma pack(pop)
  299. #elif PRAGMA_STRUCT_PACK
  300.     #pragma pack()
  301. #endif
  302.  
  303. #ifdef PRAGMA_IMPORT_OFF
  304. #pragma import off
  305. #elif PRAGMA_IMPORT
  306. #pragma import reset
  307. #endif
  308.  
  309. #ifdef __cplusplus
  310. }
  311. #endif
  312.  
  313. #endif /* __QUICKDRAWTEXT__ */
  314.  
  315.