Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

369 lines
14 KiB

  1. /*
  2. File: ATSTypes.h
  3. Contains: Public interfaces for Apple Type Services components.
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 1997-2001 by Apple Computer, Inc., all rights reserved.
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://developer.apple.com/bugreporter/
  9. */
  10. #ifndef __ATSTYPES__
  11. #define __ATSTYPES__
  12. #ifndef __MACTYPES__
  13. #include <MacTypes.h>
  14. #endif
  15. #ifndef __FILES__
  16. #include <Files.h>
  17. #endif
  18. #ifndef __MIXEDMODE__
  19. #include <MixedMode.h>
  20. #endif
  21. #if PRAGMA_ONCE
  22. #pragma once
  23. #endif
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. #if PRAGMA_IMPORT
  28. #pragma import on
  29. #endif
  30. #if PRAGMA_STRUCT_ALIGN
  31. #pragma options align=mac68k
  32. #elif PRAGMA_STRUCT_PACKPUSH
  33. #pragma pack(push, 2)
  34. #elif PRAGMA_STRUCT_PACK
  35. #pragma pack(2)
  36. #endif
  37. typedef UInt32 FMGeneration;
  38. /* The FMFontFamily reference represents a collection of fonts with the same design
  39. characteristics. It replaces the standard QuickDraw font identifer and may be used
  40. with all QuickDraw functions including GetFontName and TextFont. It cannot be used
  41. with the Resource Manager to access information from a FOND resource handle. A font
  42. reference does not imply a particular script system, nor is the character encoding
  43. of a font family determined by an arithmetic mapping of its value.
  44. */
  45. typedef SInt16 FMFontFamily;
  46. typedef SInt16 FMFontStyle;
  47. typedef SInt16 FMFontSize;
  48. /*
  49. The font family is a collection of fonts, each of which is identified
  50. by an FMFont reference that maps to a single object registered with
  51. the font database. The font references associated with the font
  52. family consist of individual outline and bitmapped fonts that may be
  53. used with the font access routines of the Font Manager and ATS.
  54. */
  55. typedef UInt32 FMFont;
  56. struct FMFontFamilyInstance {
  57. FMFontFamily fontFamily;
  58. FMFontStyle fontStyle;
  59. };
  60. typedef struct FMFontFamilyInstance FMFontFamilyInstance;
  61. struct FMFontFamilyIterator {
  62. UInt32 reserved[16];
  63. };
  64. typedef struct FMFontFamilyIterator FMFontFamilyIterator;
  65. struct FMFontIterator {
  66. UInt32 reserved[16];
  67. };
  68. typedef struct FMFontIterator FMFontIterator;
  69. struct FMFontFamilyInstanceIterator {
  70. UInt32 reserved[16];
  71. };
  72. typedef struct FMFontFamilyInstanceIterator FMFontFamilyInstanceIterator;
  73. enum {
  74. kInvalidGeneration = 0L,
  75. kInvalidFontFamily = -1,
  76. kInvalidFont = 0L
  77. };
  78. enum {
  79. kFMCurrentFilterFormat = 0L
  80. };
  81. typedef UInt32 FMFilterSelector;
  82. enum {
  83. kFMFontTechnologyFilterSelector = 1L,
  84. kFMFontContainerFilterSelector = 2L,
  85. kFMGenerationFilterSelector = 3L,
  86. kFMFontFamilyCallbackFilterSelector = 4L,
  87. kFMFontCallbackFilterSelector = 5L,
  88. kFMFontDirectoryFilterSelector = 6L
  89. };
  90. enum {
  91. kFMTrueTypeFontTechnology = FOUR_CHAR_CODE('true'),
  92. kFMPostScriptFontTechnology = FOUR_CHAR_CODE('typ1')
  93. };
  94. typedef CALLBACK_API( OSStatus , FMFontFamilyCallbackFilterProcPtr )(FMFontFamily iFontFamily, void *iRefCon);
  95. typedef CALLBACK_API( OSStatus , FMFontCallbackFilterProcPtr )(FMFont iFont, void *iRefCon);
  96. typedef STACK_UPP_TYPE(FMFontFamilyCallbackFilterProcPtr) FMFontFamilyCallbackFilterUPP;
  97. typedef STACK_UPP_TYPE(FMFontCallbackFilterProcPtr) FMFontCallbackFilterUPP;
  98. /*
  99. * NewFMFontFamilyCallbackFilterUPP()
  100. *
  101. * Availability:
  102. * Non-Carbon CFM: available as macro/inline
  103. * CarbonLib: in CarbonLib 1.0 and later
  104. * Mac OS X: in version 10.0 and later
  105. */
  106. EXTERN_API_C( FMFontFamilyCallbackFilterUPP )
  107. NewFMFontFamilyCallbackFilterUPP(FMFontFamilyCallbackFilterProcPtr userRoutine);
  108. #if !OPAQUE_UPP_TYPES
  109. enum { uppFMFontFamilyCallbackFilterProcInfo = 0x000003B0 }; /* pascal 4_bytes Func(2_bytes, 4_bytes) */
  110. #ifdef __cplusplus
  111. inline DEFINE_API_C(FMFontFamilyCallbackFilterUPP) NewFMFontFamilyCallbackFilterUPP(FMFontFamilyCallbackFilterProcPtr userRoutine) { return (FMFontFamilyCallbackFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppFMFontFamilyCallbackFilterProcInfo, GetCurrentArchitecture()); }
  112. #else
  113. #define NewFMFontFamilyCallbackFilterUPP(userRoutine) (FMFontFamilyCallbackFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppFMFontFamilyCallbackFilterProcInfo, GetCurrentArchitecture())
  114. #endif
  115. #endif
  116. /*
  117. * NewFMFontCallbackFilterUPP()
  118. *
  119. * Availability:
  120. * Non-Carbon CFM: available as macro/inline
  121. * CarbonLib: in CarbonLib 1.0 and later
  122. * Mac OS X: in version 10.0 and later
  123. */
  124. EXTERN_API_C( FMFontCallbackFilterUPP )
  125. NewFMFontCallbackFilterUPP(FMFontCallbackFilterProcPtr userRoutine);
  126. #if !OPAQUE_UPP_TYPES
  127. enum { uppFMFontCallbackFilterProcInfo = 0x000003F0 }; /* pascal 4_bytes Func(4_bytes, 4_bytes) */
  128. #ifdef __cplusplus
  129. inline DEFINE_API_C(FMFontCallbackFilterUPP) NewFMFontCallbackFilterUPP(FMFontCallbackFilterProcPtr userRoutine) { return (FMFontCallbackFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppFMFontCallbackFilterProcInfo, GetCurrentArchitecture()); }
  130. #else
  131. #define NewFMFontCallbackFilterUPP(userRoutine) (FMFontCallbackFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppFMFontCallbackFilterProcInfo, GetCurrentArchitecture())
  132. #endif
  133. #endif
  134. /*
  135. * DisposeFMFontFamilyCallbackFilterUPP()
  136. *
  137. * Availability:
  138. * Non-Carbon CFM: available as macro/inline
  139. * CarbonLib: in CarbonLib 1.0 and later
  140. * Mac OS X: in version 10.0 and later
  141. */
  142. EXTERN_API_C( void )
  143. DisposeFMFontFamilyCallbackFilterUPP(FMFontFamilyCallbackFilterUPP userUPP);
  144. #if !OPAQUE_UPP_TYPES
  145. #ifdef __cplusplus
  146. inline DEFINE_API_C(void) DisposeFMFontFamilyCallbackFilterUPP(FMFontFamilyCallbackFilterUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  147. #else
  148. #define DisposeFMFontFamilyCallbackFilterUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  149. #endif
  150. #endif
  151. /*
  152. * DisposeFMFontCallbackFilterUPP()
  153. *
  154. * Availability:
  155. * Non-Carbon CFM: available as macro/inline
  156. * CarbonLib: in CarbonLib 1.0 and later
  157. * Mac OS X: in version 10.0 and later
  158. */
  159. EXTERN_API_C( void )
  160. DisposeFMFontCallbackFilterUPP(FMFontCallbackFilterUPP userUPP);
  161. #if !OPAQUE_UPP_TYPES
  162. #ifdef __cplusplus
  163. inline DEFINE_API_C(void) DisposeFMFontCallbackFilterUPP(FMFontCallbackFilterUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  164. #else
  165. #define DisposeFMFontCallbackFilterUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  166. #endif
  167. #endif
  168. /*
  169. * InvokeFMFontFamilyCallbackFilterUPP()
  170. *
  171. * Availability:
  172. * Non-Carbon CFM: available as macro/inline
  173. * CarbonLib: in CarbonLib 1.0 and later
  174. * Mac OS X: in version 10.0 and later
  175. */
  176. EXTERN_API_C( OSStatus )
  177. InvokeFMFontFamilyCallbackFilterUPP(
  178. FMFontFamily iFontFamily,
  179. void * iRefCon,
  180. FMFontFamilyCallbackFilterUPP userUPP);
  181. #if !OPAQUE_UPP_TYPES
  182. #ifdef __cplusplus
  183. inline DEFINE_API_C(OSStatus) InvokeFMFontFamilyCallbackFilterUPP(FMFontFamily iFontFamily, void * iRefCon, FMFontFamilyCallbackFilterUPP userUPP) { return (OSStatus)CALL_TWO_PARAMETER_UPP(userUPP, uppFMFontFamilyCallbackFilterProcInfo, iFontFamily, iRefCon); }
  184. #else
  185. #define InvokeFMFontFamilyCallbackFilterUPP(iFontFamily, iRefCon, userUPP) (OSStatus)CALL_TWO_PARAMETER_UPP((userUPP), uppFMFontFamilyCallbackFilterProcInfo, (iFontFamily), (iRefCon))
  186. #endif
  187. #endif
  188. /*
  189. * InvokeFMFontCallbackFilterUPP()
  190. *
  191. * Availability:
  192. * Non-Carbon CFM: available as macro/inline
  193. * CarbonLib: in CarbonLib 1.0 and later
  194. * Mac OS X: in version 10.0 and later
  195. */
  196. EXTERN_API_C( OSStatus )
  197. InvokeFMFontCallbackFilterUPP(
  198. FMFont iFont,
  199. void * iRefCon,
  200. FMFontCallbackFilterUPP userUPP);
  201. #if !OPAQUE_UPP_TYPES
  202. #ifdef __cplusplus
  203. inline DEFINE_API_C(OSStatus) InvokeFMFontCallbackFilterUPP(FMFont iFont, void * iRefCon, FMFontCallbackFilterUPP userUPP) { return (OSStatus)CALL_TWO_PARAMETER_UPP(userUPP, uppFMFontCallbackFilterProcInfo, iFont, iRefCon); }
  204. #else
  205. #define InvokeFMFontCallbackFilterUPP(iFont, iRefCon, userUPP) (OSStatus)CALL_TWO_PARAMETER_UPP((userUPP), uppFMFontCallbackFilterProcInfo, (iFont), (iRefCon))
  206. #endif
  207. #endif
  208. #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
  209. /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
  210. #define NewFMFontFamilyCallbackFilterProc(userRoutine) NewFMFontFamilyCallbackFilterUPP(userRoutine)
  211. #define NewFMFontCallbackFilterProc(userRoutine) NewFMFontCallbackFilterUPP(userRoutine)
  212. #define CallFMFontFamilyCallbackFilterProc(userRoutine, iFontFamily, iRefCon) InvokeFMFontFamilyCallbackFilterUPP(iFontFamily, iRefCon, userRoutine)
  213. #define CallFMFontCallbackFilterProc(userRoutine, iFont, iRefCon) InvokeFMFontCallbackFilterUPP(iFont, iRefCon, userRoutine)
  214. #endif /* CALL_NOT_IN_CARBON */
  215. struct FMFontDirectoryFilter {
  216. SInt16 fontFolderDomain;
  217. UInt32 reserved[2];
  218. };
  219. typedef struct FMFontDirectoryFilter FMFontDirectoryFilter;
  220. struct FMFilter {
  221. UInt32 format;
  222. FMFilterSelector selector;
  223. union {
  224. FourCharCode fontTechnologyFilter;
  225. FSSpec fontContainerFilter;
  226. FMGeneration generationFilter;
  227. FMFontFamilyCallbackFilterUPP fontFamilyCallbackFilter;
  228. FMFontCallbackFilterUPP fontCallbackFilter;
  229. FMFontDirectoryFilter fontDirectoryFilter;
  230. } filter;
  231. };
  232. typedef struct FMFilter FMFilter;
  233. typedef OptionBits ATSOptionFlags;
  234. typedef UInt32 ATSGeneration;
  235. typedef UInt32 ATSFontContainerRef;
  236. typedef UInt32 ATSFontFamilyRef;
  237. typedef UInt32 ATSFontRef;
  238. typedef UInt16 ATSGlyphRef;
  239. typedef Float32 ATSFontSize;
  240. enum {
  241. kATSGenerationUnspecified = 0L,
  242. kATSFontContainerRefUnspecified = 0L,
  243. kATSFontFamilyRefUnspecified = 0L,
  244. kATSFontRefUnspecified = 0L
  245. };
  246. struct ATSFontMetrics {
  247. UInt32 version;
  248. Float32 ascent; /* Maximum height above baseline reached by the glyphs in the font */
  249. /* or maximum distance to the right of the centerline reached by the glyphs in the font */
  250. Float32 descent; /* Maximum depth below baseline reached by the glyphs in the font */
  251. /* or maximum distance to the left of the centerline reached by the glyphs in the font */
  252. Float32 leading; /* Desired spacing between lines of text */
  253. Float32 avgAdvanceWidth;
  254. Float32 maxAdvanceWidth; /* Maximum advance width or height of the glyphs in the font */
  255. Float32 minLeftSideBearing; /* Minimum left or top side bearing */
  256. Float32 minRightSideBearing; /* Minimum right or bottom side bearing */
  257. Float32 stemWidth; /* Width of the dominant vertical stems of the glyphs in the font */
  258. Float32 stemHeight; /* Vertical width of the dominant horizontal stems of glyphs in the font */
  259. Float32 capHeight; /* Height of a capital letter from the baseline to the top of the letter */
  260. Float32 xHeight; /* Height of lowercase characters in a font, specifically the letter x, excluding ascenders and descenders */
  261. Float32 italicAngle; /* Angle in degrees counterclockwise from the vertical of the dominant vertical strokes of the glyphs in the font */
  262. Float32 underlinePosition; /* Distance from the baseline for positioning underlining strokes */
  263. Float32 underlineThickness; /* Stroke width for underlining */
  264. };
  265. typedef struct ATSFontMetrics ATSFontMetrics;
  266. enum {
  267. kATSItalicQDSkew = (1 << 16) / 4, /* fixed value of 0.25 */
  268. kATSBoldQDStretch = (1 << 16) * 3 / 2, /* fixed value of 1.50 */
  269. kATSRadiansFactor = 1144 /* fixed value of approx. pi/180 (0.0174560546875) */
  270. };
  271. /* Glyph outline path constants used in ATSFontGetNativeCurveType. */
  272. typedef UInt16 ATSCurveType;
  273. enum {
  274. kATSCubicCurveType = 0x0001,
  275. kATSQuadCurveType = 0x0002,
  276. kATSOtherCurveType = 0x0003
  277. };
  278. /*
  279. This is what the ATSGlyphRef is set to when the glyph is deleted -
  280. that is, when the glyph is set to no longer appear when the layout
  281. is actually drawn
  282. */
  283. enum {
  284. kATSDeletedGlyphcode = 0xFFFF
  285. };
  286. struct ATSUCurvePath {
  287. UInt32 vectors;
  288. UInt32 controlBits[1];
  289. Float32Point vector[1];
  290. };
  291. typedef struct ATSUCurvePath ATSUCurvePath;
  292. struct ATSUCurvePaths {
  293. UInt32 contours;
  294. ATSUCurvePath contour[1];
  295. };
  296. typedef struct ATSUCurvePaths ATSUCurvePaths;
  297. /* Glyph ideal metrics */
  298. struct ATSGlyphIdealMetrics {
  299. Float32Point advance;
  300. Float32Point sideBearing;
  301. Float32Point otherSideBearing;
  302. };
  303. typedef struct ATSGlyphIdealMetrics ATSGlyphIdealMetrics;
  304. /* Glyph screen metrics */
  305. struct ATSGlyphScreenMetrics {
  306. Float32Point deviceAdvance;
  307. Float32Point topLeft;
  308. UInt32 height;
  309. UInt32 width;
  310. Float32Point sideBearing;
  311. Float32Point otherSideBearing;
  312. };
  313. typedef struct ATSGlyphScreenMetrics ATSGlyphScreenMetrics;
  314. /* Glyph References */
  315. typedef ATSGlyphRef GlyphID;
  316. #if PRAGMA_STRUCT_ALIGN
  317. #pragma options align=reset
  318. #elif PRAGMA_STRUCT_PACKPUSH
  319. #pragma pack(pop)
  320. #elif PRAGMA_STRUCT_PACK
  321. #pragma pack()
  322. #endif
  323. #ifdef PRAGMA_IMPORT_OFF
  324. #pragma import off
  325. #elif PRAGMA_IMPORT
  326. #pragma import reset
  327. #endif
  328. #ifdef __cplusplus
  329. }
  330. #endif
  331. #endif /* __ATSTYPES__ */