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.

603 lines
15 KiB

  1. /*
  2. File: FontSync.h
  3. Contains: Public interface for FontSync
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 1999-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 __MACTYPES__
  11. #include <MacTypes.h>
  12. #endif
  13. #ifndef __FILES__
  14. #include <Files.h>
  15. #endif
  16. #ifndef __MACERRORS__
  17. #include <MacErrors.h>
  18. #endif
  19. #ifndef __FONTS__
  20. #include <Fonts.h>
  21. #endif
  22. #ifndef __SFNTTYPES__
  23. #include <SFNTTypes.h>
  24. #endif
  25. #if PRAGMA_ONCE
  26. #pragma once
  27. #endif
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. #if PRAGMA_IMPORT
  32. #pragma import on
  33. #endif
  34. #if PRAGMA_STRUCT_ALIGN
  35. #pragma options align=power
  36. #elif PRAGMA_STRUCT_PACKPUSH
  37. #pragma pack(push, 2)
  38. #elif PRAGMA_STRUCT_PACK
  39. #pragma pack(2)
  40. #endif
  41. /* Matching Options */
  42. typedef UInt32 FNSMatchOptions;
  43. enum {
  44. kFNSMatchNames = 0x00000001, /* font names must match */
  45. kFNSMatchTechnology = 0x00000002, /* scaler technology must match */
  46. kFNSMatchGlyphs = 0x00000004, /* glyph data must match */
  47. kFNSMatchEncodings = 0x00000008, /* cmaps must match */
  48. kFNSMatchQDMetrics = 0x00000010, /* QuickDraw Text metrics must match */
  49. kFNSMatchATSUMetrics = 0x00000020, /* ATSUI metrics (incl. vertical) must match */
  50. kFNSMatchKerning = 0x00000040, /* kerning data must match */
  51. kFNSMatchWSLayout = 0x00000080, /* WorldScript layout tables must match */
  52. kFNSMatchAATLayout = 0x00000100, /* AAT (incl. OpenType) layout tables must match */
  53. kFNSMatchPrintEncoding = 0x00000200, /* PostScript font and glyph names and re-encoding vector must match */
  54. kFNSMissingDataNoMatch = (unsigned long)0x80000000, /* treat missing data as mismatch */
  55. kFNSMatchAll = (unsigned long)0xFFFFFFFF, /* everything must match */
  56. kFNSMatchDefaults = 0 /* use global default match options */
  57. };
  58. /*
  59. * FNSMatchDefaultsGet()
  60. *
  61. * Availability:
  62. * Non-Carbon CFM: in FontSyncLib 1.0 and later
  63. * CarbonLib: in CarbonLib 1.0 and later
  64. * Mac OS X: in version 10.0 and later
  65. */
  66. EXTERN_API_C( FNSMatchOptions )
  67. FNSMatchDefaultsGet(void);
  68. /* Version control */
  69. typedef UInt32 FNSObjectVersion;
  70. enum {
  71. kFNSVersionDontCare = 0,
  72. kFNSCurSysInfoVersion = 1
  73. };
  74. /* No features defined yet.*/
  75. typedef UInt32 FNSFeatureFlags;
  76. /*
  77. The FontSync library version number is binary-coded decimal:
  78. 8 bits of major version, 4 minor version and 4 bits revision.
  79. */
  80. struct FNSSysInfo {
  81. FNSObjectVersion iSysInfoVersion; /* fill this in before calling FNSSysInfoGet*/
  82. FNSFeatureFlags oFeatures;
  83. FNSObjectVersion oCurRefVersion;
  84. FNSObjectVersion oMinRefVersion;
  85. FNSObjectVersion oCurProfileVersion;
  86. FNSObjectVersion oMinProfileVersion;
  87. UInt16 oFontSyncVersion;
  88. };
  89. typedef struct FNSSysInfo FNSSysInfo;
  90. /*
  91. * FNSSysInfoGet()
  92. *
  93. * Availability:
  94. * Non-Carbon CFM: in FontSyncLib 1.0 and later
  95. * CarbonLib: in CarbonLib 1.0 and later
  96. * Mac OS X: in version 10.0 and later
  97. */
  98. EXTERN_API_C( void )
  99. FNSSysInfoGet(FNSSysInfo * ioInfo);
  100. /* FontSync References */
  101. typedef struct OpaqueFNSFontReference* FNSFontReference;
  102. /*
  103. * FNSReferenceGetVersion()
  104. *
  105. * Availability:
  106. * Non-Carbon CFM: in FontSyncLib 1.0 and later
  107. * CarbonLib: in CarbonLib 1.0 and later
  108. * Mac OS X: in version 10.0 and later
  109. */
  110. EXTERN_API_C( OSStatus )
  111. FNSReferenceGetVersion(
  112. FNSFontReference iReference,
  113. FNSObjectVersion * oVersion);
  114. /*
  115. * FNSReferenceDispose()
  116. *
  117. * Availability:
  118. * Non-Carbon CFM: in FontSyncLib 1.0 and later
  119. * CarbonLib: in CarbonLib 1.0 and later
  120. * Mac OS X: in version 10.0 and later
  121. */
  122. EXTERN_API_C( OSStatus )
  123. FNSReferenceDispose(FNSFontReference iReference);
  124. /*
  125. * FNSReferenceMatch()
  126. *
  127. * Availability:
  128. * Non-Carbon CFM: in FontSyncLib 1.0 and later
  129. * CarbonLib: in CarbonLib 1.0 and later
  130. * Mac OS X: in version 10.0 and later
  131. */
  132. EXTERN_API_C( OSStatus )
  133. FNSReferenceMatch(
  134. FNSFontReference iReference1,
  135. FNSFontReference iReference2,
  136. FNSMatchOptions iOptions,
  137. FNSMatchOptions * oFailedMatchOptions); /* can be NULL */
  138. /*
  139. * FNSReferenceFlattenedSize()
  140. *
  141. * Availability:
  142. * Non-Carbon CFM: in FontSyncLib 1.0 and later
  143. * CarbonLib: in CarbonLib 1.0 and later
  144. * Mac OS X: in version 10.0 and later
  145. */
  146. EXTERN_API_C( OSStatus )
  147. FNSReferenceFlattenedSize(
  148. FNSFontReference iReference,
  149. ByteCount * oFlattenedSize);
  150. /*
  151. * FNSReferenceFlatten()
  152. *
  153. * Availability:
  154. * Non-Carbon CFM: in FontSyncLib 1.0 and later
  155. * CarbonLib: in CarbonLib 1.0 and later
  156. * Mac OS X: in version 10.0 and later
  157. */
  158. EXTERN_API_C( OSStatus )
  159. FNSReferenceFlatten(
  160. FNSFontReference iReference,
  161. void * oFlatReference, /* can be NULL */
  162. ByteCount * oFlattenedSize); /* can be NULL */
  163. /*
  164. * FNSReferenceUnflatten()
  165. *
  166. * Availability:
  167. * Non-Carbon CFM: in FontSyncLib 1.0 and later
  168. * CarbonLib: in CarbonLib 1.0 and later
  169. * Mac OS X: in version 10.0 and later
  170. */
  171. EXTERN_API_C( OSStatus )
  172. FNSReferenceUnflatten(
  173. const void * iFlatReference,
  174. ByteCount iFlattenedSize,
  175. FNSFontReference * oReference);
  176. /* FontSync Profiles */
  177. enum {
  178. kFNSCreatorDefault = 0,
  179. kFNSProfileFileType = FOUR_CHAR_CODE('fnsp')
  180. };
  181. typedef struct OpaqueFNSFontProfile* FNSFontProfile;
  182. /*
  183. * FNSProfileCreate()
  184. *
  185. * Availability:
  186. * Non-Carbon CFM: in FontSyncLib 1.0 and later
  187. * CarbonLib: in CarbonLib 1.0 and later
  188. * Mac OS X: in version 10.0 and later
  189. */
  190. EXTERN_API_C( OSStatus )
  191. FNSProfileCreate(
  192. const FSSpec * iFile,
  193. FourCharCode iCreator,
  194. ItemCount iEstNumRefs,
  195. FNSObjectVersion iDesiredVersion,
  196. FNSFontProfile * oProfile);
  197. /*
  198. * FNSProfileOpen()
  199. *
  200. * Availability:
  201. * Non-Carbon CFM: in FontSyncLib 1.0 and later
  202. * CarbonLib: in CarbonLib 1.0 and later
  203. * Mac OS X: in version 10.0 and later
  204. */
  205. EXTERN_API_C( OSStatus )
  206. FNSProfileOpen(
  207. const FSSpec * iFile,
  208. Boolean iOpenForWrite,
  209. FNSFontProfile * oProfile);
  210. /*
  211. * FNSProfileCreateWithFSRef()
  212. *
  213. * Availability:
  214. * Non-Carbon CFM: not available
  215. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.1 and later
  216. * Mac OS X: in version 10.1 and later
  217. */
  218. EXTERN_API_C( OSStatus )
  219. FNSProfileCreateWithFSRef(
  220. const FSRef * iParentDirectory,
  221. UniCharCount iNameLength,
  222. const UniChar * iName,
  223. FourCharCode iCreator,
  224. ItemCount iEstNumRefs,
  225. FNSObjectVersion iDesiredVersion,
  226. FNSFontProfile * oProfile);
  227. /*
  228. * FNSProfileOpenWithFSRef()
  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.1 and later
  233. * Mac OS X: in version 10.1 and later
  234. */
  235. EXTERN_API_C( OSStatus )
  236. FNSProfileOpenWithFSRef(
  237. const FSRef * iFile,
  238. Boolean iOpenForWrite,
  239. FNSFontProfile * oProfile);
  240. /*
  241. * FNSProfileGetVersion()
  242. *
  243. * Availability:
  244. * Non-Carbon CFM: in FontSyncLib 1.0 and later
  245. * CarbonLib: in CarbonLib 1.0 and later
  246. * Mac OS X: in version 10.0 and later
  247. */
  248. EXTERN_API_C( OSStatus )
  249. FNSProfileGetVersion(
  250. FNSFontProfile iProfile,
  251. FNSObjectVersion * oVersion);
  252. /*
  253. * FNSProfileCompact()
  254. *
  255. * Availability:
  256. * Non-Carbon CFM: in FontSyncLib 1.0 and later
  257. * CarbonLib: in CarbonLib 1.0 and later
  258. * Mac OS X: in version 10.0 and later
  259. */
  260. EXTERN_API_C( OSStatus )
  261. FNSProfileCompact(FNSFontProfile iProfile);
  262. /*
  263. * FNSProfileClose()
  264. *
  265. * Availability:
  266. * Non-Carbon CFM: in FontSyncLib 1.0 and later
  267. * CarbonLib: in CarbonLib 1.0 and later
  268. * Mac OS X: in version 10.0 and later
  269. */
  270. EXTERN_API_C( OSStatus )
  271. FNSProfileClose(FNSFontProfile iProfile);
  272. /*
  273. * FNSProfileAddReference()
  274. *
  275. * Availability:
  276. * Non-Carbon CFM: in FontSyncLib 1.0 and later
  277. * CarbonLib: in CarbonLib 1.0 and later
  278. * Mac OS X: in version 10.0 and later
  279. */
  280. EXTERN_API_C( OSStatus )
  281. FNSProfileAddReference(
  282. FNSFontProfile iProfile,
  283. FNSFontReference iReference);
  284. /*
  285. * FNSProfileRemoveReference()
  286. *
  287. * Availability:
  288. * Non-Carbon CFM: in FontSyncLib 1.0 and later
  289. * CarbonLib: in CarbonLib 1.0 and later
  290. * Mac OS X: in version 10.0 and later
  291. */
  292. EXTERN_API_C( OSStatus )
  293. FNSProfileRemoveReference(
  294. FNSFontProfile iProfile,
  295. FNSFontReference iReference);
  296. /*
  297. * FNSProfileRemoveIndReference()
  298. *
  299. * Availability:
  300. * Non-Carbon CFM: in FontSyncLib 1.0 and later
  301. * CarbonLib: in CarbonLib 1.0 and later
  302. * Mac OS X: in version 10.0 and later
  303. */
  304. EXTERN_API_C( OSStatus )
  305. FNSProfileRemoveIndReference(
  306. FNSFontProfile iProfile,
  307. UInt32 iIndex);
  308. /*
  309. * FNSProfileClear()
  310. *
  311. * Availability:
  312. * Non-Carbon CFM: in FontSyncLib 1.0 and later
  313. * CarbonLib: in CarbonLib 1.0 and later
  314. * Mac OS X: in version 10.0 and later
  315. */
  316. EXTERN_API_C( OSStatus )
  317. FNSProfileClear(FNSFontProfile iProfile);
  318. /*
  319. * FNSProfileCountReferences()
  320. *
  321. * Availability:
  322. * Non-Carbon CFM: in FontSyncLib 1.0 and later
  323. * CarbonLib: in CarbonLib 1.0 and later
  324. * Mac OS X: in version 10.0 and later
  325. */
  326. EXTERN_API_C( OSStatus )
  327. FNSProfileCountReferences(
  328. FNSFontProfile iProfile,
  329. ItemCount * oCount);
  330. /*
  331. * FNSProfileGetIndReference()
  332. *
  333. * Availability:
  334. * Non-Carbon CFM: in FontSyncLib 1.0 and later
  335. * CarbonLib: in CarbonLib 1.0 and later
  336. * Mac OS X: in version 10.0 and later
  337. */
  338. EXTERN_API_C( OSStatus )
  339. FNSProfileGetIndReference(
  340. FNSFontProfile iProfile,
  341. UInt32 iWhichReference,
  342. FNSFontReference * oReference);
  343. /*
  344. * FNSProfileMatchReference()
  345. *
  346. * Availability:
  347. * Non-Carbon CFM: in FontSyncLib 1.0 and later
  348. * CarbonLib: in CarbonLib 1.0 and later
  349. * Mac OS X: in version 10.0 and later
  350. */
  351. EXTERN_API_C( OSStatus )
  352. FNSProfileMatchReference(
  353. FNSFontProfile iProfile,
  354. FNSFontReference iReference,
  355. FNSMatchOptions iMatchOptions,
  356. ItemCount iOutputSize,
  357. UInt32 oIndices[], /* can be NULL */
  358. ItemCount * oNumMatches); /* can be NULL */
  359. /* Mapping to and from Font Objects */
  360. /*
  361. * FNSReferenceCreate()
  362. *
  363. * Availability:
  364. * Non-Carbon CFM: in FontSyncLib 1.0 and later
  365. * CarbonLib: in CarbonLib 1.0 and later
  366. * Mac OS X: in version 10.0 and later
  367. */
  368. EXTERN_API_C( OSStatus )
  369. FNSReferenceCreate(
  370. FMFont iFont,
  371. FNSObjectVersion iDesiredVersion,
  372. FNSFontReference * oReference);
  373. /*
  374. * FNSReferenceMatchFonts()
  375. *
  376. * Availability:
  377. * Non-Carbon CFM: in FontSyncLib 1.0 and later
  378. * CarbonLib: in CarbonLib 1.0 and later
  379. * Mac OS X: in version 10.0 and later
  380. */
  381. EXTERN_API_C( OSStatus )
  382. FNSReferenceMatchFonts(
  383. FNSFontReference iReference,
  384. FNSMatchOptions iMatchOptions,
  385. ItemCount iOutputSize,
  386. FMFont oFonts[], /* can be NULL */
  387. ItemCount * oNumMatches); /* can be NULL */
  388. /* Mapping to and from Font Families */
  389. /*
  390. * FNSReferenceCreateFromFamily()
  391. *
  392. * Availability:
  393. * Non-Carbon CFM: in FontSyncLib 1.0 and later
  394. * CarbonLib: in CarbonLib 1.0 and later
  395. * Mac OS X: in version 10.0 and later
  396. */
  397. EXTERN_API_C( OSStatus )
  398. FNSReferenceCreateFromFamily(
  399. FMFontFamily iFamily,
  400. FMFontStyle iStyle,
  401. FNSObjectVersion iDesiredVersion,
  402. FNSFontReference * oReference, /* can be NULL */
  403. FMFontStyle * oActualStyle); /* can be NULL */
  404. /*
  405. * FNSReferenceMatchFamilies()
  406. *
  407. * Availability:
  408. * Non-Carbon CFM: in FontSyncLib 1.0 and later
  409. * CarbonLib: in CarbonLib 1.0 and later
  410. * Mac OS X: in version 10.0 and later
  411. */
  412. EXTERN_API_C( OSStatus )
  413. FNSReferenceMatchFamilies(
  414. FNSFontReference iReference,
  415. FNSMatchOptions iMatchOptions,
  416. ItemCount iOutputSize,
  417. FMFontFamilyInstance oFonts[], /* can be NULL */
  418. ItemCount * oNumMatches); /* can be NULL */
  419. /* UI Support */
  420. /*
  421. * FNSReferenceGetFamilyInfo()
  422. *
  423. * Availability:
  424. * Non-Carbon CFM: in FontSyncLib 1.0 and later
  425. * CarbonLib: in CarbonLib 1.0 and later
  426. * Mac OS X: in version 10.0 and later
  427. */
  428. EXTERN_API_C( OSStatus )
  429. FNSReferenceGetFamilyInfo(
  430. FNSFontReference iReference,
  431. Str255 oFamilyName, /* can be NULL */
  432. ScriptCode * oFamilyNameScript, /* can be NULL */
  433. FMFontStyle * oActualStyle); /* can be NULL */
  434. /*
  435. * FNSReferenceCountNames()
  436. *
  437. * Availability:
  438. * Non-Carbon CFM: in FontSyncLib 1.0 and later
  439. * CarbonLib: in CarbonLib 1.0 and later
  440. * Mac OS X: in version 10.0 and later
  441. */
  442. EXTERN_API_C( OSStatus )
  443. FNSReferenceCountNames(
  444. FNSFontReference iReference,
  445. ItemCount * oNameCount);
  446. /*
  447. * FNSReferenceGetIndName()
  448. *
  449. * Availability:
  450. * Non-Carbon CFM: in FontSyncLib 1.0 and later
  451. * CarbonLib: in CarbonLib 1.0 and later
  452. * Mac OS X: in version 10.0 and later
  453. */
  454. EXTERN_API_C( OSStatus )
  455. FNSReferenceGetIndName(
  456. FNSFontReference iReference,
  457. ItemCount iFontNameIndex,
  458. ByteCount iMaximumNameLength,
  459. Ptr oName, /* can be NULL */
  460. ByteCount * oActualNameLength, /* can be NULL */
  461. FontNameCode * oFontNameCode, /* can be NULL */
  462. FontPlatformCode * oFontNamePlatform, /* can be NULL */
  463. FontScriptCode * oFontNameScript, /* can be NULL */
  464. FontLanguageCode * oFontNameLanguage); /* can be NULL */
  465. /*
  466. * FNSReferenceFindName()
  467. *
  468. * Availability:
  469. * Non-Carbon CFM: in FontSyncLib 1.0 and later
  470. * CarbonLib: in CarbonLib 1.0 and later
  471. * Mac OS X: in version 10.0 and later
  472. */
  473. EXTERN_API_C( OSStatus )
  474. FNSReferenceFindName(
  475. FNSFontReference iReference,
  476. FontNameCode iFontNameCode,
  477. FontPlatformCode iFontNamePlatform,
  478. FontScriptCode iFontNameScript,
  479. FontLanguageCode iFontNameLanguage,
  480. ByteCount iMaximumNameLength,
  481. Ptr oName, /* can be NULL */
  482. ByteCount * oActualNameLength, /* can be NULL */
  483. ItemCount * oFontNameIndex); /* can be NULL */
  484. /* Miscellany */
  485. /*
  486. * FNSEnabled()
  487. *
  488. * Availability:
  489. * Non-Carbon CFM: in FontSyncLib 1.0 and later
  490. * CarbonLib: in CarbonLib 1.0 and later
  491. * Mac OS X: in version 10.0 and later
  492. */
  493. EXTERN_API_C( Boolean )
  494. FNSEnabled(void);
  495. #if PRAGMA_STRUCT_ALIGN
  496. #pragma options align=reset
  497. #elif PRAGMA_STRUCT_PACKPUSH
  498. #pragma pack(pop)
  499. #elif PRAGMA_STRUCT_PACK
  500. #pragma pack()
  501. #endif
  502. #ifdef PRAGMA_IMPORT_OFF
  503. #pragma import off
  504. #elif PRAGMA_IMPORT
  505. #pragma import reset
  506. #endif
  507. #ifdef __cplusplus
  508. }
  509. #endif