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.

1091 lines
31 KiB

  1. /*
  2. File: ATSFont.h
  3. Contains: Public interface to the font access and data management functions of ATS.
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (C) 2000-2002 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 __ATSFONT__
  11. #define __ATSFONT__
  12. #ifndef __MACTYPES__
  13. #include <MacTypes.h>
  14. #endif
  15. #ifndef __CFSTRING__
  16. #include <CFString.h>
  17. #endif
  18. #ifndef __CFMESSAGEPORT__
  19. #include <CFMessagePort.h>
  20. #endif
  21. #ifndef __FILES__
  22. #include <Files.h>
  23. #endif
  24. #ifndef __TEXTCOMMON__
  25. #include <TextCommon.h>
  26. #endif
  27. #ifndef __ATSTYPES__
  28. #include <ATSTypes.h>
  29. #endif
  30. #ifndef __SFNTTYPES__
  31. #include <SFNTTypes.h>
  32. #endif
  33. #if PRAGMA_ONCE
  34. #pragma once
  35. #endif
  36. #ifdef __cplusplus
  37. extern "C" {
  38. #endif
  39. #if PRAGMA_IMPORT
  40. #pragma import on
  41. #endif
  42. #if PRAGMA_STRUCT_ALIGN
  43. #pragma options align=mac68k
  44. #elif PRAGMA_STRUCT_PACKPUSH
  45. #pragma pack(push, 2)
  46. #elif PRAGMA_STRUCT_PACK
  47. #pragma pack(2)
  48. #endif
  49. #if PRAGMA_ENUM_ALWAYSINT
  50. #if defined(__fourbyteints__) && !__fourbyteints__
  51. #define __ATSFONT__RESTORE_TWOBYTEINTS
  52. #pragma fourbyteints on
  53. #endif
  54. #pragma enumsalwaysint on
  55. #elif PRAGMA_ENUM_OPTIONS
  56. #pragma option enum=int
  57. #elif PRAGMA_ENUM_PACK
  58. #if __option(pack_enums)
  59. #define __ATSFONT__RESTORE_PACKED_ENUMS
  60. #pragma options(!pack_enums)
  61. #endif
  62. #endif
  63. enum {
  64. kATSOptionFlagsDefault = kNilOptions,
  65. kATSOptionFlagsComposeFontPostScriptName = 1 << 0, /* ATSFontGetPostScriptName */
  66. kATSOptionFlagsUseDataForkAsResourceFork = 1 << 8, /* ATSFontActivateFromFileSpecification */
  67. kATSOptionFlagsUseResourceFork = 2 << 8,
  68. kATSOptionFlagsUseDataFork = 3 << 8
  69. };
  70. enum {
  71. kATSIterationCompleted = -980L,
  72. kATSInvalidFontFamilyAccess = -981L,
  73. kATSInvalidFontAccess = -982L,
  74. kATSIterationScopeModified = -983L,
  75. kATSInvalidFontTableAccess = -984L,
  76. kATSInvalidFontContainerAccess = -985L
  77. };
  78. /* Activation Option Flags */
  79. typedef UInt32 ATSFontContext;
  80. enum {
  81. kATSFontContextUnspecified = 0,
  82. kATSFontContextGlobal = 1,
  83. kATSFontContextLocal = 2
  84. };
  85. enum {
  86. kATSOptionFlagsDoNotNotify = 0x00000001 << 8, /* Do not notify after global activation/deactivation */
  87. kATSOptionFlagsIterationScopeMask = 0x00000007 << 12, /* Mask option bits 12-14 for iteration scopes */
  88. kATSOptionFlagsDefaultScope = 0x00000000 << 12,
  89. kATSOptionFlagsUnRestrictedScope = 0x00000001 << 12,
  90. kATSOptionFlagsRestrictedScope = 0x00000002 << 12,
  91. kATSOptionFlagsProcessSubdirectories = 0x00000001 << 6
  92. };
  93. /* Iteration Option Flags */
  94. enum {
  95. kATSOptionFlagsIterateByPrecedenceMask = 0x00000001 << 5
  96. };
  97. typedef UInt32 ATSFontFormat;
  98. enum {
  99. kATSFontFormatUnspecified = 0
  100. };
  101. typedef CALLBACK_API_C( OSStatus , ATSFontFamilyApplierFunction )(ATSFontFamilyRef iFamily, void *iRefCon);
  102. typedef CALLBACK_API_C( OSStatus , ATSFontApplierFunction )(ATSFontRef iFont, void *iRefCon);
  103. typedef struct ATSFontFamilyIterator_* ATSFontFamilyIterator;
  104. typedef struct ATSFontIterator_* ATSFontIterator;
  105. enum {
  106. kATSFontFilterCurrentVersion = 0
  107. };
  108. enum ATSFontFilterSelector {
  109. kATSFontFilterSelectorUnspecified = 0,
  110. kATSFontFilterSelectorGeneration = 3,
  111. kATSFontFilterSelectorFontFamily = 7,
  112. kATSFontFilterSelectorFontFamilyApplierFunction = 8,
  113. kATSFontFilterSelectorFontApplierFunction = 9
  114. };
  115. typedef enum ATSFontFilterSelector ATSFontFilterSelector;
  116. struct ATSFontFilter {
  117. UInt32 version;
  118. ATSFontFilterSelector filterSelector;
  119. union {
  120. ATSGeneration generationFilter;
  121. ATSFontFamilyRef fontFamilyFilter;
  122. ATSFontFamilyApplierFunction fontFamilyApplierFunctionFilter;
  123. ATSFontApplierFunction fontApplierFunctionFilter;
  124. } filter;
  125. };
  126. typedef struct ATSFontFilter ATSFontFilter;
  127. /* Notification related */
  128. typedef struct ATSFontNotificationRef_* ATSFontNotificationRef;
  129. typedef struct ATSFontNotificationInfoRef_* ATSFontNotificationInfoRef;
  130. /*
  131. * ATSFontNotifyOption
  132. *
  133. * Discussion:
  134. * Options used with ATSFontNotificationSubscribe. Any of the
  135. * options that follow may be used together in order to alter the
  136. * default behavior of ATS notifications.
  137. */
  138. enum ATSFontNotifyOption {
  139. /*
  140. * Default behavior of ATSFontNotificationSubscribe.
  141. */
  142. kATSFontNotifyOptionDefault = 0,
  143. /*
  144. * Normally applications will only receive ATS notifications while in
  145. * the foreground. If suspended, the notification will be delivered
  146. * when then application comes to the foreground. This is the
  147. * default. You should set this option if you are a server or tool
  148. * that performs font management functions and require immediate
  149. * notification when something changes.
  150. */
  151. kATSFontNotifyOptionReceiveWhileSuspended = 1L << 0
  152. };
  153. typedef enum ATSFontNotifyOption ATSFontNotifyOption;
  154. /*
  155. * ATSFontNotifyAction
  156. *
  157. * Discussion:
  158. * Used with ATSFontNotify. The following is a list of actions you
  159. * might wish the ATS server to perform and notify clients if
  160. * appropriate.
  161. */
  162. enum ATSFontNotifyAction {
  163. /*
  164. * Used after a batch (de)activation of fonts occurs. Typically the
  165. * caller has exercised multiple global (De)Activation calls with the
  166. * kATSOptionFlagsDoNotNotify set. Once all calls are completed, one
  167. * may use ATSFontNotify with this action to ask ATS to notify all
  168. * clients.
  169. */
  170. kATSFontNotifyActionFontsChanged = 1,
  171. /*
  172. * The ATS system with the help of the Finder keeps track of changes
  173. * to any of the fonts directories ( System, Local, Network, User, &
  174. * Classic). However, one may wish to add/remove fonts to these
  175. * locations programmatically. This action is used to let ATS
  176. * server to rescan these directories and post notifications if
  177. * necessary.
  178. */
  179. kATSFontNotifyActionDirectoriesChanged = 2
  180. };
  181. typedef enum ATSFontNotifyAction ATSFontNotifyAction;
  182. /*
  183. * ATSNotificationCallback
  184. *
  185. * Discussion:
  186. * Callback delivered for ATS notifications.
  187. *
  188. * Parameters:
  189. *
  190. * info:
  191. * Parameter is placed here for future improvements. Initially
  192. * the contents of this parameter will be NULL.
  193. *
  194. * refCon:
  195. * User data/state to be supplied to callback function
  196. */
  197. typedef CALLBACK_API_C( void , ATSNotificationCallback )(ATSFontNotificationInfoRef info, void *refCon);
  198. /* ----------------------------------------------------------------------------------------- */
  199. /* Font container */
  200. /* ----------------------------------------------------------------------------------------- */
  201. /*
  202. * ATSGetGeneration()
  203. *
  204. * Availability:
  205. * Non-Carbon CFM: not available
  206. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  207. * Mac OS X: in version 10.0 and later
  208. */
  209. EXTERN_API_C( ATSGeneration )
  210. ATSGetGeneration(void);
  211. /*
  212. * ATSFontActivateFromFileSpecification()
  213. *
  214. * Availability:
  215. * Non-Carbon CFM: not available
  216. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  217. * Mac OS X: in version 10.0 and later
  218. */
  219. EXTERN_API_C( OSStatus )
  220. ATSFontActivateFromFileSpecification(
  221. const FSSpec * iFile,
  222. ATSFontContext iContext,
  223. ATSFontFormat iFormat,
  224. void * iReserved,
  225. ATSOptionFlags iOptions,
  226. ATSFontContainerRef * oContainer);
  227. /*
  228. * ATSFontActivateFromMemory()
  229. *
  230. * Availability:
  231. * Non-Carbon CFM: not available
  232. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  233. * Mac OS X: in version 10.0 and later
  234. */
  235. EXTERN_API_C( OSStatus )
  236. ATSFontActivateFromMemory(
  237. LogicalAddress iData,
  238. ByteCount iLength,
  239. ATSFontContext iContext,
  240. ATSFontFormat iFormat,
  241. void * iReserved,
  242. ATSOptionFlags iOptions,
  243. ATSFontContainerRef * oContainer);
  244. /*
  245. * ATSFontDeactivate()
  246. *
  247. * Availability:
  248. * Non-Carbon CFM: not available
  249. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  250. * Mac OS X: in version 10.0 and later
  251. */
  252. EXTERN_API_C( OSStatus )
  253. ATSFontDeactivate(
  254. ATSFontContainerRef iContainer,
  255. void * iRefCon,
  256. ATSOptionFlags iOptions);
  257. /* ----------------------------------------------------------------------------------------- */
  258. /* Font family */
  259. /* ----------------------------------------------------------------------------------------- */
  260. /*
  261. * ATSFontFamilyApplyFunction()
  262. *
  263. * Availability:
  264. * Non-Carbon CFM: not available
  265. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  266. * Mac OS X: in version 10.0 and later
  267. */
  268. EXTERN_API_C( OSStatus )
  269. ATSFontFamilyApplyFunction(
  270. ATSFontFamilyApplierFunction iFunction,
  271. void * iRefCon);
  272. /*
  273. * ATSFontFamilyIteratorCreate()
  274. *
  275. * Availability:
  276. * Non-Carbon CFM: not available
  277. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  278. * Mac OS X: in version 10.0 and later
  279. */
  280. EXTERN_API_C( OSStatus )
  281. ATSFontFamilyIteratorCreate(
  282. ATSFontContext iContext,
  283. const ATSFontFilter * iFilter, /* can be NULL */
  284. void * iRefCon,
  285. ATSOptionFlags iOptions,
  286. ATSFontFamilyIterator * ioIterator);
  287. /*
  288. * ATSFontFamilyIteratorRelease()
  289. *
  290. * Availability:
  291. * Non-Carbon CFM: not available
  292. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  293. * Mac OS X: in version 10.0 and later
  294. */
  295. EXTERN_API_C( OSStatus )
  296. ATSFontFamilyIteratorRelease(ATSFontFamilyIterator * ioIterator);
  297. /*
  298. * ATSFontFamilyIteratorReset()
  299. *
  300. * Availability:
  301. * Non-Carbon CFM: not available
  302. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  303. * Mac OS X: in version 10.0 and later
  304. */
  305. EXTERN_API_C( OSStatus )
  306. ATSFontFamilyIteratorReset(
  307. ATSFontContext iContext,
  308. const ATSFontFilter * iFilter, /* can be NULL */
  309. void * iRefCon,
  310. ATSOptionFlags iOptions,
  311. ATSFontFamilyIterator * ioIterator);
  312. /*
  313. * ATSFontFamilyIteratorNext()
  314. *
  315. * Availability:
  316. * Non-Carbon CFM: not available
  317. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  318. * Mac OS X: in version 10.0 and later
  319. */
  320. EXTERN_API_C( OSStatus )
  321. ATSFontFamilyIteratorNext(
  322. ATSFontFamilyIterator iIterator,
  323. ATSFontFamilyRef * oFamily);
  324. /*
  325. * ATSFontFamilyFindFromName()
  326. *
  327. * Availability:
  328. * Non-Carbon CFM: not available
  329. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  330. * Mac OS X: in version 10.0 and later
  331. */
  332. EXTERN_API_C( ATSFontFamilyRef )
  333. ATSFontFamilyFindFromName(
  334. CFStringRef iName,
  335. ATSOptionFlags iOptions);
  336. /*
  337. * ATSFontFamilyGetGeneration()
  338. *
  339. * Availability:
  340. * Non-Carbon CFM: not available
  341. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  342. * Mac OS X: in version 10.0 and later
  343. */
  344. EXTERN_API_C( ATSGeneration )
  345. ATSFontFamilyGetGeneration(ATSFontFamilyRef iFamily);
  346. /*
  347. * ATSFontFamilyGetName()
  348. *
  349. * Availability:
  350. * Non-Carbon CFM: not available
  351. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  352. * Mac OS X: in version 10.0 and later
  353. */
  354. EXTERN_API_C( OSStatus )
  355. ATSFontFamilyGetName(
  356. ATSFontFamilyRef iFamily,
  357. ATSOptionFlags iOptions,
  358. CFStringRef * oName);
  359. /*
  360. * ATSFontFamilyGetEncoding()
  361. *
  362. * Availability:
  363. * Non-Carbon CFM: not available
  364. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  365. * Mac OS X: in version 10.0 and later
  366. */
  367. EXTERN_API_C( TextEncoding )
  368. ATSFontFamilyGetEncoding(ATSFontFamilyRef iFamily);
  369. /* ----------------------------------------------------------------------------------------- */
  370. /* Font */
  371. /* ----------------------------------------------------------------------------------------- */
  372. /*
  373. * ATSFontApplyFunction()
  374. *
  375. * Availability:
  376. * Non-Carbon CFM: not available
  377. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  378. * Mac OS X: in version 10.0 and later
  379. */
  380. EXTERN_API_C( OSStatus )
  381. ATSFontApplyFunction(
  382. ATSFontApplierFunction iFunction,
  383. void * iRefCon);
  384. /*
  385. * ATSFontIteratorCreate()
  386. *
  387. * Availability:
  388. * Non-Carbon CFM: not available
  389. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  390. * Mac OS X: in version 10.0 and later
  391. */
  392. EXTERN_API_C( OSStatus )
  393. ATSFontIteratorCreate(
  394. ATSFontContext iContext,
  395. const ATSFontFilter * iFilter, /* can be NULL */
  396. void * iRefCon,
  397. ATSOptionFlags iOptions,
  398. ATSFontIterator * ioIterator);
  399. /*
  400. * ATSFontIteratorRelease()
  401. *
  402. * Availability:
  403. * Non-Carbon CFM: not available
  404. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  405. * Mac OS X: in version 10.0 and later
  406. */
  407. EXTERN_API_C( OSStatus )
  408. ATSFontIteratorRelease(ATSFontIterator * ioIterator);
  409. /*
  410. * ATSFontIteratorReset()
  411. *
  412. * Availability:
  413. * Non-Carbon CFM: not available
  414. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  415. * Mac OS X: in version 10.0 and later
  416. */
  417. EXTERN_API_C( OSStatus )
  418. ATSFontIteratorReset(
  419. ATSFontContext iContext,
  420. const ATSFontFilter * iFilter, /* can be NULL */
  421. void * iRefCon,
  422. ATSOptionFlags iOptions,
  423. ATSFontIterator * ioIterator);
  424. /*
  425. * ATSFontIteratorNext()
  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. EXTERN_API_C( OSStatus )
  433. ATSFontIteratorNext(
  434. ATSFontIterator iIterator,
  435. ATSFontRef * oFont);
  436. /*
  437. * ATSFontFindFromName()
  438. *
  439. * Availability:
  440. * Non-Carbon CFM: not available
  441. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  442. * Mac OS X: in version 10.0 and later
  443. */
  444. EXTERN_API_C( ATSFontRef )
  445. ATSFontFindFromName(
  446. CFStringRef iName,
  447. ATSOptionFlags iOptions);
  448. /*
  449. * ATSFontFindFromPostScriptName()
  450. *
  451. * Availability:
  452. * Non-Carbon CFM: not available
  453. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  454. * Mac OS X: in version 10.0 and later
  455. */
  456. EXTERN_API_C( ATSFontRef )
  457. ATSFontFindFromPostScriptName(
  458. CFStringRef iName,
  459. ATSOptionFlags iOptions);
  460. /*
  461. * ATSFontFindFromContainer()
  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. EXTERN_API_C( OSStatus )
  469. ATSFontFindFromContainer(
  470. ATSFontContainerRef iContainer,
  471. ATSOptionFlags iOptions,
  472. ItemCount iCount,
  473. ATSFontRef ioArray[],
  474. ItemCount * oCount);
  475. /*
  476. * ATSFontGetGeneration()
  477. *
  478. * Availability:
  479. * Non-Carbon CFM: not available
  480. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  481. * Mac OS X: in version 10.0 and later
  482. */
  483. EXTERN_API_C( ATSGeneration )
  484. ATSFontGetGeneration(ATSFontRef iFont);
  485. /*
  486. * ATSFontGetName()
  487. *
  488. * Availability:
  489. * Non-Carbon CFM: not available
  490. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  491. * Mac OS X: in version 10.0 and later
  492. */
  493. EXTERN_API_C( OSStatus )
  494. ATSFontGetName(
  495. ATSFontRef iFont,
  496. ATSOptionFlags iOptions,
  497. CFStringRef * oName);
  498. /*
  499. * ATSFontGetPostScriptName()
  500. *
  501. * Availability:
  502. * Non-Carbon CFM: not available
  503. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  504. * Mac OS X: in version 10.0 and later
  505. */
  506. EXTERN_API_C( OSStatus )
  507. ATSFontGetPostScriptName(
  508. ATSFontRef iFont,
  509. ATSOptionFlags iOptions,
  510. CFStringRef * oName);
  511. /*
  512. * ATSFontGetTableDirectory()
  513. *
  514. * Availability:
  515. * Non-Carbon CFM: not available
  516. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  517. * Mac OS X: in version 10.0 and later
  518. */
  519. EXTERN_API_C( OSStatus )
  520. ATSFontGetTableDirectory(
  521. ATSFontRef iFont,
  522. ByteCount iBufferSize,
  523. void * ioBuffer,
  524. ByteCount * oSize); /* can be NULL */
  525. /*
  526. * ATSFontGetTable()
  527. *
  528. * Availability:
  529. * Non-Carbon CFM: not available
  530. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  531. * Mac OS X: in version 10.0 and later
  532. */
  533. EXTERN_API_C( OSStatus )
  534. ATSFontGetTable(
  535. ATSFontRef iFont,
  536. FourCharCode iTag,
  537. ByteOffset iOffset,
  538. ByteCount iBufferSize,
  539. void * ioBuffer,
  540. ByteCount * oSize); /* can be NULL */
  541. /*
  542. * ATSFontGetHorizontalMetrics()
  543. *
  544. * Availability:
  545. * Non-Carbon CFM: not available
  546. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  547. * Mac OS X: in version 10.0 and later
  548. */
  549. EXTERN_API_C( OSStatus )
  550. ATSFontGetHorizontalMetrics(
  551. ATSFontRef iFont,
  552. ATSOptionFlags iOptions,
  553. ATSFontMetrics * oMetrics);
  554. /*
  555. * ATSFontGetVerticalMetrics()
  556. *
  557. * Availability:
  558. * Non-Carbon CFM: not available
  559. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  560. * Mac OS X: in version 10.0 and later
  561. */
  562. EXTERN_API_C( OSStatus )
  563. ATSFontGetVerticalMetrics(
  564. ATSFontRef iFont,
  565. ATSOptionFlags iOptions,
  566. ATSFontMetrics * oMetrics);
  567. /* ----------------------------------------------------------------------------------------- */
  568. /* Compatibility */
  569. /* ----------------------------------------------------------------------------------------- */
  570. /*
  571. * ATSFontFamilyFindFromQuickDrawName()
  572. *
  573. * Availability:
  574. * Non-Carbon CFM: not available
  575. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  576. * Mac OS X: in version 10.0 and later
  577. */
  578. EXTERN_API_C( ATSFontFamilyRef )
  579. ATSFontFamilyFindFromQuickDrawName(ConstStr255Param iName);
  580. /*
  581. * ATSFontFamilyGetQuickDrawName()
  582. *
  583. * Availability:
  584. * Non-Carbon CFM: not available
  585. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  586. * Mac OS X: in version 10.0 and later
  587. */
  588. EXTERN_API_C( OSStatus )
  589. ATSFontFamilyGetQuickDrawName(
  590. ATSFontFamilyRef iFamily,
  591. Str255 oName);
  592. /*
  593. * ATSFontGetFileSpecification()
  594. *
  595. * Availability:
  596. * Non-Carbon CFM: not available
  597. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  598. * Mac OS X: in version 10.0 and later
  599. */
  600. EXTERN_API_C( OSStatus )
  601. ATSFontGetFileSpecification(
  602. ATSFontRef iFont,
  603. FSSpec * oFile);
  604. /*
  605. * ATSFontGetFontFamilyResource()
  606. *
  607. * Availability:
  608. * Non-Carbon CFM: not available
  609. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.0 and later
  610. * Mac OS X: in version 10.0 and later
  611. */
  612. EXTERN_API_C( OSStatus )
  613. ATSFontGetFontFamilyResource(
  614. ATSFontRef iFont,
  615. ByteCount iBufferSize,
  616. void * ioBuffer,
  617. ByteCount * oSize); /* can be NULL */
  618. /* ----------------------------------------------------------------------------------------- */
  619. /* Notification */
  620. /* ----------------------------------------------------------------------------------------- */
  621. /*
  622. * ATSFontNotify()
  623. *
  624. * Summary:
  625. * Used to alert ATS that an action which may require notification
  626. * to clients has occurred.
  627. *
  628. * Parameters:
  629. *
  630. * action:
  631. * Action that should be taken by the ATS Server
  632. *
  633. * info:
  634. * Any required or optional information that may be required by
  635. * the action taken.
  636. *
  637. * Result:
  638. * noErr Action successfully reported paramErr Invalid action passed
  639. *
  640. * Availability:
  641. * Non-Carbon CFM: not available
  642. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  643. * Mac OS X: in version 10.2 and later
  644. */
  645. EXTERN_API_C( OSStatus )
  646. ATSFontNotify(
  647. ATSFontNotifyAction action,
  648. void * info); /* can be NULL */
  649. /*
  650. * ATSFontNotificationSubscribe()
  651. *
  652. * Summary:
  653. * Ask the ATS System to notify caller when certain events have
  654. * occurred. Note that your application must have a CFRunLoop in
  655. * order to receive notifications. Any Appkit or Carbon event loop
  656. * based application will have one by default.
  657. *
  658. * Parameters:
  659. *
  660. * callback:
  661. * Function that will be called by the ATS system whenever an
  662. * event of interest takes place.
  663. *
  664. * options:
  665. * Set the wanted ATSFontNotificationOptions to modify the default
  666. * behavior of ATS Notifications.
  667. *
  668. * iRefcon:
  669. * User data/state which will be passed to the callback funtion
  670. *
  671. * oNotificationRef:
  672. * You may use this reference to un-subscribe to this notification.
  673. *
  674. * Result:
  675. * noErr Subscribed successfully paramErr NULL callback was passed.
  676. * memFullErr Could not allocate enough memory for internal data
  677. * structures.
  678. *
  679. * Availability:
  680. * Non-Carbon CFM: not available
  681. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  682. * Mac OS X: in version 10.2 and later
  683. */
  684. EXTERN_API_C( OSStatus )
  685. ATSFontNotificationSubscribe(
  686. ATSNotificationCallback callback,
  687. ATSFontNotifyOption options,
  688. void * iRefcon, /* can be NULL */
  689. ATSFontNotificationRef * oNotificationRef); /* can be NULL */
  690. /*
  691. * ATSFontNotificationUnsubscribe()
  692. *
  693. * Summary:
  694. * Release subscription and stop receiving notifications for a given
  695. * reference.
  696. *
  697. * Parameters:
  698. *
  699. * notificationRef:
  700. * Notification reference for which you want to stop receiving
  701. * notifications. Note, if more than one notification has been
  702. * requested of ATS, you will still receive notifications on those
  703. * requests.
  704. *
  705. * Result:
  706. * noErr Unsubscribed successfully paramErr NULL/invalid
  707. * notificationRef passed
  708. *
  709. * Availability:
  710. * Non-Carbon CFM: not available
  711. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  712. * Mac OS X: in version 10.2 and later
  713. */
  714. EXTERN_API_C( OSStatus )
  715. ATSFontNotificationUnsubscribe(ATSFontNotificationRef notificationRef);
  716. /* ----------------------------------------------------------------------------------------- */
  717. /* Font query message hooks */
  718. /* ----------------------------------------------------------------------------------------- */
  719. /*
  720. * ATSFontQuerySourceContext
  721. *
  722. * Summary:
  723. * A parameter block for client information to be retained by ATS
  724. * and passed back to an ATSFontQueryCallback function.
  725. */
  726. struct ATSFontQuerySourceContext {
  727. /*
  728. * A 32-bit unsigned integer that indicates the version of this
  729. * structure. This should be set to 0.
  730. */
  731. UInt32 version;
  732. /*
  733. * A pointer-sized client datum that should be passed back to an
  734. * ATSFontQueryCallback function.
  735. */
  736. void * refCon;
  737. /*
  738. * The callback used to add a retain to the refCon.
  739. */
  740. CFAllocatorRetainCallBack retain;
  741. /*
  742. * The callback used to remove a retain to the refCon.
  743. */
  744. CFAllocatorReleaseCallBack release;
  745. };
  746. typedef struct ATSFontQuerySourceContext ATSFontQuerySourceContext;
  747. /*
  748. * ATSFontQueryMessageID
  749. *
  750. * Discussion:
  751. * Constants for ATS font query message types.
  752. */
  753. enum ATSFontQueryMessageID {
  754. /*
  755. * The message ID for a font request query. The data for a message
  756. * with this ID is a flattened CFDictionaryRef with keys and values
  757. * as decribed below. A query dictionary may have any or all of these
  758. * entries.
  759. */
  760. kATSQueryActivateFontMessage = FOUR_CHAR_CODE('atsa')
  761. };
  762. typedef enum ATSFontQueryMessageID ATSFontQueryMessageID;
  763. /*
  764. * ATSFontQueryCallback
  765. *
  766. * Summary:
  767. * Callback for receiving font-related queries from ATS.
  768. *
  769. * Parameters:
  770. *
  771. * msgid:
  772. * An ATSFontQueryMessageID that identifies the message type.
  773. *
  774. * data:
  775. * A CFPropertyListRef that represents the query. The content is
  776. * message type-specific.
  777. *
  778. * refCon:
  779. * A pointer-sized client datum that was optionally provided to
  780. * ATSCreateFontQueryRunLoopSource.
  781. *
  782. * Result:
  783. * A CFPropertyListRef that represents the message type-specific
  784. * response to the query. May be NULL.
  785. */
  786. typedef CALLBACK_API_C( CFPropertyListRef , ATSFontQueryCallback )(ATSFontQueryMessageID msgid, CFPropertyListRef data, void *refCon);
  787. /*
  788. * ATSCreateFontQueryRunLoopSource()
  789. *
  790. * Summary:
  791. * Creates a CFRunLoopSourceRef that will be used to convey font
  792. * queries from ATS.
  793. *
  794. * Parameters:
  795. *
  796. * queryOrder:
  797. * A CFIndex that specifies the priority of this query receiver
  798. * relative to others. When ATS makes a font query, it will send
  799. * the query to each receiver in priority order, from highest to
  800. * lowest. "Normal" priority is 0.
  801. *
  802. * sourceOrder:
  803. * The order of the created run loop source.
  804. *
  805. * callout:
  806. * A function pointer of type ATSFontQueryCallback that will be
  807. * called to process a font query.
  808. *
  809. * context:
  810. * An ATSFontQuerySourceContext parameter block that provides a
  811. * pointer-sized client datum which will be retained by ATS and
  812. * passed to the callout function. May be NULL.
  813. *
  814. * Result:
  815. * A CFRunLoopSourceRef. To stop receiving queries, invalidate this
  816. * run loop source.
  817. *
  818. * Availability:
  819. * Non-Carbon CFM: not available
  820. * CarbonLib: not available
  821. * Mac OS X: in version 10.2 and later
  822. */
  823. EXTERN_API_C( CFRunLoopSourceRef )
  824. ATSCreateFontQueryRunLoopSource(
  825. CFIndex queryOrder,
  826. CFIndex sourceOrder,
  827. ATSFontQueryCallback callout,
  828. const ATSFontQuerySourceContext * context); /* can be NULL */
  829. /* ----------------------------------------------------------------------------------------- */
  830. /* Font request query message content */
  831. /* ----------------------------------------------------------------------------------------- */
  832. /* Keys in a font request query dictionary. */
  833. /* These keys appear in the dictionary for a kATSQueryActivateFontMessage query. */
  834. /*
  835. * kATSQueryClientPID
  836. *
  837. * Discussion:
  838. * The process ID of the application making the query. The
  839. * corresponding value is a CFNumberRef that contains a pid_t.
  840. */
  841. #define kATSQueryClientPID CFSTR("ATS client pid")
  842. /*
  843. * kATSQueryQDFamilyName
  844. *
  845. * Discussion:
  846. * The Quickdraw-style family name of the font being requested, e.g.
  847. * the name passed to GetFNum. The corresponding value is a
  848. * CFStringRef.
  849. */
  850. #define kATSQueryQDFamilyName CFSTR("font family name")
  851. /*
  852. * kATSQueryFontName
  853. *
  854. * Discussion:
  855. * The name of the font being requested. The corresponding value is
  856. * a CFStringRef suitable as an argument to ATSFontFindFromName().
  857. * This should match a candidate font's unique or full name.
  858. */
  859. #define kATSQueryFontName CFSTR("font name")
  860. /*
  861. * kATSQueryFontPostScriptName
  862. *
  863. * Discussion:
  864. * The PostScript name of the font being requested. The
  865. * corresponding value is a CFStringRef suitable as an argument to
  866. * ATSFontFindFromPostScriptName(). This should match either the
  867. * PostScript name derived from the font's FOND resource or its sfnt
  868. * name table, with preference given to the FOND PostScript name.
  869. */
  870. #define kATSQueryFontPostScriptName CFSTR("font PS name")
  871. /*
  872. * kATSQueryFontNameTableEntries
  873. *
  874. * Discussion:
  875. * A descriptor for sfnt name table entries that the requested font
  876. * must have. The corresponding value is a CFArrayRef of
  877. * CFDictionaryRefs that describe name table entries. A font must
  878. * have all of the specified entries to be considered a match.
  879. */
  880. #define kATSQueryFontNameTableEntries CFSTR("font name table entries")
  881. /* Keys in a font raw name descriptor dictionary. */
  882. /*
  883. * kATSFontNameTableCode
  884. *
  885. * Discussion:
  886. * The font name's name code. The corresponding value is a
  887. * CFNumberRef. If missing, assume kFontNoNameCode.
  888. */
  889. #define kATSFontNameTableCode CFSTR("font name code")
  890. /*
  891. * kATSFontNameTablePlatform
  892. *
  893. * Discussion:
  894. * The font name's platform code. The corresponding value is a
  895. * CFNumberRef. If missing, assume kFontNoPlatformCode.
  896. */
  897. #define kATSFontNameTablePlatform CFSTR("font platform code")
  898. /*
  899. * kATSFontNameTableScript
  900. *
  901. * Discussion:
  902. * The font name's script code. The corresponding value is a
  903. * CFNumberRef. If missing, assume kFontNoScriptCode.
  904. */
  905. #define kATSFontNameTableScript CFSTR("font script code")
  906. /*
  907. * kATSFontNameTableLanguage
  908. *
  909. * Discussion:
  910. * The font name's language code. The corresponding value is a
  911. * CFNumberRef. If missing, assume kFontNoLanguageCode.
  912. */
  913. #define kATSFontNameTableLanguage CFSTR("font language code")
  914. /*
  915. * kATSFontNameTableBytes
  916. *
  917. * Discussion:
  918. * The raw bytes of the font name. The corresponding value is a
  919. * CFDataRef that contains the raw name bytes.
  920. */
  921. #define kATSFontNameTableBytes CFSTR("font name table bytes")
  922. #if PRAGMA_ENUM_ALWAYSINT
  923. #pragma enumsalwaysint reset
  924. #ifdef __ATSFONT__RESTORE_TWOBYTEINTS
  925. #pragma fourbyteints off
  926. #endif
  927. #elif PRAGMA_ENUM_OPTIONS
  928. #pragma option enum=reset
  929. #elif defined(__ATSFONT__RESTORE_PACKED_ENUMS)
  930. #pragma options(pack_enums)
  931. #endif
  932. #if PRAGMA_STRUCT_ALIGN
  933. #pragma options align=reset
  934. #elif PRAGMA_STRUCT_PACKPUSH
  935. #pragma pack(pop)
  936. #elif PRAGMA_STRUCT_PACK
  937. #pragma pack()
  938. #endif
  939. #ifdef PRAGMA_IMPORT_OFF
  940. #pragma import off
  941. #elif PRAGMA_IMPORT
  942. #pragma import reset
  943. #endif
  944. #ifdef __cplusplus
  945. }
  946. #endif
  947. #endif /* __ATSFONT__ */