ATSTypes.pas 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. {
  2. File: ATSTypes.p
  3. Contains: Public interfaces for Apple Type Services components.
  4. Version: Technology: Mac OS 9 / Carbon
  5. Release: Universal Interfaces 3.4.2
  6. Copyright: © 1997-2002 by Apple Computer, Inc., all rights reserved.
  7. Bugs?: For bug reports, consult the following page on
  8. the World Wide Web:
  9. http://www.freepascal.org/bugs.html
  10. }
  11. {
  12. Modified for use with Free Pascal
  13. Version 200
  14. Please report any bugs to <[email protected]>
  15. }
  16. {$mode macpas}
  17. {$packenum 1}
  18. {$macro on}
  19. {$inline on}
  20. {$CALLING MWPASCAL}
  21. unit ATSTypes;
  22. interface
  23. {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
  24. {$setc GAP_INTERFACES_VERSION := $0200}
  25. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  26. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  27. {$endc}
  28. {$ifc defined CPUPOWERPC and defined CPUI386}
  29. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  30. {$endc}
  31. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  32. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  33. {$endc}
  34. {$ifc not defined __ppc__ and defined CPUPOWERPC}
  35. {$setc __ppc__ := 1}
  36. {$elsec}
  37. {$setc __ppc__ := 0}
  38. {$endc}
  39. {$ifc not defined __i386__ and defined CPUI386}
  40. {$setc __i386__ := 1}
  41. {$elsec}
  42. {$setc __i386__ := 0}
  43. {$endc}
  44. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  45. {$error Conflicting definitions for __ppc__ and __i386__}
  46. {$endc}
  47. {$ifc defined __ppc__ and __ppc__}
  48. {$setc TARGET_CPU_PPC := TRUE}
  49. {$setc TARGET_CPU_X86 := FALSE}
  50. {$elifc defined __i386__ and __i386__}
  51. {$setc TARGET_CPU_PPC := FALSE}
  52. {$setc TARGET_CPU_X86 := TRUE}
  53. {$elsec}
  54. {$error Neither __ppc__ nor __i386__ is defined.}
  55. {$endc}
  56. {$setc TARGET_CPU_PPC_64 := FALSE}
  57. {$ifc defined FPC_BIG_ENDIAN}
  58. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  59. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  60. {$elifc defined FPC_LITTLE_ENDIAN}
  61. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  62. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  63. {$elsec}
  64. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  65. {$endc}
  66. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  67. {$setc CALL_NOT_IN_CARBON := FALSE}
  68. {$setc OLDROUTINENAMES := FALSE}
  69. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  70. {$setc OPAQUE_UPP_TYPES := TRUE}
  71. {$setc OTCARBONAPPLICATION := TRUE}
  72. {$setc OTKERNEL := FALSE}
  73. {$setc PM_USE_SESSION_APIS := TRUE}
  74. {$setc TARGET_API_MAC_CARBON := TRUE}
  75. {$setc TARGET_API_MAC_OS8 := FALSE}
  76. {$setc TARGET_API_MAC_OSX := TRUE}
  77. {$setc TARGET_CARBON := TRUE}
  78. {$setc TARGET_CPU_68K := FALSE}
  79. {$setc TARGET_CPU_MIPS := FALSE}
  80. {$setc TARGET_CPU_SPARC := FALSE}
  81. {$setc TARGET_OS_MAC := TRUE}
  82. {$setc TARGET_OS_UNIX := FALSE}
  83. {$setc TARGET_OS_WIN32 := FALSE}
  84. {$setc TARGET_RT_MAC_68881 := FALSE}
  85. {$setc TARGET_RT_MAC_CFM := FALSE}
  86. {$setc TARGET_RT_MAC_MACHO := TRUE}
  87. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  88. {$setc TYPE_BOOL := FALSE}
  89. {$setc TYPE_EXTENDED := FALSE}
  90. {$setc TYPE_LONGLONG := TRUE}
  91. uses MacTypes,Files,MixedMode;
  92. {$ALIGN MAC68K}
  93. type
  94. FMGeneration = UInt32;
  95. { The FMFontFamily reference represents a collection of fonts with the same design
  96. characteristics. It replaces the standard QuickDraw font identifer and may be used
  97. with all QuickDraw functions including GetFontName and TextFont. It cannot be used
  98. with the Resource Manager to access information from a FOND resource handle. A font
  99. reference does not imply a particular script system, nor is the character encoding
  100. of a font family determined by an arithmetic mapping of its value.
  101. }
  102. FMFontFamily = SInt16;
  103. FMFontStyle = SInt16;
  104. FMFontStylePtr = ^FMFontStyle; { when a VAR xx: FMFontStyle parameter can be nil, it is changed to xx: FMFontStylePtr }
  105. FMFontSize = SInt16;
  106. FMFontSizePtr = ^FMFontSize; { when a VAR xx: FMFontSize parameter can be nil, it is changed to xx: FMFontSizePtr }
  107. {
  108. The font family is a collection of fonts, each of which is identified
  109. by an FMFont reference that maps to a single object registered with
  110. the font database. The font references associated with the font
  111. family consist of individual outline and bitmapped fonts that may be
  112. used with the font access routines of the Font Manager and ATS.
  113. }
  114. FMFont = UInt32;
  115. FMFontPtr = ^FMFont; { when a VAR xx: FMFont parameter can be nil, it is changed to xx: FMFontPtr }
  116. FMFontFamilyInstancePtr = ^FMFontFamilyInstance;
  117. FMFontFamilyInstance = record
  118. fontFamily: FMFontFamily;
  119. fontStyle: FMFontStyle;
  120. end;
  121. FMFontFamilyIteratorPtr = ^FMFontFamilyIterator;
  122. FMFontFamilyIterator = record
  123. reserved: array [0..15] of UInt32;
  124. end;
  125. FMFontIteratorPtr = ^FMFontIterator;
  126. FMFontIterator = record
  127. reserved: array [0..15] of UInt32;
  128. end;
  129. FMFontFamilyInstanceIteratorPtr = ^FMFontFamilyInstanceIterator;
  130. FMFontFamilyInstanceIterator = record
  131. reserved: array [0..15] of UInt32;
  132. end;
  133. const
  134. kInvalidGeneration = 0;
  135. kInvalidFontFamily = -1;
  136. kInvalidFont = 0;
  137. kFMCurrentFilterFormat = 0;
  138. { kFMDefaultOptions & kFMUseGlobalScopeOption moved to Fonts.h }
  139. type
  140. FMFilterSelector = UInt32;
  141. const
  142. kFMFontTechnologyFilterSelector = 1;
  143. kFMFontContainerFilterSelector = 2;
  144. kFMGenerationFilterSelector = 3;
  145. kFMFontFamilyCallbackFilterSelector = 4;
  146. kFMFontCallbackFilterSelector = 5;
  147. kFMFontDirectoryFilterSelector = 6;
  148. kFMTrueTypeFontTechnology = $74727565 (* 'true' *);
  149. kFMPostScriptFontTechnology = $74797031 (* 'typ1' *);
  150. type
  151. {$ifc TYPED_FUNCTION_POINTERS}
  152. FMFontFamilyCallbackFilterProcPtr = function(iFontFamily: FMFontFamily; iRefCon: UnivPtr): OSStatus;
  153. {$elsec}
  154. FMFontFamilyCallbackFilterProcPtr = ProcPtr;
  155. {$endc}
  156. {$ifc TYPED_FUNCTION_POINTERS}
  157. FMFontCallbackFilterProcPtr = function(iFont: FMFont; iRefCon: UnivPtr): OSStatus;
  158. {$elsec}
  159. FMFontCallbackFilterProcPtr = ProcPtr;
  160. {$endc}
  161. {$ifc OPAQUE_UPP_TYPES}
  162. FMFontFamilyCallbackFilterUPP = ^SInt32; { an opaque UPP }
  163. {$elsec}
  164. FMFontFamilyCallbackFilterUPP = UniversalProcPtr;
  165. {$endc}
  166. {$ifc OPAQUE_UPP_TYPES}
  167. FMFontCallbackFilterUPP = ^SInt32; { an opaque UPP }
  168. {$elsec}
  169. FMFontCallbackFilterUPP = UniversalProcPtr;
  170. {$endc}
  171. const
  172. uppFMFontFamilyCallbackFilterProcInfo = $000003B0;
  173. uppFMFontCallbackFilterProcInfo = $000003F0;
  174. {
  175. * NewFMFontFamilyCallbackFilterUPP()
  176. *
  177. * Availability:
  178. * Non-Carbon CFM: available as macro/inline
  179. * CarbonLib: in CarbonLib 1.0 and later
  180. * Mac OS X: in version 10.0 and later
  181. }
  182. function NewFMFontFamilyCallbackFilterUPP(userRoutine: FMFontFamilyCallbackFilterProcPtr): FMFontFamilyCallbackFilterUPP; external name '_NewFMFontFamilyCallbackFilterUPP'; { old name was NewFMFontFamilyCallbackFilterProc }
  183. {
  184. * NewFMFontCallbackFilterUPP()
  185. *
  186. * Availability:
  187. * Non-Carbon CFM: available as macro/inline
  188. * CarbonLib: in CarbonLib 1.0 and later
  189. * Mac OS X: in version 10.0 and later
  190. }
  191. function NewFMFontCallbackFilterUPP(userRoutine: FMFontCallbackFilterProcPtr): FMFontCallbackFilterUPP; external name '_NewFMFontCallbackFilterUPP'; { old name was NewFMFontCallbackFilterProc }
  192. {
  193. * DisposeFMFontFamilyCallbackFilterUPP()
  194. *
  195. * Availability:
  196. * Non-Carbon CFM: available as macro/inline
  197. * CarbonLib: in CarbonLib 1.0 and later
  198. * Mac OS X: in version 10.0 and later
  199. }
  200. procedure DisposeFMFontFamilyCallbackFilterUPP(userUPP: FMFontFamilyCallbackFilterUPP); external name '_DisposeFMFontFamilyCallbackFilterUPP';
  201. {
  202. * DisposeFMFontCallbackFilterUPP()
  203. *
  204. * Availability:
  205. * Non-Carbon CFM: available as macro/inline
  206. * CarbonLib: in CarbonLib 1.0 and later
  207. * Mac OS X: in version 10.0 and later
  208. }
  209. procedure DisposeFMFontCallbackFilterUPP(userUPP: FMFontCallbackFilterUPP); external name '_DisposeFMFontCallbackFilterUPP';
  210. {
  211. * InvokeFMFontFamilyCallbackFilterUPP()
  212. *
  213. * Availability:
  214. * Non-Carbon CFM: available as macro/inline
  215. * CarbonLib: in CarbonLib 1.0 and later
  216. * Mac OS X: in version 10.0 and later
  217. }
  218. function InvokeFMFontFamilyCallbackFilterUPP(iFontFamily: FMFontFamily; iRefCon: UnivPtr; userRoutine: FMFontFamilyCallbackFilterUPP): OSStatus; external name '_InvokeFMFontFamilyCallbackFilterUPP'; { old name was CallFMFontFamilyCallbackFilterProc }
  219. {
  220. * InvokeFMFontCallbackFilterUPP()
  221. *
  222. * Availability:
  223. * Non-Carbon CFM: available as macro/inline
  224. * CarbonLib: in CarbonLib 1.0 and later
  225. * Mac OS X: in version 10.0 and later
  226. }
  227. function InvokeFMFontCallbackFilterUPP(iFont: FMFont; iRefCon: UnivPtr; userRoutine: FMFontCallbackFilterUPP): OSStatus; external name '_InvokeFMFontCallbackFilterUPP'; { old name was CallFMFontCallbackFilterProc }
  228. type
  229. FMFontDirectoryFilterPtr = ^FMFontDirectoryFilter;
  230. FMFontDirectoryFilter = record
  231. fontFolderDomain: SInt16;
  232. reserved: array [0..1] of UInt32;
  233. end;
  234. FMFilterPtr = ^FMFilter;
  235. FMFilter = record
  236. format: UInt32;
  237. selector: FMFilterSelector;
  238. case SInt16 of
  239. 0: (
  240. fontTechnologyFilter: FourCharCode;
  241. );
  242. 1: (
  243. fontContainerFilter: FSSpec;
  244. );
  245. 2: (
  246. generationFilter: FMGeneration;
  247. );
  248. 3: (
  249. fontFamilyCallbackFilter: FMFontFamilyCallbackFilterUPP;
  250. );
  251. 4: (
  252. fontCallbackFilter: FMFontCallbackFilterUPP;
  253. );
  254. 5: (
  255. fontDirectoryFilter: FMFontDirectoryFilter;
  256. );
  257. end;
  258. ATSOptionFlags = OptionBits;
  259. ATSGeneration = UInt32;
  260. ATSFontContainerRef = UInt32;
  261. ATSFontFamilyRef = UInt32;
  262. ATSFontRef = UInt32;
  263. ATSGlyphRef = UInt16;
  264. ATSFontSize = Float32;
  265. const
  266. kATSGenerationUnspecified = 0;
  267. kATSFontContainerRefUnspecified = 0;
  268. kATSFontFamilyRefUnspecified = 0;
  269. kATSFontRefUnspecified = 0;
  270. type
  271. ATSFontMetricsPtr = ^ATSFontMetrics;
  272. ATSFontMetrics = record
  273. version: UInt32;
  274. ascent: Float32; { Maximum height above baseline reached by the glyphs in the font }
  275. { or maximum distance to the right of the centerline reached by the glyphs in the font }
  276. descent: Float32; { Maximum depth below baseline reached by the glyphs in the font }
  277. { or maximum distance to the left of the centerline reached by the glyphs in the font }
  278. leading: Float32; { Desired spacing between lines of text }
  279. avgAdvanceWidth: Float32;
  280. maxAdvanceWidth: Float32; { Maximum advance width or height of the glyphs in the font }
  281. minLeftSideBearing: Float32; { Minimum left or top side bearing }
  282. minRightSideBearing: Float32; { Minimum right or bottom side bearing }
  283. stemWidth: Float32; { Width of the dominant vertical stems of the glyphs in the font }
  284. stemHeight: Float32; { Vertical width of the dominant horizontal stems of glyphs in the font }
  285. capHeight: Float32; { Height of a capital letter from the baseline to the top of the letter }
  286. xHeight: Float32; { Height of lowercase characters in a font, specifically the letter x, excluding ascenders and descenders }
  287. italicAngle: Float32; { Angle in degrees counterclockwise from the vertical of the dominant vertical strokes of the glyphs in the font }
  288. underlinePosition: Float32; { Distance from the baseline for positioning underlining strokes }
  289. underlineThickness: Float32; { Stroke width for underlining }
  290. end;
  291. const
  292. kATSItalicQDSkew = $00004000; { fixed value of 0.25 }
  293. kATSBoldQDStretch = $00018000; { fixed value of 1.50 }
  294. kATSRadiansFactor = 1144; { fixed value of approx. pi/180 (0.0174560546875) }
  295. { Glyph outline path constants used in ATSFontGetNativeCurveType. }
  296. type
  297. ATSCurveType = UInt16;
  298. const
  299. kATSCubicCurveType = $0001;
  300. kATSQuadCurveType = $0002;
  301. kATSOtherCurveType = $0003;
  302. {
  303. This is what the ATSGlyphRef is set to when the glyph is deleted -
  304. that is, when the glyph is set to no longer appear when the layout
  305. is actually drawn
  306. }
  307. const
  308. kATSDeletedGlyphcode = $FFFF;
  309. type
  310. ATSUCurvePathPtr = ^ATSUCurvePath;
  311. ATSUCurvePath = record
  312. vectors: UInt32;
  313. controlBits: array [0..0] of UInt32;
  314. vector: array [0..0] of Float32Point;
  315. end;
  316. ATSUCurvePathsPtr = ^ATSUCurvePaths;
  317. ATSUCurvePaths = record
  318. contours: UInt32;
  319. contour: array [0..0] of ATSUCurvePath;
  320. end;
  321. { Glyph ideal metrics }
  322. ATSGlyphIdealMetricsPtr = ^ATSGlyphIdealMetrics;
  323. ATSGlyphIdealMetrics = record
  324. advance: Float32Point;
  325. sideBearing: Float32Point;
  326. otherSideBearing: Float32Point;
  327. end;
  328. { Glyph screen metrics }
  329. ATSGlyphScreenMetricsPtr = ^ATSGlyphScreenMetrics;
  330. ATSGlyphScreenMetrics = record
  331. deviceAdvance: Float32Point;
  332. topLeft: Float32Point;
  333. height: UInt32;
  334. width: UInt32;
  335. sideBearing: Float32Point;
  336. otherSideBearing: Float32Point;
  337. end;
  338. GlyphID = ATSGlyphRef;
  339. GlyphID_fix = GlyphID; { used as field type when a record declaration contains a GlyphID field identifier }
  340. GlyphIDPtr = ^GlyphID;
  341. {$ALIGN MAC68K}
  342. end.