ATSFont.pas 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970
  1. {
  2. File: ATSFont.p
  3. Contains: Public interface to the font access and data management functions of ATS.
  4. Version: Technology: Mac OS
  5. Release: Universal Interfaces 3.4.2
  6. Copyright: © 2000-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 ATSFont;
  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,CFBase,CFRunLoop,CFPropertyList,ATSTypes,CFString,Files,TextCommon,SFNTTypes;
  92. {$ALIGN MAC68K}
  93. const
  94. kATSOptionFlagsDefault = 0;
  95. kATSOptionFlagsComposeFontPostScriptName = $01; { ATSFontGetPostScriptName }
  96. kATSOptionFlagsUseDataForkAsResourceFork = $0100; { ATSFontActivateFromFileSpecification }
  97. kATSOptionFlagsUseResourceFork = $0200;
  98. kATSOptionFlagsUseDataFork = $0300;
  99. kATSIterationCompleted = -980;
  100. kATSInvalidFontFamilyAccess = -981;
  101. kATSInvalidFontAccess = -982;
  102. kATSIterationScopeModified = -983;
  103. kATSInvalidFontTableAccess = -984;
  104. kATSInvalidFontContainerAccess = -985;
  105. kATSInvalidGlyphAccess = -986;
  106. type
  107. ATSFontContext = UInt32;
  108. const
  109. kATSFontContextUnspecified = 0;
  110. kATSFontContextGlobal = 1;
  111. kATSFontContextLocal = 2;
  112. const
  113. kATSOptionFlagsProcessSubdirectories = $00000001 shl 6; { Used by activation/deactivation & iteration }
  114. kATSOptionFlagsDoNotNotify = $00000001 shl 7; { Do not notify after global activation/deactivation }
  115. { Iteration Option Flags }
  116. const
  117. kATSOptionFlagsIterateByPrecedenceMask = $00000001 shl 5;
  118. kATSOptionFlagsIterationScopeMask = $00000007 shl 12; { Mask option bits 12-14 for iteration scopes }
  119. kATSOptionFlagsDefaultScope = $00000000 shl 12;
  120. kATSOptionFlagsUnRestrictedScope = $00000001 shl 12;
  121. kATSOptionFlagsRestrictedScope = $00000002 shl 12;
  122. type
  123. ATSFontFormat = UInt32;
  124. const
  125. kATSFontFormatUnspecified = 0;
  126. type
  127. {$ifc TYPED_FUNCTION_POINTERS}
  128. ATSFontFamilyApplierFunction = function(iFamily: ATSFontFamilyRef; iRefCon: UnivPtr): OSStatus;
  129. {$elsec}
  130. ATSFontFamilyApplierFunction = ProcPtr;
  131. {$endc}
  132. {$ifc TYPED_FUNCTION_POINTERS}
  133. ATSFontApplierFunction = function(iFont: ATSFontRef; iRefCon: UnivPtr): OSStatus;
  134. {$elsec}
  135. ATSFontApplierFunction = ProcPtr;
  136. {$endc}
  137. ATSFontFamilyIterator = ^SInt32; { an opaque 32-bit type }
  138. ATSFontFamilyIteratorPtr = ^ATSFontFamilyIterator; { when a var xx:ATSFontFamilyIterator parameter can be nil, it is changed to xx: ATSFontFamilyIteratorPtr }
  139. ATSFontIterator = ^SInt32; { an opaque 32-bit type }
  140. ATSFontIteratorPtr = ^ATSFontIterator; { when a var xx:ATSFontIterator parameter can be nil, it is changed to xx: ATSFontIteratorPtr }
  141. const
  142. kATSFontFilterCurrentVersion = 0;
  143. type
  144. ATSFontFilterSelector = SInt32;
  145. const
  146. kATSFontFilterSelectorUnspecified = 0;
  147. kATSFontFilterSelectorGeneration = 3;
  148. kATSFontFilterSelectorFontFamily = 7;
  149. kATSFontFilterSelectorFontFamilyApplierFunction = 8;
  150. kATSFontFilterSelectorFontApplierFunction = 9;
  151. type
  152. ATSFontFilterPtr = ^ATSFontFilter;
  153. ATSFontFilter = record
  154. version: UInt32;
  155. filterSelector: ATSFontFilterSelector;
  156. case SInt16 of
  157. 0: (
  158. generationFilter: ATSGeneration;
  159. );
  160. 1: (
  161. fontFamilyFilter: ATSFontFamilyRef;
  162. );
  163. 2: (
  164. fontFamilyApplierFunctionFilter: ATSFontFamilyApplierFunction;
  165. );
  166. 3: (
  167. fontApplierFunctionFilter: ATSFontApplierFunction;
  168. );
  169. end;
  170. { Notification related }
  171. type
  172. ATSFontNotificationRef = ^SInt32; { an opaque 32-bit type }
  173. ATSFontNotificationRefPtr = ^ATSFontNotificationRef;
  174. ATSFontNotificationInfoRef = ^SInt32; { an opaque 32-bit type }
  175. ATSFontNotificationInfoRefPtr = ^ATSFontNotificationInfoRef;
  176. {
  177. * ATSFontNotifyOption
  178. *
  179. * Discussion:
  180. * Options used with ATSFontNotificationSubscribe. Any of the
  181. * options that follow may be used together in order to alter the
  182. * default behavior of ATS notifications.
  183. }
  184. type
  185. ATSFontNotifyOption = SInt32;
  186. const
  187. {
  188. * Default behavior of ATSFontNotificationSubscribe.
  189. }
  190. kATSFontNotifyOptionDefault = 0;
  191. {
  192. * Normally applications will only receive ATS notifications while in
  193. * the foreground. If suspended, the notification will be delivered
  194. * when then application comes to the foreground. This is the
  195. * default. You should set this option if you are a server or tool
  196. * that performs font management functions and require immediate
  197. * notification when something changes.
  198. }
  199. kATSFontNotifyOptionReceiveWhileSuspended = 1 shl 0;
  200. {
  201. * ATSFontNotifyAction
  202. *
  203. * Discussion:
  204. * Used with ATSFontNotify. The following is a list of actions you
  205. * might wish the ATS server to perform and notify clients if
  206. * appropriate.
  207. }
  208. type
  209. ATSFontNotifyAction = SInt32;
  210. const
  211. {
  212. * Used after a batch (de)activation of fonts occurs. Typically the
  213. * caller has exercised multiple global (De)Activation calls with the
  214. * kATSOptionFlagsDoNotNotify set. Once all calls are completed, one
  215. * may use ATSFontNotify with this action to ask ATS to notify all
  216. * clients.
  217. }
  218. kATSFontNotifyActionFontsChanged = 1;
  219. {
  220. * The ATS system with the help of the Finder keeps track of changes
  221. * to any of the font directories in the system domains ( System,
  222. * Local, Network, User, & Classic). However, one may wish to
  223. * add/remove fonts to these locations programmatically. This action
  224. * is used to let ATS server to rescan these directories and post
  225. * notifications if necessary.
  226. }
  227. kATSFontNotifyActionDirectoriesChanged = 2;
  228. {
  229. * ATSNotificationCallback
  230. *
  231. * Discussion:
  232. * Callback delivered for ATS notifications.
  233. *
  234. * Parameters:
  235. *
  236. * info:
  237. * Parameter is placed here for future improvements. Initially
  238. * the contents of this parameter will be NULL.
  239. *
  240. * refCon:
  241. * User data/state to be supplied to callback function
  242. }
  243. type ATSNotificationCallback = procedure( info: ATSFontNotificationInfoRef; refCon: UnivPtr );
  244. { ----------------------------------------------------------------------------------------- }
  245. { Font container }
  246. { ----------------------------------------------------------------------------------------- }
  247. {
  248. * ATSGetGeneration()
  249. *
  250. * Availability:
  251. * Non-Carbon CFM: not available
  252. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  253. * Mac OS X: in version 10.0 and later
  254. }
  255. function ATSGetGeneration: ATSGeneration; external name '_ATSGetGeneration';
  256. {
  257. * ATSFontActivateFromFileSpecification()
  258. *
  259. * Availability:
  260. * Non-Carbon CFM: not available
  261. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  262. * Mac OS X: in version 10.0 and later
  263. }
  264. function ATSFontActivateFromFileSpecification(const (*var*) iFile: FSSpec; iContext: ATSFontContext; iFormat: ATSFontFormat; iReserved: UnivPtr; iOptions: ATSOptionFlags; var oContainer: ATSFontContainerRef): OSStatus; external name '_ATSFontActivateFromFileSpecification';
  265. {
  266. * ATSFontActivateFromMemory()
  267. *
  268. * Availability:
  269. * Non-Carbon CFM: not available
  270. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  271. * Mac OS X: in version 10.0 and later
  272. }
  273. function ATSFontActivateFromMemory(iData: LogicalAddress; iLength: ByteCount; iContext: ATSFontContext; iFormat: ATSFontFormat; iReserved: UnivPtr; iOptions: ATSOptionFlags; var oContainer: ATSFontContainerRef): OSStatus; external name '_ATSFontActivateFromMemory';
  274. {
  275. * ATSFontDeactivate()
  276. *
  277. * Availability:
  278. * Non-Carbon CFM: not available
  279. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  280. * Mac OS X: in version 10.0 and later
  281. }
  282. function ATSFontDeactivate(iContainer: ATSFontContainerRef; iRefCon: UnivPtr; iOptions: ATSOptionFlags): OSStatus; external name '_ATSFontDeactivate';
  283. { ----------------------------------------------------------------------------------------- }
  284. { Font family }
  285. { ----------------------------------------------------------------------------------------- }
  286. {
  287. * ATSFontFamilyApplyFunction()
  288. *
  289. * Availability:
  290. * Non-Carbon CFM: not available
  291. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  292. * Mac OS X: in version 10.0 and later
  293. }
  294. function ATSFontFamilyApplyFunction(iFunction: ATSFontFamilyApplierFunction; iRefCon: UnivPtr): OSStatus; external name '_ATSFontFamilyApplyFunction';
  295. {
  296. * ATSFontFamilyIteratorCreate()
  297. *
  298. * Availability:
  299. * Non-Carbon CFM: not available
  300. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  301. * Mac OS X: in version 10.0 and later
  302. }
  303. function ATSFontFamilyIteratorCreate(iContext: ATSFontContext; iFilter: {Const}ATSFontFilterPtr; iRefCon: UnivPtr; iOptions: ATSOptionFlags; var ioIterator: ATSFontFamilyIterator): OSStatus; external name '_ATSFontFamilyIteratorCreate';
  304. {
  305. * ATSFontFamilyIteratorRelease()
  306. *
  307. * Availability:
  308. * Non-Carbon CFM: not available
  309. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  310. * Mac OS X: in version 10.0 and later
  311. }
  312. function ATSFontFamilyIteratorRelease(var ioIterator: ATSFontFamilyIterator): OSStatus; external name '_ATSFontFamilyIteratorRelease';
  313. {
  314. * ATSFontFamilyIteratorReset()
  315. *
  316. * Availability:
  317. * Non-Carbon CFM: not available
  318. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  319. * Mac OS X: in version 10.0 and later
  320. }
  321. function ATSFontFamilyIteratorReset(iContext: ATSFontContext; iFilter: {Const}ATSFontFilterPtr; iRefCon: UnivPtr; iOptions: ATSOptionFlags; var ioIterator: ATSFontFamilyIterator): OSStatus; external name '_ATSFontFamilyIteratorReset';
  322. {
  323. * ATSFontFamilyIteratorNext()
  324. *
  325. * Availability:
  326. * Non-Carbon CFM: not available
  327. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  328. * Mac OS X: in version 10.0 and later
  329. }
  330. function ATSFontFamilyIteratorNext(iIterator: ATSFontFamilyIterator; var oFamily: ATSFontFamilyRef): OSStatus; external name '_ATSFontFamilyIteratorNext';
  331. {
  332. * ATSFontFamilyFindFromName()
  333. *
  334. * Availability:
  335. * Non-Carbon CFM: not available
  336. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  337. * Mac OS X: in version 10.0 and later
  338. }
  339. function ATSFontFamilyFindFromName(iName: CFStringRef; iOptions: ATSOptionFlags): ATSFontFamilyRef; external name '_ATSFontFamilyFindFromName';
  340. {
  341. * ATSFontFamilyGetGeneration()
  342. *
  343. * Availability:
  344. * Non-Carbon CFM: not available
  345. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  346. * Mac OS X: in version 10.0 and later
  347. }
  348. function ATSFontFamilyGetGeneration(iFamily: ATSFontFamilyRef): ATSGeneration; external name '_ATSFontFamilyGetGeneration';
  349. {
  350. * ATSFontFamilyGetName()
  351. *
  352. * Availability:
  353. * Non-Carbon CFM: not available
  354. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  355. * Mac OS X: in version 10.0 and later
  356. }
  357. function ATSFontFamilyGetName(iFamily: ATSFontFamilyRef; iOptions: ATSOptionFlags; var oName: CFStringRef): OSStatus; external name '_ATSFontFamilyGetName';
  358. {
  359. * ATSFontFamilyGetEncoding()
  360. *
  361. * Availability:
  362. * Non-Carbon CFM: not available
  363. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  364. * Mac OS X: in version 10.0 and later
  365. }
  366. function ATSFontFamilyGetEncoding(iFamily: ATSFontFamilyRef): TextEncoding; external name '_ATSFontFamilyGetEncoding';
  367. { ----------------------------------------------------------------------------------------- }
  368. { Font }
  369. { ----------------------------------------------------------------------------------------- }
  370. {
  371. * ATSFontApplyFunction()
  372. *
  373. * Availability:
  374. * Non-Carbon CFM: not available
  375. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  376. * Mac OS X: in version 10.0 and later
  377. }
  378. function ATSFontApplyFunction(iFunction: ATSFontApplierFunction; iRefCon: UnivPtr): OSStatus; external name '_ATSFontApplyFunction';
  379. {
  380. * ATSFontIteratorCreate()
  381. *
  382. * Availability:
  383. * Non-Carbon CFM: not available
  384. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  385. * Mac OS X: in version 10.0 and later
  386. }
  387. function ATSFontIteratorCreate(iContext: ATSFontContext; iFilter: {Const}ATSFontFilterPtr; iRefCon: UnivPtr; iOptions: ATSOptionFlags; var ioIterator: ATSFontIterator): OSStatus; external name '_ATSFontIteratorCreate';
  388. {
  389. * ATSFontIteratorRelease()
  390. *
  391. * Availability:
  392. * Non-Carbon CFM: not available
  393. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  394. * Mac OS X: in version 10.0 and later
  395. }
  396. function ATSFontIteratorRelease(var ioIterator: ATSFontIterator): OSStatus; external name '_ATSFontIteratorRelease';
  397. {
  398. * ATSFontIteratorReset()
  399. *
  400. * Availability:
  401. * Non-Carbon CFM: not available
  402. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  403. * Mac OS X: in version 10.0 and later
  404. }
  405. function ATSFontIteratorReset(iContext: ATSFontContext; iFilter: {Const}ATSFontFilterPtr; iRefCon: UnivPtr; iOptions: ATSOptionFlags; var ioIterator: ATSFontIterator): OSStatus; external name '_ATSFontIteratorReset';
  406. {
  407. * ATSFontIteratorNext()
  408. *
  409. * Availability:
  410. * Non-Carbon CFM: not available
  411. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  412. * Mac OS X: in version 10.0 and later
  413. }
  414. function ATSFontIteratorNext(iIterator: ATSFontIterator; var oFont: ATSFontRef): OSStatus; external name '_ATSFontIteratorNext';
  415. {
  416. * ATSFontFindFromName()
  417. *
  418. * Availability:
  419. * Non-Carbon CFM: not available
  420. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  421. * Mac OS X: in version 10.0 and later
  422. }
  423. function ATSFontFindFromName(iName: CFStringRef; iOptions: ATSOptionFlags): ATSFontRef; external name '_ATSFontFindFromName';
  424. {
  425. * ATSFontFindFromPostScriptName()
  426. *
  427. * Availability:
  428. * Non-Carbon CFM: not available
  429. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  430. * Mac OS X: in version 10.0 and later
  431. }
  432. function ATSFontFindFromPostScriptName(iName: CFStringRef; iOptions: ATSOptionFlags): ATSFontRef; external name '_ATSFontFindFromPostScriptName';
  433. {
  434. * ATSFontFindFromContainer()
  435. *
  436. * Availability:
  437. * Non-Carbon CFM: not available
  438. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  439. * Mac OS X: in version 10.0 and later
  440. }
  441. function ATSFontFindFromContainer(iContainer: ATSFontContainerRef; iOptions: ATSOptionFlags; iCount: ItemCount; var ioArray: ATSFontRef; var oCount: ItemCount): OSStatus; external name '_ATSFontFindFromContainer';
  442. {
  443. * ATSFontGetGeneration()
  444. *
  445. * Availability:
  446. * Non-Carbon CFM: not available
  447. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  448. * Mac OS X: in version 10.0 and later
  449. }
  450. function ATSFontGetGeneration(iFont: ATSFontRef): ATSGeneration; external name '_ATSFontGetGeneration';
  451. {
  452. * ATSFontGetName()
  453. *
  454. * Availability:
  455. * Non-Carbon CFM: not available
  456. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  457. * Mac OS X: in version 10.0 and later
  458. }
  459. function ATSFontGetName(iFont: ATSFontRef; iOptions: ATSOptionFlags; var oName: CFStringRef): OSStatus; external name '_ATSFontGetName';
  460. {
  461. * ATSFontGetPostScriptName()
  462. *
  463. * Availability:
  464. * Non-Carbon CFM: not available
  465. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  466. * Mac OS X: in version 10.0 and later
  467. }
  468. function ATSFontGetPostScriptName(iFont: ATSFontRef; iOptions: ATSOptionFlags; var oName: CFStringRef): OSStatus; external name '_ATSFontGetPostScriptName';
  469. {
  470. * ATSFontGetTableDirectory()
  471. *
  472. * Availability:
  473. * Non-Carbon CFM: not available
  474. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  475. * Mac OS X: in version 10.0 and later
  476. }
  477. function ATSFontGetTableDirectory(iFont: ATSFontRef; iBufferSize: ByteCount; ioBuffer: UnivPtr; oSize: ByteCountPtr): OSStatus; external name '_ATSFontGetTableDirectory';
  478. {
  479. * ATSFontGetTable()
  480. *
  481. * Availability:
  482. * Non-Carbon CFM: not available
  483. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  484. * Mac OS X: in version 10.0 and later
  485. }
  486. function ATSFontGetTable(iFont: ATSFontRef; iTag: FourCharCode; iOffset: ByteOffset; iBufferSize: ByteCount; ioBuffer: UnivPtr; oSize: ByteCountPtr): OSStatus; external name '_ATSFontGetTable';
  487. {
  488. * ATSFontGetHorizontalMetrics()
  489. *
  490. * Availability:
  491. * Non-Carbon CFM: not available
  492. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  493. * Mac OS X: in version 10.0 and later
  494. }
  495. function ATSFontGetHorizontalMetrics(iFont: ATSFontRef; iOptions: ATSOptionFlags; var oMetrics: ATSFontMetrics): OSStatus; external name '_ATSFontGetHorizontalMetrics';
  496. {
  497. * ATSFontGetVerticalMetrics()
  498. *
  499. * Availability:
  500. * Non-Carbon CFM: not available
  501. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  502. * Mac OS X: in version 10.0 and later
  503. }
  504. function ATSFontGetVerticalMetrics(iFont: ATSFontRef; iOptions: ATSOptionFlags; var oMetrics: ATSFontMetrics): OSStatus; external name '_ATSFontGetVerticalMetrics';
  505. { ----------------------------------------------------------------------------------------- }
  506. { Compatibiity }
  507. { ----------------------------------------------------------------------------------------- }
  508. {
  509. * ATSFontFamilyFindFromQuickDrawName()
  510. *
  511. * Availability:
  512. * Non-Carbon CFM: not available
  513. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  514. * Mac OS X: in version 10.0 and later
  515. }
  516. function ATSFontFamilyFindFromQuickDrawName(const (*var*) iName: Str255): ATSFontFamilyRef; external name '_ATSFontFamilyFindFromQuickDrawName';
  517. {
  518. * ATSFontFamilyGetQuickDrawName()
  519. *
  520. * Availability:
  521. * Non-Carbon CFM: not available
  522. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  523. * Mac OS X: in version 10.0 and later
  524. }
  525. function ATSFontFamilyGetQuickDrawName(iFamily: ATSFontFamilyRef; var oName: Str255): OSStatus; external name '_ATSFontFamilyGetQuickDrawName';
  526. {
  527. * ATSFontGetFileSpecification()
  528. *
  529. * Availability:
  530. * Non-Carbon CFM: not available
  531. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  532. * Mac OS X: in version 10.0 and later
  533. }
  534. function ATSFontGetFileSpecification(iFont: ATSFontRef; var oFile: FSSpec): OSStatus; external name '_ATSFontGetFileSpecification';
  535. {
  536. * ATSFontGetFontFamilyResource()
  537. *
  538. * Availability:
  539. * Non-Carbon CFM: not available
  540. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  541. * Mac OS X: in version 10.0 and later
  542. }
  543. function ATSFontGetFontFamilyResource(iFont: ATSFontRef; iBufferSize: ByteCount; ioBuffer: UnivPtr; oSize: ByteCountPtr): OSStatus; external name '_ATSFontGetFontFamilyResource';
  544. { ----------------------------------------------------------------------------------------- }
  545. { Notification }
  546. { ----------------------------------------------------------------------------------------- }
  547. {
  548. * ATSFontNotify()
  549. *
  550. * Summary:
  551. * Used to alert ATS that an action which may require notification
  552. * to clients has occurred.
  553. *
  554. * Parameters:
  555. *
  556. * action:
  557. * Action that should be taken by the ATS Server
  558. *
  559. * info:
  560. * Any required or optional information that may be required by
  561. * the action taken. can be NULL
  562. *
  563. * Result:
  564. * noErr Action successfully reported paramErr Invalid action passed
  565. *
  566. * Availability:
  567. * Mac OS X: in version 10.2 and later in ApplicationServices.framework
  568. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  569. * Non-Carbon CFM: not available
  570. }
  571. // AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
  572. function ATSFontNotify( action: ATSFontNotifyAction; info: UnivPtr ): OSStatus; external name '_ATSFontNotify';
  573. {
  574. * ATSFontNotificationSubscribe()
  575. *
  576. * Summary:
  577. * Ask the ATS System to notify caller when certain events have
  578. * occurred. Note that your application must have a CFRunLoop in
  579. * order to receive notifications. Any Appkit or Carbon event loop
  580. * based application will have one by default.
  581. *
  582. * Parameters:
  583. *
  584. * callback:
  585. * Function that will be called by the ATS system whenever an
  586. * event of interest takes place.
  587. *
  588. * options:
  589. * Set the wanted ATSFontNotificationOptions to modify the default
  590. * behavior of ATS Notifications.
  591. *
  592. * iRefcon:
  593. * User data/state which will be passed to the callback funtion. can be NULL
  594. *
  595. * oNotificationRef:
  596. * You may use this reference to un-subscribe to this notification. can be NULL
  597. *
  598. * Result:
  599. * noErr Subscribed successfully paramErr NULL callback was passed.
  600. * memFullErr Could not allocate enough memory for internal data
  601. * structures.
  602. *
  603. * Availability:
  604. * Mac OS X: in version 10.2 and later in ApplicationServices.framework
  605. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  606. * Non-Carbon CFM: not available
  607. }
  608. // AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
  609. function ATSFontNotificationSubscribe( callback: ATSNotificationCallback; options: ATSFontNotifyOption; iRefcon: UnivPtr; oNotificationRef: ATSFontNotificationRefPtr ): OSStatus; external name '_ATSFontNotificationSubscribe';
  610. {
  611. * ATSFontNotificationUnsubscribe()
  612. *
  613. * Summary:
  614. * Release subscription and stop receiving notifications for a given
  615. * reference.
  616. *
  617. * Parameters:
  618. *
  619. * notificationRef:
  620. * Notification reference for which you want to stop receiving
  621. * notifications. Note, if more than one notification has been
  622. * requested of ATS, you will still receive notifications on those
  623. * requests.
  624. *
  625. * Result:
  626. * noErr Unsubscribed successfully paramErr NULL/invalid
  627. * notificationRef passed
  628. *
  629. * Availability:
  630. * Mac OS X: in version 10.2 and later in ApplicationServices.framework
  631. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  632. * Non-Carbon CFM: not available
  633. }
  634. // AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
  635. function ATSFontNotificationUnsubscribe( notificationRef: ATSFontNotificationRef ): OSStatus; external name '_ATSFontNotificationUnsubscribe';
  636. { ----------------------------------------------------------------------------------------- }
  637. { Font query message hooks }
  638. { ----------------------------------------------------------------------------------------- }
  639. {
  640. * ATSFontQuerySourceContext
  641. *
  642. * Summary:
  643. * A parameter block for client information to be retained by ATS
  644. * and passed back to an ATSFontQueryCallback function.
  645. }
  646. type
  647. ATSFontQuerySourceContext = record
  648. {
  649. * A 32-bit unsigned integer that indicates the version of this
  650. * structure. This should be set to 0.
  651. }
  652. version: UInt32;
  653. {
  654. * A pointer-sized client datum that should be passed back to an
  655. * ATSFontQueryCallback function.
  656. }
  657. refCon: Ptr;
  658. {
  659. * The callback used to add a retain to the refCon.
  660. }
  661. retain: CFAllocatorRetainCallBack;
  662. {
  663. * The callback used to remove a retain to the refCon.
  664. }
  665. release: CFAllocatorReleaseCallBack;
  666. end;
  667. ATSFontQuerySourceContextPtr = ^ATSFontQuerySourceContext;
  668. {
  669. * ATSFontQueryMessageID
  670. *
  671. * Discussion:
  672. * Constants for ATS font query message types.
  673. }
  674. type
  675. ATSFontQueryMessageID = SInt32;
  676. const
  677. {
  678. * The message ID for a font request query. The data for a message
  679. * with this ID is a flattened CFDictionaryRef with keys and values
  680. * as decribed below. A query dictionary may have any or all of these
  681. * entries.
  682. }
  683. kATSQueryActivateFontMessage = $61747361 (* 'atsa' *);
  684. {
  685. * ATSFontQueryCallback
  686. *
  687. * Summary:
  688. * Callback for receiving font-related queries from ATS.
  689. *
  690. * Parameters:
  691. *
  692. * msgid:
  693. * An ATSFontQueryMessageID that identifies the message type.
  694. *
  695. * data:
  696. * A CFPropertyListRef that represents the query. The content is
  697. * message type-specific.
  698. *
  699. * refCon:
  700. * A pointer-sized client datum that was optionally provided to
  701. * ATSCreateFontQueryRunLoopSource.
  702. *
  703. * Result:
  704. * A CFPropertyListRef that represents the message type-specific
  705. * response to the query. May be NULL.
  706. }
  707. type ATSFontQueryCallback = function( msgid: ATSFontQueryMessageID; data: CFPropertyListRef; refCon: UnivPtr ): CFPropertyListRef;
  708. {
  709. * ATSCreateFontQueryRunLoopSource()
  710. *
  711. * Summary:
  712. * Creates a CFRunLoopSourceRef that will be used to convey font
  713. * queries from ATS.
  714. *
  715. * Parameters:
  716. *
  717. * queryOrder:
  718. * A CFIndex that specifies the priority of this query receiver
  719. * relative to others. When ATS makes a font query, it will send
  720. * the query to each receiver in priority order, from highest to
  721. * lowest. "Normal" priority is 0.
  722. *
  723. * sourceOrder:
  724. * The order of the created run loop source.
  725. *
  726. * callout:
  727. * A function pointer of type ATSFontQueryCallback that will be
  728. * called to process a font query.
  729. *
  730. * context:
  731. * An ATSFontQuerySourceContext parameter block that provides a
  732. * pointer-sized client datum which will be retained by ATS and
  733. * passed to the callout function. May be NULL.
  734. *
  735. * Result:
  736. * A CFRunLoopSourceRef. To stop receiving queries, invalidate this
  737. * run loop source.
  738. *
  739. * Availability:
  740. * Mac OS X: in version 10.2 and later in ApplicationServices.framework
  741. * CarbonLib: not available
  742. * Non-Carbon CFM: not available
  743. }
  744. // AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
  745. function ATSCreateFontQueryRunLoopSource( queryOrder: CFIndex; sourceOrder: CFIndex; callout: ATSFontQueryCallback; context: ATSFontQuerySourceContextPtr ): CFRunLoopSourceRef; external name '_ATSCreateFontQueryRunLoopSource';
  746. { ----------------------------------------------------------------------------------------- }
  747. { Font request query message content }
  748. { ----------------------------------------------------------------------------------------- }
  749. { Keys in a font request query dictionary. }
  750. { These keys appear in the dictionary for a kATSQueryActivateFontMessage query. }
  751. //const
  752. {
  753. * kATSQueryClientPID
  754. *
  755. * Discussion:
  756. * The process ID of the application making the query. The
  757. * corresponding value is a CFNumberRef that contains a pid_t.
  758. }
  759. {$ifc USE_CFSTR_CONSTANT_MACROS}
  760. {$definec kATSQueryClientPID CFSTRP('ATS client pid')}
  761. {$endc}
  762. {
  763. * kATSQueryQDFamilyName
  764. *
  765. * Discussion:
  766. * The Quickdraw-style family name of the font being requested, e.g.
  767. * the name passed to GetFNum. The corresponding value is a
  768. * CFStringRef.
  769. }
  770. {$ifc USE_CFSTR_CONSTANT_MACROS}
  771. {$definec kATSQueryQDFamilyName CFSTRP('font family name')}
  772. {$endc}
  773. {
  774. * kATSQueryFontName
  775. *
  776. * Discussion:
  777. * The name of the font being requested. The corresponding value is
  778. * a CFStringRef suitable as an argument to ATSFontFindFromName().
  779. * This should match a candidate font's unique or full name.
  780. }
  781. {$ifc USE_CFSTR_CONSTANT_MACROS}
  782. {$definec kATSQueryFontName CFSTRP('font name')}
  783. {$endc}
  784. {
  785. * kATSQueryFontPostScriptName
  786. *
  787. * Discussion:
  788. * The PostScript name of the font being requested. The
  789. * corresponding value is a CFStringRef suitable as an argument to
  790. * ATSFontFindFromPostScriptName(). This should match either the
  791. * PostScript name derived from the font's FOND resource or its sfnt
  792. * name table, with preference given to the FOND PostScript name.
  793. }
  794. {$ifc USE_CFSTR_CONSTANT_MACROS}
  795. {$definec kATSQueryFontPostScriptName CFSTRP('font PS name')}
  796. {$endc}
  797. {
  798. * kATSQueryFontNameTableEntries
  799. *
  800. * Discussion:
  801. * A descriptor for sfnt name table entries that the requested font
  802. * must have. The corresponding value is a CFArrayRef of
  803. * CFDictionaryRefs that describe name table entries. A font must
  804. * have all of the specified entries to be considered a match.
  805. }
  806. {$ifc USE_CFSTR_CONSTANT_MACROS}
  807. {$definec kATSQueryFontNameTableEntries CFSTRP('font name table entries')}
  808. {$endc}
  809. { Keys in a font raw name descriptor dictionary. }
  810. {
  811. * kATSFontNameTableCode
  812. *
  813. * Discussion:
  814. * The font name's name code. The corresponding value is a
  815. * CFNumberRef. If missing, assume kFontNoNameCode.
  816. }
  817. {$ifc USE_CFSTR_CONSTANT_MACROS}
  818. {$definec kATSFontNameTableCode CFSTRP('font name code')}
  819. {$endc}
  820. {
  821. * kATSFontNameTablePlatform
  822. *
  823. * Discussion:
  824. * The font name's platform code. The corresponding value is a
  825. * CFNumberRef. If missing, assume kFontNoPlatformCode.
  826. }
  827. {$ifc USE_CFSTR_CONSTANT_MACROS}
  828. {$definec kATSFontNameTablePlatform CFSTRP('font platform code')}
  829. {$endc}
  830. {
  831. * kATSFontNameTableScript
  832. *
  833. * Discussion:
  834. * The font name's script code. The corresponding value is a
  835. * CFNumberRef. If missing, assume kFontNoScriptCode.
  836. }
  837. {$ifc USE_CFSTR_CONSTANT_MACROS}
  838. {$definec kATSFontNameTableScript CFSTRP('font script code')}
  839. {$endc}
  840. {
  841. * kATSFontNameTableLanguage
  842. *
  843. * Discussion:
  844. * The font name's language code. The corresponding value is a
  845. * CFNumberRef. If missing, assume kFontNoLanguageCode.
  846. }
  847. {$ifc USE_CFSTR_CONSTANT_MACROS}
  848. {$definec kATSFontNameTableLanguage CFSTRP('font language code')}
  849. {$endc}
  850. {
  851. * kATSFontNameTableBytes
  852. *
  853. * Discussion:
  854. * The raw bytes of the font name. The corresponding value is a
  855. * CFDataRef that contains the raw name bytes.
  856. }
  857. {$ifc USE_CFSTR_CONSTANT_MACROS}
  858. {$definec kATSFontNameTableBytes CFSTRP('font name table bytes')}
  859. {$endc}
  860. {$ALIGN MAC68K}
  861. end.