FontPanel.pas 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735
  1. {
  2. File: CommonPanels/FontPanel.h
  3. Contains: Carbon Font Panel package Interfaces.
  4. Version: CommonPanels-73~983
  5. Copyright: © 2002-2005 by Apple Computer, Inc., all rights reserved
  6. }
  7. { Pascal Translation: Gale R Paeper, <[email protected]>, 2006 }
  8. {
  9. Modified for use with Free Pascal
  10. Version 200
  11. Please report any bugs to <[email protected]>
  12. }
  13. {$mode macpas}
  14. {$packenum 1}
  15. {$macro on}
  16. {$inline on}
  17. {$CALLING MWPASCAL}
  18. unit FontPanel;
  19. interface
  20. {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
  21. {$setc GAP_INTERFACES_VERSION := $0200}
  22. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  23. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  24. {$endc}
  25. {$ifc defined CPUPOWERPC and defined CPUI386}
  26. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  27. {$endc}
  28. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  29. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  30. {$endc}
  31. {$ifc not defined __ppc__ and defined CPUPOWERPC}
  32. {$setc __ppc__ := 1}
  33. {$elsec}
  34. {$setc __ppc__ := 0}
  35. {$endc}
  36. {$ifc not defined __i386__ and defined CPUI386}
  37. {$setc __i386__ := 1}
  38. {$elsec}
  39. {$setc __i386__ := 0}
  40. {$endc}
  41. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  42. {$error Conflicting definitions for __ppc__ and __i386__}
  43. {$endc}
  44. {$ifc defined __ppc__ and __ppc__}
  45. {$setc TARGET_CPU_PPC := TRUE}
  46. {$setc TARGET_CPU_X86 := FALSE}
  47. {$elifc defined __i386__ and __i386__}
  48. {$setc TARGET_CPU_PPC := FALSE}
  49. {$setc TARGET_CPU_X86 := TRUE}
  50. {$elsec}
  51. {$error Neither __ppc__ nor __i386__ is defined.}
  52. {$endc}
  53. {$setc TARGET_CPU_PPC_64 := FALSE}
  54. {$ifc defined FPC_BIG_ENDIAN}
  55. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  56. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  57. {$elifc defined FPC_LITTLE_ENDIAN}
  58. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  59. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  60. {$elsec}
  61. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  62. {$endc}
  63. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  64. {$setc CALL_NOT_IN_CARBON := FALSE}
  65. {$setc OLDROUTINENAMES := FALSE}
  66. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  67. {$setc OPAQUE_UPP_TYPES := TRUE}
  68. {$setc OTCARBONAPPLICATION := TRUE}
  69. {$setc OTKERNEL := FALSE}
  70. {$setc PM_USE_SESSION_APIS := TRUE}
  71. {$setc TARGET_API_MAC_CARBON := TRUE}
  72. {$setc TARGET_API_MAC_OS8 := FALSE}
  73. {$setc TARGET_API_MAC_OSX := TRUE}
  74. {$setc TARGET_CARBON := TRUE}
  75. {$setc TARGET_CPU_68K := FALSE}
  76. {$setc TARGET_CPU_MIPS := FALSE}
  77. {$setc TARGET_CPU_SPARC := FALSE}
  78. {$setc TARGET_OS_MAC := TRUE}
  79. {$setc TARGET_OS_UNIX := FALSE}
  80. {$setc TARGET_OS_WIN32 := FALSE}
  81. {$setc TARGET_RT_MAC_68881 := FALSE}
  82. {$setc TARGET_RT_MAC_CFM := FALSE}
  83. {$setc TARGET_RT_MAC_MACHO := TRUE}
  84. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  85. {$setc TYPE_BOOL := FALSE}
  86. {$setc TYPE_EXTENDED := FALSE}
  87. {$setc TYPE_LONGLONG := TRUE}
  88. uses MacTypes, AEDataModel, AERegistry, ATSTypes, CarbonEventsCore, CFArray, CFBase, CFDictionary, Quickdraw;
  89. {$ALIGN MAC68K}
  90. {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  91. Font Panel-Related Events
  92. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
  93. {
  94. * Discussion:
  95. * Event classes
  96. }
  97. const
  98. {
  99. * Events related to font selection or handling.
  100. }
  101. kEventClassFont = $666F6E74 (* 'font' *);
  102. {
  103. * Summary:
  104. * Common command IDs
  105. }
  106. const
  107. {
  108. * The state of the Font Panel should be toggled, displaying it or
  109. * hiding it as necessary. If the user closes the Font Panel directly
  110. * from the window, the application will receive a
  111. * kEventFontPanelClosed event.
  112. }
  113. kHICommandShowHideFontPanel = $73686670 (* 'shfp' *);
  114. { Font Events }
  115. {
  116. * Summary:
  117. * Font events (kEventClassFont)
  118. *
  119. * Discussion:
  120. * When the user closes the Font Panel, a kEventWindowClosed event
  121. * will be detected by the Carbon event handler installed by the
  122. * system. The system then notifies the application that the Font
  123. * Panel has closed by posting a Carbon Event Manager event. This
  124. * allows the application to update any menu items or other controls
  125. * whose state may have to change because the Font Panel has closed.
  126. * kEventWindowClosed has no parameters. When the user selects an
  127. * item in the Font Panel, the system will send a
  128. * kEventFontSelection event to the event target specified when the
  129. * application called SetFontPanelInfo(). kEventFontSelection will
  130. * contain parameters reflecting the current Font Panel selection in
  131. * all supported formats. Font events are available after Mac OS X
  132. * 10.2 in the Carbon framework.
  133. }
  134. const
  135. {
  136. * The Font Panel has been closed. The application should update its
  137. * corresponding UI element (e.g., a menu item) accordingly.
  138. }
  139. kEventFontPanelClosed = 1;
  140. {
  141. * The user has specified font settings in the Font Panel. The
  142. * application can obtain these settings from the event, in which
  143. * they are stored as parameters. Not all parameters are guaranteed
  144. * to be present; the application should check for all those which it
  145. * recognizes and apply the ones found as appropriate to the target
  146. * text.
  147. }
  148. kEventFontSelection = 2;
  149. {
  150. Parameters for font events:
  151. kEventFontPanelClosed
  152. None.
  153. kEventFontSelection
  154. --> kEventParamATSUFontID typeATSUFontID
  155. --> kEventParamATSUFontSize typeATSUSize
  156. --> kEventParamFMFontFamily typeFMFontFamily
  157. --> kEventParamFMFontSize typeFMFontSize
  158. --> kEventParamFontColor typeFontColor
  159. --> kEventParamDictionary typeCFDictionary
  160. }
  161. const
  162. typeATSUFontID = typeUInt32; { ATSUI font ID.}
  163. typeATSUSize = typeFixed; { ATSUI font size.}
  164. typeFMFontFamily = typeSInt16; { Font family reference.}
  165. typeFMFontStyle = typeSInt16; { Quickdraw font style}
  166. typeFMFontSize = typeSInt16; { Integer font size.}
  167. typeFontColor = typeRGBColor; { Font color spec (optional).}
  168. kEventParamATSUFontID = $61756964 (* 'auid' *); { typeATSUFontID}
  169. kEventParamATSUFontSize = $6175737A (* 'ausz' *); { typeATSUSize}
  170. kEventParamFMFontFamily = $666D666D (* 'fmfm' *); { typeFMFontFamily}
  171. kEventParamFMFontStyle = $666D7374 (* 'fmst' *); { typeFMFontStyle}
  172. kEventParamFMFontSize = $666D737A (* 'fmsz' *); { typeFMFontSize}
  173. kEventParamFontColor = $66636C72 (* 'fclr' *); { typeFontColor}
  174. kEventParamDictionary = $64696374 (* 'dict' *); { typeCFDictionaryRef}
  175. {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  176. Key constants to be used to access data inside the dictionary that may
  177. be contained in the kEventFontSelection dictionary.
  178. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
  179. {
  180. * kFontPanelATSUFontIDKey
  181. *
  182. * Availability:
  183. * Mac OS X: in version 10.3 and later in Carbon.framework
  184. * CarbonLib: not available
  185. * Non-Carbon CFM: not available
  186. }
  187. var kFontPanelATSUFontIDKey: CFStringRef; external name '_kFontPanelATSUFontIDKey'; (* attribute const *)
  188. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  189. {Value is a CFNumber containing the ATSU Font ID}
  190. {
  191. * kFontPanelVariationAxesKey
  192. *
  193. * Availability:
  194. * Mac OS X: in version 10.3 and later in Carbon.framework
  195. * CarbonLib: not available
  196. * Non-Carbon CFM: not available
  197. }
  198. var kFontPanelVariationAxesKey: CFStringRef; external name '_kFontPanelVariationAxesKey'; (* attribute const *)
  199. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  200. { Value is a CFDataRef containing one or more ATSUI Variation Axes}
  201. {
  202. * kFontPanelVariationValuesKey
  203. *
  204. * Availability:
  205. * Mac OS X: in version 10.3 and later in Carbon.framework
  206. * CarbonLib: not available
  207. * Non-Carbon CFM: not available
  208. }
  209. var kFontPanelVariationValuesKey: CFStringRef; external name '_kFontPanelVariationValuesKey'; (* attribute const *)
  210. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  211. {Value is a CFDataRef containing one or more ATSU Variation values}
  212. {
  213. * kFontPanelFeatureTypesKey
  214. *
  215. * Availability:
  216. * Mac OS X: in version 10.3 and later in Carbon.framework
  217. * CarbonLib: not available
  218. * Non-Carbon CFM: not available
  219. }
  220. var kFontPanelFeatureTypesKey: CFStringRef; external name '_kFontPanelFeatureTypesKey'; (* attribute const *)
  221. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  222. { Value is a CFDataRef containing one or more ATSUI feature types}
  223. {
  224. * kFontPanelFeatureSelectorsKey
  225. *
  226. * Availability:
  227. * Mac OS X: in version 10.3 and later in Carbon.framework
  228. * CarbonLib: not available
  229. * Non-Carbon CFM: not available
  230. }
  231. var kFontPanelFeatureSelectorsKey: CFStringRef; external name '_kFontPanelFeatureSelectorsKey'; (* attribute const *)
  232. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  233. { Value is a CFDataRef containing one or more ATSUI feature selectors}
  234. {
  235. * kFontPanelAttributesKey
  236. *
  237. * Availability:
  238. * Mac OS X: in version 10.3 and later in Carbon.framework
  239. * CarbonLib: not available
  240. * Non-Carbon CFM: not available
  241. }
  242. var kFontPanelAttributesKey: CFStringRef; external name '_kFontPanelAttributesKey'; (* attribute const *)
  243. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  244. {
  245. const <CFString> string kFontPanelAttributesKey = "FontAttributes";
  246. Value is a CFDictionaryRef containing three keyed values. Each value is
  247. a CFDataRef. One CFDataRef contains one or more ATSUAttributeTags.
  248. One CFDataRef contains one or more value sizes for each tag. And the last
  249. CFDataRef contains the actual values. It is important to understand that
  250. these are the actual values and not value ptrs. To pass these values to
  251. ATSUI they must be converted into ptrs. The following code fragment demonstrates
  252. one technique
  253. CFDataRef values;
  254. CFDataRef tags;
  255. CFDataRef sizes;
  256. if ( CFDictionaryGetValueIfPresent( attributesDict, kFontPanelAttributeValuesKey, &values ) &&
  257. CFDictionaryGetValueIfPresent( attributesDict, kFontPanelAttributeTagsKey, &tags )
  258. CFDictionaryGetValueIfPresent( attributesDict, kFontPanelAttributeSizesKey, &sizes ))
  259. (
  260. ItemCount count = CFDataGetLength( tags )/sizeof(ATSUAttributeTag);
  261. CFIndex index;
  262. ATSUAttributeValuePtr valuePtrs = malloc( count * sizeof(ATSUAttributeValuePtr) );
  263. UInt32* sizePtr = (UInt32*)CFDataGetBytePtr(sizes);
  264. UInt32* bytePtr = (UInt32*)CFDataGetBytePtr(values);
  265. for ( index = 0; index < count; index++ )
  266. (
  267. valuePtrs[index] = bytePtr;
  268. bytePtr = (UInt32*)( (UInt8*)bytePtr + sizePtr[index]);
  269. )
  270. verify_noerr( ATSUSetAttributes( someATSUStyle, count, (ATSUAttributeTag*)CFDataGetBytePtr(tags),sizePtr, valuePtrs ) );
  271. free( valuePtrs );
  272. }
  273. {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  274. Keys to access the CFDataRefs inside the attributes dictionary (see above)
  275. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
  276. {
  277. * kFontPanelAttributeTagsKey
  278. *
  279. * Availability:
  280. * Mac OS X: in version 10.3 and later in Carbon.framework
  281. * CarbonLib: not available
  282. * Non-Carbon CFM: not available
  283. }
  284. var kFontPanelAttributeTagsKey: CFStringRef; external name '_kFontPanelAttributeTagsKey'; (* attribute const *)
  285. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  286. {Value is a CFDataRef containing one or more style attribute tags}
  287. {
  288. * kFontPanelAttributeSizesKey
  289. *
  290. * Availability:
  291. * Mac OS X: in version 10.3 and later in Carbon.framework
  292. * CarbonLib: not available
  293. * Non-Carbon CFM: not available
  294. }
  295. var kFontPanelAttributeSizesKey: CFStringRef; external name '_kFontPanelAttributeSizesKey'; (* attribute const *)
  296. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  297. {Value is a CFDataRef containing one or more style attribute sizes}
  298. {
  299. * kFontPanelAttributeValuesKey
  300. *
  301. * Availability:
  302. * Mac OS X: in version 10.3 and later in Carbon.framework
  303. * CarbonLib: not available
  304. * Non-Carbon CFM: not available
  305. }
  306. var kFontPanelAttributeValuesKey: CFStringRef; external name '_kFontPanelAttributeValuesKey'; (* attribute const *)
  307. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  308. {Value is a CFDataRef containing one or more style values}
  309. {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  310. Other Font Panel Constants
  311. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
  312. {
  313. Error codes (Font Panel codes in range [-8880,-8899]).
  314. }
  315. const
  316. fontPanelShowErr = -8880; { Can't display the Font Panel.}
  317. fontPanelSelectionStyleErr = -8881; { Bad font selection style info.}
  318. fontPanelFontSelectionQDStyleVersionErr = -8882; { Unsupported record version.}
  319. {
  320. Type of font information passed in SetFontPanelInfo(). If the client is
  321. sending ATSUI style data, it specifies kFontSelectionATSUIType; if it is
  322. sending Quickdraw style data, it specifies kFontSelectionQDType.
  323. }
  324. const
  325. kFontSelectionATSUIType = $6173746C (* 'astl' *); { Use ATSUIStyle collection.}
  326. kFontSelectionQDType = $7173746C (* 'qstl' *); { Use FontSelectionQDStyle record.}
  327. {
  328. Supported versions of the FontSelectionQDStyle record. Clients should always set
  329. the <version> field to one of these values.
  330. }
  331. const
  332. kFontSelectionQDStyleVersionZero = 0;
  333. {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  334. Font Panel Types
  335. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
  336. {
  337. Record specifying the font information to be specified in the Font
  338. Panel. This record is used if the client is sending Quickdraw style data
  339. (i.e., it specified kFontSelectionQDType in SetFontPanelInfo()).
  340. }
  341. type
  342. FontSelectionQDStyle = record
  343. version: UInt32; { Version number of struct.}
  344. instance: FMFontFamilyInstance; { Font instance data.}
  345. size: FMFontSize; { Size of font in points.}
  346. hasColor: Boolean; { true if color info supplied.}
  347. reserved: SInt8; { Filler byte.}
  348. color: RGBColor; { Color specification for font.}
  349. end;
  350. FontSelectionQDStylePtr = ^FontSelectionQDStyle;
  351. {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  352. Font Panel Functions
  353. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
  354. {
  355. * FPIsFontPanelVisible()
  356. *
  357. * Availability:
  358. * Mac OS X: in version 10.2 and later in Carbon.framework
  359. * CarbonLib: not available in CarbonLib 1.x
  360. * Non-Carbon CFM: not available
  361. }
  362. function FPIsFontPanelVisible: Boolean; external name '_FPIsFontPanelVisible';
  363. (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
  364. {
  365. * FPShowHideFontPanel()
  366. *
  367. * Availability:
  368. * Mac OS X: in version 10.2 and later in Carbon.framework
  369. * CarbonLib: not available in CarbonLib 1.x
  370. * Non-Carbon CFM: not available
  371. }
  372. function FPShowHideFontPanel: OSStatus; external name '_FPShowHideFontPanel';
  373. (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
  374. {
  375. * SetFontInfoForSelection()
  376. *
  377. * Availability:
  378. * Mac OS X: in version 10.2 and later in Carbon.framework
  379. * CarbonLib: not available in CarbonLib 1.x
  380. * Non-Carbon CFM: not available
  381. }
  382. function SetFontInfoForSelection( iStyleType: OSType; iNumStyles: UInt32; iStyles: {variable-size-array} UnivPtr; iFPEventTarget: EventTargetRef ): OSStatus; external name '_SetFontInfoForSelection';
  383. (* AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER *)
  384. {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  385. Font Collection Functions
  386. In 10.3 the ability to create and modify font collections is available. Font
  387. collections are files containing font descriptions. Font descriptions are
  388. encapsulated in the opaque object FCFontDescriptorRef. A FCFontDescriptroRef
  389. is a CFType. To release one call CFRelease.
  390. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
  391. {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  392. Font Collection Types
  393. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
  394. type
  395. FCFontDescriptorRef = ^SInt32; { an opaque 32-bit type }
  396. {
  397. * FCCopyCollectionNames()
  398. *
  399. * Discussion:
  400. * FCCopyCollectionNames returns a copy of the CFArrayRef containing
  401. * the displayable names of every font collection available to the
  402. * current user.
  403. *
  404. * Result:
  405. * A CFArrayRef containing CFStringRefs where each CFStringRef
  406. * contains a font collection's displayable name. Callers are
  407. * responsible for releasing the returned CFArrayRef. If the
  408. * operation is not successful NULL is returned.
  409. *
  410. * Availability:
  411. * Mac OS X: in version 10.3 and later in Carbon.framework
  412. * CarbonLib: not available
  413. * Non-Carbon CFM: not available
  414. }
  415. function FCCopyCollectionNames: CFArrayRef; external name '_FCCopyCollectionNames';
  416. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  417. {
  418. * FCCopyFontDescriptorsInCollection()
  419. *
  420. * Discussion:
  421. * FCCopyFontDescriptorsInCollection copies the fontDescriptors in a
  422. * named collection into an array.
  423. *
  424. * Parameters:
  425. *
  426. * iCollection:
  427. * The name of a collection that descriptors should be copied from.
  428. *
  429. * Result:
  430. * A CFArrayRef containing copies of the FCFontDescriptorRefs
  431. * contained in the name collection. Callers are responsible for
  432. * releasing the returned CFArrayRef. The FCFontDescriptorRefs are
  433. * retained when added to the array and released when the array is
  434. * destroyed. You can access a font descriptor in the array in the
  435. * following manner: fd =
  436. * (FCFontDescriptorRef)CFArrayGetValueAtIndex(array, i);
  437. *
  438. * Availability:
  439. * Mac OS X: in version 10.3 and later in Carbon.framework
  440. * CarbonLib: not available
  441. * Non-Carbon CFM: not available
  442. }
  443. function FCCopyFontDescriptorsInCollection( iCollection: CFStringRef ): CFArrayRef; external name '_FCCopyFontDescriptorsInCollection';
  444. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  445. {
  446. * FCAddCollection()
  447. *
  448. * Discussion:
  449. * Add a collection to the font descriptor collections available to
  450. * the current user. If the collection is successfully added noErr
  451. * is returned. If the collection is not added an error code is
  452. * returned.
  453. *
  454. * Parameters:
  455. *
  456. * iCollection:
  457. * the name of the collection to add.
  458. *
  459. * iCollectionOptions:
  460. * currently there are no options. Set to kNilOptions. This
  461. * parameter is available for future expansion.
  462. *
  463. * Availability:
  464. * Mac OS X: in version 10.3 and later in Carbon.framework
  465. * CarbonLib: not available
  466. * Non-Carbon CFM: not available
  467. }
  468. function FCAddCollection( iCollection: CFStringRef; iCollectionOptions: OptionBits ): OSStatus; external name '_FCAddCollection';
  469. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  470. {
  471. * FCRemoveCollection()
  472. *
  473. * Discussion:
  474. * Remove a named collection from the font descriptor collections
  475. * available to the current user. Returns noErr if the collection
  476. * was successfully removed. An appropriate error code is returned
  477. * if the operation was not successful.
  478. *
  479. * Parameters:
  480. *
  481. * iCollection:
  482. * the name of the collection to remove.
  483. *
  484. * Availability:
  485. * Mac OS X: in version 10.3 and later in Carbon.framework
  486. * CarbonLib: not available
  487. * Non-Carbon CFM: not available
  488. }
  489. function FCRemoveCollection( iCollection: CFStringRef ): OSStatus; external name '_FCRemoveCollection';
  490. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  491. {
  492. * FCAddFontDescriptorToCollection()
  493. *
  494. * Discussion:
  495. * Add a font descriptor to the named collection. noErr is returned
  496. * if the font descriptor is added. An error code describing the
  497. * failure is returned if the descriptor is not added.
  498. *
  499. * Parameters:
  500. *
  501. * iDescriptor:
  502. * the font descriptor that should be added. The
  503. * FCFontDescriptorRef is retained when it is added to the
  504. * collection. After calling this function the caller may release
  505. * their copy.
  506. *
  507. * iCollection:
  508. * the name of the collection to which the font descriptor should
  509. * be added.
  510. *
  511. * Availability:
  512. * Mac OS X: in version 10.3 and later in Carbon.framework
  513. * CarbonLib: not available
  514. * Non-Carbon CFM: not available
  515. }
  516. function FCAddFontDescriptorToCollection( iDescriptor: FCFontDescriptorRef; iCollection: CFStringRef ): OSStatus; external name '_FCAddFontDescriptorToCollection';
  517. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  518. {
  519. * FCRemoveFontDescriptorFromCollection()
  520. *
  521. * Discussion:
  522. * Remove a font descriptor from the named collection. An error is
  523. * returned if the font descriptor can not be removed. noErr is
  524. * returned if the descriptor is removed.
  525. *
  526. * Parameters:
  527. *
  528. * iDescriptor:
  529. * the descriptor that should be removed.
  530. *
  531. * iCollection:
  532. * the name of the collection that the descriptor should be
  533. * removed from.
  534. *
  535. * Availability:
  536. * Mac OS X: in version 10.3 and later in Carbon.framework
  537. * CarbonLib: not available
  538. * Non-Carbon CFM: not available
  539. }
  540. function FCRemoveFontDescriptorFromCollection( iDescriptor: FCFontDescriptorRef; iCollection: CFStringRef ): OSStatus; external name '_FCRemoveFontDescriptorFromCollection';
  541. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  542. {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  543. Font Descriptor Attribute Keys
  544. Font Descriptors contain font attributes that are set and accessed via a set of
  545. keys. The keys are all constant CFStringRefs.
  546. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}
  547. {
  548. * kFCFontFamilyAttribute
  549. *
  550. * Discussion:
  551. * The key for a CFStringRef that contains a font family name (e.g.
  552. * Baskerville).
  553. *
  554. * Availability:
  555. * Mac OS X: in version 10.3 and later in Carbon.framework
  556. * CarbonLib: not available
  557. * Non-Carbon CFM: not available
  558. }
  559. var kFCFontFamilyAttribute: CFStringRef; external name '_kFCFontFamilyAttribute'; (* attribute const *)
  560. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  561. {
  562. * kFCFontNameAttribute
  563. *
  564. * Discussion:
  565. * The key for a CFStringRef containing a font name (e.g.
  566. * Baskerville-Italic).
  567. *
  568. * Availability:
  569. * Mac OS X: in version 10.3 and later in Carbon.framework
  570. * CarbonLib: not available
  571. * Non-Carbon CFM: not available
  572. }
  573. var kFCFontNameAttribute: CFStringRef; external name '_kFCFontNameAttribute'; (* attribute const *)
  574. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  575. {
  576. * kFCFontFaceAttribute
  577. *
  578. * Discussion:
  579. * The key for a CFStringRef containing a face name (e.g. Italic).
  580. *
  581. * Availability:
  582. * Mac OS X: in version 10.3 and later in Carbon.framework
  583. * CarbonLib: not available
  584. * Non-Carbon CFM: not available
  585. }
  586. var kFCFontFaceAttribute: CFStringRef; external name '_kFCFontFaceAttribute'; (* attribute const *)
  587. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  588. {
  589. * kFCFontSizeAttribute
  590. *
  591. * Discussion:
  592. * The key for a CFNumber containg the font size (e.g. 12).
  593. *
  594. * Availability:
  595. * Mac OS X: in version 10.3 and later in Carbon.framework
  596. * CarbonLib: not available
  597. * Non-Carbon CFM: not available
  598. }
  599. var kFCFontSizeAttribute: CFStringRef; external name '_kFCFontSizeAttribute'; (* attribute const *)
  600. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  601. {
  602. * kFCFontVisibleNameAttribute
  603. *
  604. * Discussion:
  605. * The Key for a CFStringRef containing the name that should be used
  606. * in a UI to describe the font.
  607. *
  608. * Availability:
  609. * Mac OS X: in version 10.3 and later in Carbon.framework
  610. * CarbonLib: not available
  611. * Non-Carbon CFM: not available
  612. }
  613. var kFCFontVisibleNameAttribute: CFStringRef; external name '_kFCFontVisibleNameAttribute'; (* attribute const *)
  614. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  615. {
  616. * kFCFontCGColorAttribute
  617. *
  618. * Discussion:
  619. * The Key for a CGColorRef containing the fonts color.
  620. *
  621. * Availability:
  622. * Mac OS X: in version 10.3 and later in Carbon.framework
  623. * CarbonLib: not available
  624. * Non-Carbon CFM: not available
  625. }
  626. var kFCFontCGColorAttribute: CFStringRef; external name '_kFCFontCGColorAttribute'; (* attribute const *)
  627. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  628. {
  629. * FCFontDescriptorCreateWithFontAttributes()
  630. *
  631. * Discussion:
  632. * Create a font descriptor using the attributes contained in the
  633. * dictionary.
  634. *
  635. * Parameters:
  636. *
  637. * iAttributes:
  638. * a dictionary containing one or more of the attributes described
  639. * above.
  640. *
  641. * Result:
  642. * A valid FCFontDescriptorRef. NULL if one cannot be created.
  643. *
  644. * Availability:
  645. * Mac OS X: in version 10.3 and later in Carbon.framework
  646. * CarbonLib: not available
  647. * Non-Carbon CFM: not available
  648. }
  649. function FCFontDescriptorCreateWithFontAttributes( iAttributes: CFDictionaryRef ): FCFontDescriptorRef; external name '_FCFontDescriptorCreateWithFontAttributes';
  650. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  651. {
  652. * FCFontDescriptorCreateWithName()
  653. *
  654. * Discussion:
  655. * Create a font descriptor using a fontname and font size.
  656. *
  657. * Parameters:
  658. *
  659. * iFontName:
  660. * The name of the font (e.g. Baskerville-Italic).
  661. *
  662. * iSize:
  663. * the size of the font. (e.g. 12.0).
  664. *
  665. * Result:
  666. * A valid FCFontDescriptorRef. NULL if one cannot be created.
  667. *
  668. * Availability:
  669. * Mac OS X: in version 10.3 and later in Carbon.framework
  670. * CarbonLib: not available
  671. * Non-Carbon CFM: not available
  672. }
  673. function FCFontDescriptorCreateWithName( iFontName: CFStringRef; iSize: Float32 ): FCFontDescriptorRef; external name '_FCFontDescriptorCreateWithName';
  674. (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
  675. end.