home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / PInterfaces / QuickdrawText.p < prev    next >
Encoding:
Text File  |  1994-11-11  |  8.3 KB  |  255 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        QuickdrawText.p
  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. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT QuickdrawText;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __QUICKDRAWTEXT__}
  27. {$SETC __QUICKDRAWTEXT__ := 1}
  28.  
  29. {$I+}
  30. {$SETC QuickdrawTextIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33.  
  34. {$IFC UNDEFINED __TYPES__}
  35. {$I Types.p}
  36. {$ENDC}
  37. {    ConditionalMacros.p                                            }
  38.  
  39. {$IFC UNDEFINED __MIXEDMODE__}
  40. {$I MixedMode.p}
  41. {$ENDC}
  42.  
  43. {$PUSH}
  44. {$ALIGN MAC68K}
  45. {$LibExport+}
  46.  
  47. CONST
  48. { CharToPixel directions }
  49.     leftCaret                    = 0;                            {Place caret for left block}
  50.     rightCaret                    = -1;                            {Place caret for right block}
  51.     hilite                        = 1;                            {Direction is SysDirection}
  52.     smLeftCaret                    = 0;                            {Place caret for left block - obsolete }
  53.     smRightCaret                = -1;                            {Place caret for right block - obsolete }
  54.     smHilite                    = 1;                            {Direction is TESysJust - obsolete }
  55. {Constants for styleRunPosition argument in PortionLine, DrawJustified,
  56.  MeasureJustified, CharToPixel, and PixelToChar.}
  57.     onlyStyleRun                = 0;                            { This is the only style run on the line }
  58.     leftStyleRun                = 1;                            { This is leftmost of multiple style runs on the line }
  59.     rightStyleRun                = 2;                            { This is rightmost of multiple style runs on the line }
  60.     middleStyleRun                = 3;                            { There are multiple style runs on the line and this 
  61.  is neither the leftmost nor the rightmost. }
  62.     smOnlyStyleRun                = 0;                            { obsolete }
  63.     smLeftStyleRun                = 1;                            { obsolete }
  64.     smRightStyleRun                = 2;                            { obsolete }
  65.     smMiddleStyleRun            = 3;                            { obsolete }
  66.  
  67. { type for styleRunPosition parameter in PixelToChar etc. }
  68.     
  69. TYPE
  70.     JustStyleCode = INTEGER;
  71.  
  72.     FontInfo = RECORD
  73.         ascent:                    INTEGER;
  74.         descent:                INTEGER;
  75.         widMax:                    INTEGER;
  76.         leading:                INTEGER;
  77.     END;
  78.     FormatOrder = ARRAY [0..0] OF INTEGER;
  79.  
  80.     FormatOrderPtr = ^FormatOrder;
  81.  
  82.     FormatStatus = INTEGER;
  83.  
  84.     OffPair = RECORD
  85.         offFirst:                INTEGER;
  86.         offSecond:                INTEGER;
  87.     END;
  88.     OffsetTable = ARRAY [0..2] OF OffPair;
  89.  
  90.     StyleRunDirectionProcPtr = ProcPtr;  { FUNCTION StyleRunDirection(styleRunIndex: INTEGER; dirParam: UNIV Ptr): BOOLEAN; }
  91.     StyleRunDirectionUPP = UniversalProcPtr;
  92.  
  93. CONST
  94.     uppStyleRunDirectionProcInfo = $00000390; { FUNCTION (2 byte param, 4 byte param): 1 byte result; }
  95.  
  96. FUNCTION NewStyleRunDirectionProc(userRoutine: StyleRunDirectionProcPtr): StyleRunDirectionUPP;
  97.     {$IFC NOT GENERATINGCFM }
  98.     INLINE $2E9F;
  99.     {$ENDC}
  100.  
  101. FUNCTION CallStyleRunDirectionProc(styleRunIndex: INTEGER; dirParam: UNIV Ptr; userRoutine: StyleRunDirectionUPP): BOOLEAN;
  102.     {$IFC NOT GENERATINGCFM}
  103.     INLINE $205F, $4E90;
  104.     {$ENDC}
  105.  
  106. FUNCTION Pixel2Char(textBuf: Ptr; textLen: INTEGER; slop: INTEGER; pixelWidth: INTEGER; VAR leadingEdge: BOOLEAN): INTEGER;
  107.     {$IFC NOT GENERATINGCFM}
  108.     INLINE $2F3C, $820E, $0014, $A8B5;
  109.     {$ENDC}
  110. FUNCTION Char2Pixel(textBuf: Ptr; textLen: INTEGER; slop: INTEGER; offset: INTEGER; direction: INTEGER): INTEGER;
  111.     {$IFC NOT GENERATINGCFM}
  112.     INLINE $2F3C, $820C, $0016, $A8B5;
  113.     {$ENDC}
  114. FUNCTION PixelToChar(textBuf: Ptr; textLength: LONGINT; slop: Fixed; pixelWidth: Fixed; VAR leadingEdge: BOOLEAN; VAR widthRemaining: Fixed; styleRunPosition: JustStyleCode; numer: Point; denom: Point): INTEGER;
  115.     {$IFC NOT GENERATINGCFM}
  116.     INLINE $2F3C, $8222, $002E, $A8B5;
  117.     {$ENDC}
  118. FUNCTION CharToPixel(textBuf: Ptr; textLength: LONGINT; slop: Fixed; offset: LONGINT; direction: INTEGER; styleRunPosition: JustStyleCode; numer: Point; denom: Point): INTEGER;
  119.     {$IFC NOT GENERATINGCFM}
  120.     INLINE $2F3C, $821C, $0030, $A8B5;
  121.     {$ENDC}
  122. PROCEDURE DrawJustified(textPtr: Ptr; textLength: LONGINT; slop: Fixed; styleRunPosition: JustStyleCode; numer: Point; denom: Point);
  123.     {$IFC NOT GENERATINGCFM}
  124.     INLINE $2F3C, $8016, $0032, $A8B5;
  125.     {$ENDC}
  126. PROCEDURE MeasureJustified(textPtr: Ptr; textLength: LONGINT; slop: Fixed; charLocs: Ptr; styleRunPosition: JustStyleCode; numer: Point; denom: Point);
  127.     {$IFC NOT GENERATINGCFM}
  128.     INLINE $2F3C, $801A, $0034, $A8B5;
  129.     {$ENDC}
  130. FUNCTION PortionLine(textPtr: Ptr; textLen: LONGINT; styleRunPosition: JustStyleCode; numer: Point; denom: Point): Fixed;
  131.     {$IFC NOT GENERATINGCFM}
  132.     INLINE $2F3C, $8412, $0036, $A8B5;
  133.     {$ENDC}
  134. PROCEDURE HiliteText(textPtr: Ptr; textLength: INTEGER; firstOffset: INTEGER; secondOffset: INTEGER; VAR offsets: OffsetTable);
  135.     {$IFC NOT GENERATINGCFM}
  136.     INLINE $2F3C, $800E, $001C, $A8B5;
  137.     {$ENDC}
  138. PROCEDURE DrawJust(textPtr: Ptr; textLength: INTEGER; slop: INTEGER);
  139.     {$IFC NOT GENERATINGCFM}
  140.     INLINE $2F3C, $8008, $001E, $A8B5;
  141.     {$ENDC}
  142. PROCEDURE MeasureJust(textPtr: Ptr; textLength: INTEGER; slop: INTEGER; charLocs: Ptr);
  143.     {$IFC NOT GENERATINGCFM}
  144.     INLINE $2F3C, $800C, $0020, $A8B5;
  145.     {$ENDC}
  146. FUNCTION PortionText(textPtr: Ptr; textLength: LONGINT): Fixed;
  147.     {$IFC NOT GENERATINGCFM}
  148.     INLINE $2F3C, $8408, $0024, $A8B5;
  149.     {$ENDC}
  150. FUNCTION VisibleLength(textPtr: Ptr; textLength: LONGINT): LONGINT;
  151.     {$IFC NOT GENERATINGCFM}
  152.     INLINE $2F3C, $8408, $0028, $A8B5;
  153.     {$ENDC}
  154. PROCEDURE GetFormatOrder(ordering: FormatOrderPtr; firstFormat: INTEGER; lastFormat: INTEGER; lineRight: BOOLEAN; rlDirProc: StyleRunDirectionUPP; dirParam: Ptr);
  155.     {$IFC NOT GENERATINGCFM}
  156.     INLINE $2F3C, $8012, $FFFC, $A8B5;
  157.     {$ENDC}
  158. PROCEDURE TextFont(font: INTEGER);
  159.     {$IFC NOT GENERATINGCFM}
  160.     INLINE $A887;
  161.     {$ENDC}
  162. PROCEDURE TextFace(face: Style);
  163.     {$IFC NOT GENERATINGCFM}
  164.     INLINE $A888;
  165.     {$ENDC}
  166. PROCEDURE TextMode(mode: INTEGER);
  167.     {$IFC NOT GENERATINGCFM}
  168.     INLINE $A889;
  169.     {$ENDC}
  170. PROCEDURE TextSize(size: INTEGER);
  171.     {$IFC NOT GENERATINGCFM}
  172.     INLINE $A88A;
  173.     {$ENDC}
  174. PROCEDURE SpaceExtra(extra: Fixed);
  175.     {$IFC NOT GENERATINGCFM}
  176.     INLINE $A88E;
  177.     {$ENDC}
  178. PROCEDURE DrawChar(ch: CHAR);
  179.     {$IFC NOT GENERATINGCFM}
  180.     INLINE $A883;
  181.     {$ENDC}
  182. PROCEDURE DrawString(s: ConstStr255Param);
  183.     {$IFC NOT GENERATINGCFM}
  184.     INLINE $A884;
  185.     {$ENDC}
  186. PROCEDURE DrawText(textBuf: UNIV Ptr; firstByte: INTEGER; byteCount: INTEGER);
  187.     {$IFC NOT GENERATINGCFM}
  188.     INLINE $A885;
  189.     {$ENDC}
  190. FUNCTION CharWidth(ch: CHAR): INTEGER;
  191.     {$IFC NOT GENERATINGCFM}
  192.     INLINE $A88D;
  193.     {$ENDC}
  194. FUNCTION StringWidth(s: ConstStr255Param): INTEGER;
  195.     {$IFC NOT GENERATINGCFM}
  196.     INLINE $A88C;
  197.     {$ENDC}
  198. FUNCTION TextWidth(textBuf: UNIV Ptr; firstByte: INTEGER; byteCount: INTEGER): INTEGER;
  199.     {$IFC NOT GENERATINGCFM}
  200.     INLINE $A886;
  201.     {$ENDC}
  202. PROCEDURE MeasureText(count: INTEGER; textAddr: UNIV Ptr; charLocs: UNIV Ptr);
  203.     {$IFC NOT GENERATINGCFM}
  204.     INLINE $A837;
  205.     {$ENDC}
  206. PROCEDURE GetFontInfo(VAR info: FontInfo);
  207.     {$IFC NOT GENERATINGCFM}
  208.     INLINE $A88B;
  209.     {$ENDC}
  210. PROCEDURE CharExtra(extra: Fixed);
  211.     {$IFC NOT GENERATINGCFM}
  212.     INLINE $AA23;
  213.     {$ENDC}
  214. PROCEDURE StdText(count: INTEGER; textAddr: UNIV Ptr; numer: Point; denom: Point);
  215.     {$IFC NOT GENERATINGCFM}
  216.     INLINE $A882;
  217.     {$ENDC}
  218. FUNCTION StdTxMeas(byteCount: INTEGER; textAddr: UNIV Ptr; VAR numer: Point; VAR denom: Point; VAR info: FontInfo): INTEGER;
  219.     {$IFC NOT GENERATINGCFM}
  220.     INLINE $A8ED;
  221.     {$ENDC}
  222. {$IFC OLDROUTINENAMES }
  223. FUNCTION NPixel2Char(textBuf: Ptr; textLength: LONGINT; slop: Fixed; pixelWidth: Fixed; VAR leadingEdge: BOOLEAN; VAR widthRemaining: Fixed; styleRunPosition: JustStyleCode; numer: Point; denom: Point): INTEGER;
  224.     {$IFC NOT GENERATINGCFM}
  225.     INLINE $2F3C, $8222, $002E, $A8B5;
  226.     {$ENDC}
  227. FUNCTION NChar2Pixel(textBuf: Ptr; textLength: LONGINT; slop: Fixed; offset: LONGINT; direction: INTEGER; styleRunPosition: JustStyleCode; numer: Point; denom: Point): INTEGER;
  228.     {$IFC NOT GENERATINGCFM}
  229.     INLINE $2F3C, $821C, $0030, $A8B5;
  230.     {$ENDC}
  231. PROCEDURE NDrawJust(textPtr: Ptr; textLength: LONGINT; slop: Fixed; styleRunPosition: JustStyleCode; numer: Point; denom: Point);
  232.     {$IFC NOT GENERATINGCFM}
  233.     INLINE $2F3C, $8016, $0032, $A8B5;
  234.     {$ENDC}
  235. PROCEDURE NMeasureJust(textPtr: Ptr; textLength: LONGINT; slop: Fixed; charLocs: Ptr; styleRunPosition: JustStyleCode; numer: Point; denom: Point);
  236.     {$IFC NOT GENERATINGCFM}
  237.     INLINE $2F3C, $801A, $0034, $A8B5;
  238.     {$ENDC}
  239. FUNCTION NPortionText(textPtr: Ptr; textLen: LONGINT; styleRunPosition: JustStyleCode; numer: Point; denom: Point): Fixed;
  240.     {$IFC NOT GENERATINGCFM}
  241.     INLINE $2F3C, $8412, $0036, $A8B5;
  242.     {$ENDC}
  243. {$ENDC}
  244.  
  245. {$ALIGN RESET}
  246. {$POP}
  247.  
  248. {$SETC UsingIncludes := QuickdrawTextIncludes}
  249.  
  250. {$ENDC} {__QUICKDRAWTEXT__}
  251.  
  252. {$IFC NOT UsingIncludes}
  253.  END.
  254. {$ENDC}
  255.