home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / CIncludes / QuickdrawText.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-11  |  8.0 KB  |  211 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        QuickdrawText.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __QUICKDRAWTEXT__
  18. #define __QUICKDRAWTEXT__
  19.  
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. /*    #include <ConditionalMacros.h>                                */
  25.  
  26. #ifndef __MIXEDMODE__
  27. #include <MixedMode.h>
  28. #endif
  29.  
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33.  
  34. #if GENERATINGPOWERPC
  35. #pragma options align=mac68k
  36. #endif
  37.  
  38. #ifdef __CFM68K__
  39. #pragma lib_export on
  40. #endif
  41.  
  42.  
  43. enum {
  44. /* CharToPixel directions */
  45.     leftCaret                    = 0,                            /*Place caret for left block*/
  46.     rightCaret                    = -1,                            /*Place caret for right block*/
  47.     hilite                        = 1,                            /*Direction is SysDirection*/
  48.     smLeftCaret                    = 0,                            /*Place caret for left block - obsolete */
  49.     smRightCaret                = -1,                            /*Place caret for right block - obsolete */
  50.     smHilite                    = 1,                            /*Direction is TESysJust - obsolete */
  51. /*Constants for styleRunPosition argument in PortionLine, DrawJustified,
  52.  MeasureJustified, CharToPixel, and PixelToChar.*/
  53.     onlyStyleRun                = 0,                            /* This is the only style run on the line */
  54.     leftStyleRun                = 1,                            /* This is leftmost of multiple style runs on the line */
  55.     rightStyleRun                = 2,                            /* This is rightmost of multiple style runs on the line */
  56.     middleStyleRun                = 3,                            /* There are multiple style runs on the line and this 
  57.  is neither the leftmost nor the rightmost. */
  58.     smOnlyStyleRun                = 0,                            /* obsolete */
  59.     smLeftStyleRun                = 1,                            /* obsolete */
  60.     smRightStyleRun                = 2,                            /* obsolete */
  61.     smMiddleStyleRun            = 3                                /* obsolete */
  62. };
  63.  
  64. /* type for styleRunPosition parameter in PixelToChar etc. */
  65. typedef short JustStyleCode;
  66.  
  67. struct FontInfo {
  68.     short                            ascent;
  69.     short                            descent;
  70.     short                            widMax;
  71.     short                            leading;
  72. };
  73. typedef struct FontInfo FontInfo;
  74.  
  75. typedef short FormatOrder[1];
  76.  
  77. typedef FormatOrder *FormatOrderPtr;
  78.  
  79. typedef short FormatStatus;
  80.  
  81. struct OffPair {
  82.     short                            offFirst;
  83.     short                            offSecond;
  84. };
  85. typedef struct OffPair OffPair;
  86.  
  87. typedef OffPair OffsetTable[3];
  88.  
  89. typedef pascal Boolean (*StyleRunDirectionProcPtr)(short styleRunIndex, void *dirParam);
  90.  
  91. #if GENERATINGCFM
  92. typedef UniversalProcPtr StyleRunDirectionUPP;
  93. #else
  94. typedef StyleRunDirectionProcPtr StyleRunDirectionUPP;
  95. #endif
  96.  
  97. enum {
  98.     uppStyleRunDirectionProcInfo = kPascalStackBased
  99.          | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  100.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short)))
  101.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(void*)))
  102. };
  103.  
  104. #if GENERATINGCFM
  105. #define NewStyleRunDirectionProc(userRoutine)        \
  106.         (StyleRunDirectionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppStyleRunDirectionProcInfo, GetCurrentArchitecture())
  107. #else
  108. #define NewStyleRunDirectionProc(userRoutine)        \
  109.         ((StyleRunDirectionUPP) (userRoutine))
  110. #endif
  111.  
  112. #if GENERATINGCFM
  113. #define CallStyleRunDirectionProc(userRoutine, styleRunIndex, dirParam)        \
  114.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppStyleRunDirectionProcInfo, (styleRunIndex), (dirParam))
  115. #else
  116. #define CallStyleRunDirectionProc(userRoutine, styleRunIndex, dirParam)        \
  117.         (*(userRoutine))((styleRunIndex), (dirParam))
  118. #endif
  119.  
  120. extern pascal short Pixel2Char(Ptr textBuf, short textLen, short slop, short pixelWidth, Boolean *leadingEdge)
  121.  FOURWORDINLINE(0x2F3C, 0x820E, 0x0014, 0xA8B5);
  122. extern pascal short Char2Pixel(Ptr textBuf, short textLen, short slop, short offset, short direction)
  123.  FOURWORDINLINE(0x2F3C, 0x820C, 0x0016, 0xA8B5);
  124. extern pascal short PixelToChar(Ptr textBuf, long textLength, Fixed slop, Fixed pixelWidth, Boolean *leadingEdge, Fixed *widthRemaining, JustStyleCode styleRunPosition, Point numer, Point denom)
  125.  FOURWORDINLINE(0x2F3C, 0x8222, 0x002E, 0xA8B5);
  126. extern pascal short CharToPixel(Ptr textBuf, long textLength, Fixed slop, long offset, short direction, JustStyleCode styleRunPosition, Point numer, Point denom)
  127.  FOURWORDINLINE(0x2F3C, 0x821C, 0x0030, 0xA8B5);
  128. extern pascal void DrawJustified(Ptr textPtr, long textLength, Fixed slop, JustStyleCode styleRunPosition, Point numer, Point denom)
  129.  FOURWORDINLINE(0x2F3C, 0x8016, 0x0032, 0xA8B5);
  130. extern pascal void MeasureJustified(Ptr textPtr, long textLength, Fixed slop, Ptr charLocs, JustStyleCode styleRunPosition, Point numer, Point denom)
  131.  FOURWORDINLINE(0x2F3C, 0x801A, 0x0034, 0xA8B5);
  132. extern pascal Fixed PortionLine(Ptr textPtr, long textLen, JustStyleCode styleRunPosition, Point numer, Point denom)
  133.  FOURWORDINLINE(0x2F3C, 0x8412, 0x0036, 0xA8B5);
  134. extern pascal void HiliteText(Ptr textPtr, short textLength, short firstOffset, short secondOffset, OffsetTable offsets)
  135.  FOURWORDINLINE(0x2F3C, 0x800E, 0x001C, 0xA8B5);
  136. extern pascal void DrawJust(Ptr textPtr, short textLength, short slop)
  137.  FOURWORDINLINE(0x2F3C, 0x8008, 0x001E, 0xA8B5);
  138. extern pascal void MeasureJust(Ptr textPtr, short textLength, short slop, Ptr charLocs)
  139.  FOURWORDINLINE(0x2F3C, 0x800C, 0x0020, 0xA8B5);
  140. extern pascal Fixed PortionText(Ptr textPtr, long textLength)
  141.  FOURWORDINLINE(0x2F3C, 0x8408, 0x0024, 0xA8B5);
  142. extern pascal long VisibleLength(Ptr textPtr, long textLength)
  143.  FOURWORDINLINE(0x2F3C, 0x8408, 0x0028, 0xA8B5);
  144. extern pascal void GetFormatOrder(FormatOrderPtr ordering, short firstFormat, short lastFormat, Boolean lineRight, StyleRunDirectionUPP rlDirProc, Ptr dirParam)
  145.  FOURWORDINLINE(0x2F3C, 0x8012, 0xFFFC, 0xA8B5);
  146. extern pascal void TextFont(short font)
  147.  ONEWORDINLINE(0xA887);
  148. extern pascal void TextFace(short face)
  149.  ONEWORDINLINE(0xA888);
  150. extern pascal void TextMode(short mode)
  151.  ONEWORDINLINE(0xA889);
  152. extern pascal void TextSize(short size)
  153.  ONEWORDINLINE(0xA88A);
  154. extern pascal void SpaceExtra(Fixed extra)
  155.  ONEWORDINLINE(0xA88E);
  156. extern pascal void DrawChar(short ch)
  157.  ONEWORDINLINE(0xA883);
  158. extern pascal void DrawString(ConstStr255Param s)
  159.  ONEWORDINLINE(0xA884);
  160. extern pascal void DrawText(const void *textBuf, short firstByte, short byteCount)
  161.  ONEWORDINLINE(0xA885);
  162. extern pascal short CharWidth(short ch)
  163.  ONEWORDINLINE(0xA88D);
  164. extern pascal short StringWidth(ConstStr255Param s)
  165.  ONEWORDINLINE(0xA88C);
  166. extern pascal short TextWidth(const void *textBuf, short firstByte, short byteCount)
  167.  ONEWORDINLINE(0xA886);
  168. extern pascal void MeasureText(short count, const void *textAddr, void *charLocs)
  169.  ONEWORDINLINE(0xA837);
  170. extern pascal void GetFontInfo(FontInfo *info)
  171.  ONEWORDINLINE(0xA88B);
  172. extern pascal void CharExtra(Fixed extra)
  173.  ONEWORDINLINE(0xAA23);
  174. extern pascal void StdText(short count, const void *textAddr, Point numer, Point denom)
  175.  ONEWORDINLINE(0xA882);
  176. extern pascal short StdTxMeas(short byteCount, const void *textAddr, Point *numer, Point *denom, FontInfo *info)
  177.  ONEWORDINLINE(0xA8ED);
  178. #if CGLUESUPPORTED
  179. extern void drawstring(const char *s);
  180. extern short stringwidth(const char *s);
  181. extern void stdtext(short count, const void *textAddr, const Point *numer, const Point *denom);
  182. #endif
  183. #if OLDROUTINENAMES
  184. #define NPixel2Char(textBuf, textLen, slop, pixelWidth, leadingEdge, widthRemaining, styleRunPosition, numer, denom)  \
  185.     PixelToChar(textBuf, textLen, slop, pixelWidth, leadingEdge, widthRemaining,  \
  186.     styleRunPosition, numer, denom)
  187. #define NChar2Pixel(textBuf, textLen, slop, offset, direction, styleRunPosition, numer, denom)  \
  188.     CharToPixel(textBuf, textLen, slop, offset, direction, styleRunPosition,  \
  189.     numer, denom)
  190. #define NDrawJust(textPtr, textLength, slop, styleRunPosition, numer, denom)  \
  191.     DrawJustified(textPtr, textLength, slop, styleRunPosition, numer, denom)
  192. #define NMeasureJust(textPtr, textLength, slop, charLocs, styleRunPosition, numer, denom)  \
  193.     MeasureJustified(textPtr, textLength, slop, charLocs, styleRunPosition, numer, denom)
  194. #define NPortionText(textPtr, textLen, styleRunPosition, numer, denom)  \
  195.     PortionLine(textPtr, textLen, styleRunPosition, numer, denom)
  196. #endif
  197.  
  198. #ifdef __CFM68K__
  199. #pragma lib_export off
  200. #endif
  201.  
  202. #if GENERATINGPOWERPC
  203. #pragma options align=reset
  204. #endif
  205.  
  206. #ifdef __cplusplus
  207. }
  208. #endif
  209.  
  210. #endif /* __QUICKDRAWTEXT__ */
  211.