FontPanel.pas 32 KB

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