FontPanel.pas 31 KB

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