CTFontDescriptor.pas 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
  1. {
  2. * CTFontDescriptor.h
  3. * CoreText
  4. *
  5. * Copyright (c) 2006-2012 Apple Inc. All rights reserved.
  6. *
  7. }
  8. { Initial Pascal Translation: Jonas Maebe, <[email protected]>, October 2009 }
  9. { Pascal Translation Updated: Jonas Maebe, <[email protected]>, October 2012 }
  10. {
  11. Modified for use with Free Pascal
  12. Version 308
  13. Please report any bugs to <[email protected]>
  14. }
  15. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  16. {$mode macpas}
  17. {$packenum 1}
  18. {$macro on}
  19. {$inline on}
  20. {$calling mwpascal}
  21. unit CTFontDescriptor;
  22. interface
  23. {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
  24. {$setc GAP_INTERFACES_VERSION := $0308}
  25. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  26. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  27. {$endc}
  28. {$ifc defined CPUPOWERPC and defined CPUI386}
  29. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  30. {$endc}
  31. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  32. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  33. {$endc}
  34. {$ifc not defined __ppc__ and defined CPUPOWERPC32}
  35. {$setc __ppc__ := 1}
  36. {$elsec}
  37. {$setc __ppc__ := 0}
  38. {$endc}
  39. {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
  40. {$setc __ppc64__ := 1}
  41. {$elsec}
  42. {$setc __ppc64__ := 0}
  43. {$endc}
  44. {$ifc not defined __i386__ and defined CPUI386}
  45. {$setc __i386__ := 1}
  46. {$elsec}
  47. {$setc __i386__ := 0}
  48. {$endc}
  49. {$ifc not defined __x86_64__ and defined CPUX86_64}
  50. {$setc __x86_64__ := 1}
  51. {$elsec}
  52. {$setc __x86_64__ := 0}
  53. {$endc}
  54. {$ifc not defined __arm__ and defined CPUARM}
  55. {$setc __arm__ := 1}
  56. {$elsec}
  57. {$setc __arm__ := 0}
  58. {$endc}
  59. {$ifc not defined __arm64__ and defined CPUAARCH64}
  60. {$setc __arm64__ := 1}
  61. {$elsec}
  62. {$setc __arm64__ := 0}
  63. {$endc}
  64. {$ifc defined cpu64}
  65. {$setc __LP64__ := 1}
  66. {$elsec}
  67. {$setc __LP64__ := 0}
  68. {$endc}
  69. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  70. {$error Conflicting definitions for __ppc__ and __i386__}
  71. {$endc}
  72. {$ifc defined __ppc__ and __ppc__}
  73. {$setc TARGET_CPU_PPC := TRUE}
  74. {$setc TARGET_CPU_PPC64 := FALSE}
  75. {$setc TARGET_CPU_X86 := FALSE}
  76. {$setc TARGET_CPU_X86_64 := FALSE}
  77. {$setc TARGET_CPU_ARM := FALSE}
  78. {$setc TARGET_CPU_ARM64 := FALSE}
  79. {$setc TARGET_OS_MAC := TRUE}
  80. {$setc TARGET_OS_IPHONE := FALSE}
  81. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  82. {$setc TARGET_OS_EMBEDDED := FALSE}
  83. {$elifc defined __ppc64__ and __ppc64__}
  84. {$setc TARGET_CPU_PPC := FALSE}
  85. {$setc TARGET_CPU_PPC64 := TRUE}
  86. {$setc TARGET_CPU_X86 := FALSE}
  87. {$setc TARGET_CPU_X86_64 := FALSE}
  88. {$setc TARGET_CPU_ARM := FALSE}
  89. {$setc TARGET_CPU_ARM64 := FALSE}
  90. {$setc TARGET_OS_MAC := TRUE}
  91. {$setc TARGET_OS_IPHONE := FALSE}
  92. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  93. {$setc TARGET_OS_EMBEDDED := FALSE}
  94. {$elifc defined __i386__ and __i386__}
  95. {$setc TARGET_CPU_PPC := FALSE}
  96. {$setc TARGET_CPU_PPC64 := FALSE}
  97. {$setc TARGET_CPU_X86 := TRUE}
  98. {$setc TARGET_CPU_X86_64 := FALSE}
  99. {$setc TARGET_CPU_ARM := FALSE}
  100. {$setc TARGET_CPU_ARM64 := FALSE}
  101. {$ifc defined(iphonesim)}
  102. {$setc TARGET_OS_MAC := FALSE}
  103. {$setc TARGET_OS_IPHONE := TRUE}
  104. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  105. {$elsec}
  106. {$setc TARGET_OS_MAC := TRUE}
  107. {$setc TARGET_OS_IPHONE := FALSE}
  108. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  109. {$endc}
  110. {$setc TARGET_OS_EMBEDDED := FALSE}
  111. {$elifc defined __x86_64__ and __x86_64__}
  112. {$setc TARGET_CPU_PPC := FALSE}
  113. {$setc TARGET_CPU_PPC64 := FALSE}
  114. {$setc TARGET_CPU_X86 := FALSE}
  115. {$setc TARGET_CPU_X86_64 := TRUE}
  116. {$setc TARGET_CPU_ARM := FALSE}
  117. {$setc TARGET_CPU_ARM64 := FALSE}
  118. {$ifc defined(iphonesim)}
  119. {$setc TARGET_OS_MAC := FALSE}
  120. {$setc TARGET_OS_IPHONE := TRUE}
  121. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  122. {$elsec}
  123. {$setc TARGET_OS_MAC := TRUE}
  124. {$setc TARGET_OS_IPHONE := FALSE}
  125. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  126. {$endc}
  127. {$setc TARGET_OS_EMBEDDED := FALSE}
  128. {$elifc defined __arm__ and __arm__}
  129. {$setc TARGET_CPU_PPC := FALSE}
  130. {$setc TARGET_CPU_PPC64 := FALSE}
  131. {$setc TARGET_CPU_X86 := FALSE}
  132. {$setc TARGET_CPU_X86_64 := FALSE}
  133. {$setc TARGET_CPU_ARM := TRUE}
  134. {$setc TARGET_CPU_ARM64 := FALSE}
  135. { will require compiler define when/if other Apple devices with ARM cpus ship }
  136. {$setc TARGET_OS_MAC := FALSE}
  137. {$setc TARGET_OS_IPHONE := TRUE}
  138. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  139. {$setc TARGET_OS_EMBEDDED := TRUE}
  140. {$elifc defined __arm64__ and __arm64__}
  141. {$setc TARGET_CPU_PPC := FALSE}
  142. {$setc TARGET_CPU_PPC64 := FALSE}
  143. {$setc TARGET_CPU_X86 := FALSE}
  144. {$setc TARGET_CPU_X86_64 := FALSE}
  145. {$setc TARGET_CPU_ARM := FALSE}
  146. {$setc TARGET_CPU_ARM64 := TRUE}
  147. { will require compiler define when/if other Apple devices with ARM cpus ship }
  148. {$setc TARGET_OS_MAC := FALSE}
  149. {$setc TARGET_OS_IPHONE := TRUE}
  150. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  151. {$setc TARGET_OS_EMBEDDED := TRUE}
  152. {$elsec}
  153. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
  154. {$endc}
  155. {$ifc defined __LP64__ and __LP64__ }
  156. {$setc TARGET_CPU_64 := TRUE}
  157. {$elsec}
  158. {$setc TARGET_CPU_64 := FALSE}
  159. {$endc}
  160. {$ifc defined FPC_BIG_ENDIAN}
  161. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  162. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  163. {$elifc defined FPC_LITTLE_ENDIAN}
  164. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  165. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  166. {$elsec}
  167. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  168. {$endc}
  169. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  170. {$setc CALL_NOT_IN_CARBON := FALSE}
  171. {$setc OLDROUTINENAMES := FALSE}
  172. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  173. {$setc OPAQUE_UPP_TYPES := TRUE}
  174. {$setc OTCARBONAPPLICATION := TRUE}
  175. {$setc OTKERNEL := FALSE}
  176. {$setc PM_USE_SESSION_APIS := TRUE}
  177. {$setc TARGET_API_MAC_CARBON := TRUE}
  178. {$setc TARGET_API_MAC_OS8 := FALSE}
  179. {$setc TARGET_API_MAC_OSX := TRUE}
  180. {$setc TARGET_CARBON := TRUE}
  181. {$setc TARGET_CPU_68K := FALSE}
  182. {$setc TARGET_CPU_MIPS := FALSE}
  183. {$setc TARGET_CPU_SPARC := FALSE}
  184. {$setc TARGET_OS_UNIX := FALSE}
  185. {$setc TARGET_OS_WIN32 := FALSE}
  186. {$setc TARGET_RT_MAC_68881 := FALSE}
  187. {$setc TARGET_RT_MAC_CFM := FALSE}
  188. {$setc TARGET_RT_MAC_MACHO := TRUE}
  189. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  190. {$setc TYPE_BOOL := FALSE}
  191. {$setc TYPE_EXTENDED := FALSE}
  192. {$setc TYPE_LONGLONG := TRUE}
  193. uses MacTypes,CTFontTraits,CFBase,CFArray,CFCharacterSet,CFData,CFDictionary,CFNumber,CFSet,CGBase,CGAffineTransforms;
  194. {$endc} {not MACOSALLINCLUDE}
  195. {$ALIGN POWER}
  196. {!
  197. @header
  198. Thread Safety Information
  199. All functions in this header are thread safe unless otherwise specified.
  200. }
  201. {! --------------------------------------------------------------------------
  202. @group Descriptor Types
  203. }//--------------------------------------------------------------------------
  204. {!
  205. @typedef CTFontDescriptorRef
  206. @abstract The Core Text Font Descriptor reference.
  207. @discussion This is a opaque reference to a font descriptor.
  208. }
  209. type
  210. CTFontDescriptorRef = ^__CTFontDescriptor; { an opaque type }
  211. __CTFontDescriptor = record end;
  212. CTFontDescriptorRefPtr = ^CTFontDescriptorRef;
  213. {!
  214. @function CTFontDescriptorGetTypeID
  215. @abstract Returns the type identifier for Core Text font descriptor
  216. references.
  217. @result The identifier for the opaque type CTFontDescriptorRef.
  218. }
  219. function CTFontDescriptorGetTypeID: CFTypeID; external name '_CTFontDescriptorGetTypeID';
  220. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  221. {! --------------------------------------------------------------------------
  222. @group Descriptor Constants
  223. }//--------------------------------------------------------------------------
  224. {!
  225. @defined kCTFontURLAttribute
  226. @abstract The font URL.
  227. @discussion This is the key for accessing the font URL from the font descriptor. The value associated with this key is a CFURLRef.
  228. }
  229. var kCTFontURLAttribute: CFStringRef; external name '_kCTFontURLAttribute'; (* attribute const *)
  230. (* CT_AVAILABLE_STARTING( __MAC_10_6, __IPHONE_3_2) *)
  231. {!
  232. @defined kCTFontNameAttribute
  233. @abstract The PostScript name.
  234. @discussion This is the key for retrieving the PostScript name from the font descriptor. When matching, this is treated more generically: the system first tries to find fonts with this PostScript name. If none is found, the system tries to find fonts with this family name, and, finally, if still nothing, tries to find fonts with this display name. The value associated with this key is a CFStringRef. If unspecified, defaults to "Helvetica", if unavailable falls back to global font cascade list.
  235. }
  236. var kCTFontNameAttribute: CFStringRef; external name '_kCTFontNameAttribute'; (* attribute const *)
  237. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  238. {!
  239. @defined kCTFontDisplayNameAttribute
  240. @abstract The display name.
  241. @discussion This is the key for accessing the name used to display the font. Most commonly this is the full name. The value associated with this key is a CFStringRef.
  242. }
  243. var kCTFontDisplayNameAttribute: CFStringRef; external name '_kCTFontDisplayNameAttribute'; (* attribute const *)
  244. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  245. {!
  246. @defined kCTFontFamilyNameAttribute
  247. @abstract The family name.
  248. @discussion This is the key for accessing the family name from the font descriptor. The value associated with this key is a CFStringRef.
  249. }
  250. var kCTFontFamilyNameAttribute: CFStringRef; external name '_kCTFontFamilyNameAttribute'; (* attribute const *)
  251. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  252. {!
  253. @defined kCTFontStyleNameAttribute
  254. @abstract The style name.
  255. @discussion This is the key for accessing the style name of the font. This name represents the designer's description of the font's style. The value associated with this key is a CFStringRef.
  256. }
  257. var kCTFontStyleNameAttribute: CFStringRef; external name '_kCTFontStyleNameAttribute'; (* attribute const *)
  258. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  259. {!
  260. @defined kCTFontTraitsAttribute
  261. @abstract The font traits dictionary.
  262. @discussion This is the key for accessing the dictionary of font traits for stylistic information. See CTFontTraits.h for the list of font traits. The value associated with this key is a CFDictionaryRef.
  263. }
  264. var kCTFontTraitsAttribute: CFStringRef; external name '_kCTFontTraitsAttribute'; (* attribute const *)
  265. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  266. {!
  267. @defined kCTFontVariationAttribute
  268. @abstract The font variation dictionary.
  269. @discussion This key is used to obtain the font variation instance as a CFDictionaryRef. If specified in a font descriptor, fonts with the specified axes will be primary match candidates, if no such fonts exist, this attribute will be ignored.
  270. }
  271. var kCTFontVariationAttribute: CFStringRef; external name '_kCTFontVariationAttribute'; (* attribute const *)
  272. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  273. {!
  274. @defined kCTFontSizeAttribute
  275. @abstract The font point size.
  276. @discussion This key is used to obtain or specify the font point size. Creating a font with this unspecified will default to a point size of 12.0. The value for this key is represented as a CFNumberRef.
  277. }
  278. var kCTFontSizeAttribute: CFStringRef; external name '_kCTFontSizeAttribute'; (* attribute const *)
  279. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  280. {!
  281. @defined kCTFontMatrixAttribute
  282. @abstract The font transformation matrix.
  283. @discussion This key is used to specify the font transformation matrix when creating a font. The default value is CGAffineTransformIdentity. The value for this key is a CFDataRef containing a CGAffineTransform, of which only the a, b, c, and d fields are used.
  284. }
  285. var kCTFontMatrixAttribute: CFStringRef; external name '_kCTFontMatrixAttribute'; (* attribute const *)
  286. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  287. {!
  288. @defined kCTFontCascadeListAttribute
  289. @abstract The font cascade list.
  290. @discussion This key is used to specify or obtain the cascade list used for a font reference. The cascade list is a CFArrayRef containing CTFontDescriptorRefs. If unspecified, the global cascade list is used.
  291. }
  292. var kCTFontCascadeListAttribute: CFStringRef; external name '_kCTFontCascadeListAttribute'; (* attribute const *)
  293. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  294. {!
  295. @defined kCTFontCharacterSetAttribute
  296. @abstract The font unicode character coverage set.
  297. @discussion This key is used to specify or obtain the character set for a font reference. This value for this key is a CFCharacterSetRef. If specified this can be used to restrict the font to a subset of its actual character set. If unspecified this attribute is ignored and the actual character set is used.
  298. }
  299. var kCTFontCharacterSetAttribute: CFStringRef; external name '_kCTFontCharacterSetAttribute'; (* attribute const *)
  300. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  301. {!
  302. @defined kCTFontLanguagesAttribute
  303. @abstract The list of supported languages.
  304. @discussion This key is used to specify or obtain a list of covered languages for a font reference. The value for this key is a CFArrayRef of CFStringRefs. If specified this restricts the search to matching fonts that support the specified languages. The language identifier string should conform to the BCP 47 standard. If unspecified this attribute is ignored.
  305. }
  306. var kCTFontLanguagesAttribute: CFStringRef; external name '_kCTFontLanguagesAttribute'; (* attribute const *)
  307. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  308. {!
  309. @defined kCTFontBaselineAdjustAttribute
  310. @abstract The baseline adjustment to apply to font metrics.
  311. @discussion This key is used to specify or obtain the baseline adjustment for a font reference. This is primary used when defining font descriptors for a cascade list to keep the baseline of all fonts even. The value associated with this is a float represented as a CFNumberRef.
  312. }
  313. var kCTFontBaselineAdjustAttribute: CFStringRef; external name '_kCTFontBaselineAdjustAttribute'; (* attribute const *)
  314. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  315. {!
  316. @defined kCTFontMacintoshEncodingsAttribute
  317. @abstract The macintosh encodings attribute.
  318. @discussion This key is used to specify or obtain the macintosh encodings for a font reference. The value associated with this key is a CFNumberRef containing a bitfield of the Macintosh encodings. This attribute is provided for legacy compatibility.
  319. }
  320. var kCTFontMacintoshEncodingsAttribute: CFStringRef; external name '_kCTFontMacintoshEncodingsAttribute'; (* attribute const *)
  321. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  322. {!
  323. @defined kCTFontFeaturesAttribute
  324. @abstract The array of font features.
  325. @discussion This key is used to specify or obtain the font features for a font reference. The value associated with this key is a CFArrayRef of font feature dictionaries. This features list contains the feature information from the 'feat' table of the font. See the CTFontCopyFeatures() API in CTFont.h.
  326. }
  327. var kCTFontFeaturesAttribute: CFStringRef; external name '_kCTFontFeaturesAttribute'; (* attribute const *)
  328. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  329. {!
  330. @defined kCTFontFeatureSettingsAttribute
  331. @abstract The array of font settings.
  332. @discussion This key is used to specify or obtain the font features settings for a font reference. The value associated with this key is a CFArrayRef of font feature setting dictionaries. A setting dictionary contains a tuple of a kCTFontFeatureTypeIdentifierKey key-value pair and a kCTFontFeatureSelectorIdentifierKey key-value pair. Each setting dictionary indicates which setting should be turned on. In the case of duplicate or conflicting setting the last setting in the list will take precedence. It is the caller's responsibility to handle exclusive and non-exclusive settings as necessary.
  333. }
  334. var kCTFontFeatureSettingsAttribute: CFStringRef; external name '_kCTFontFeatureSettingsAttribute'; (* attribute const *)
  335. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  336. {!
  337. @defined kCTFontFixedAdvanceAttribute
  338. @abstract Specifies advance width.
  339. @discussion This key is used to specify a constant advance width, which affects the glyph metrics of any font instance created with this key; it overrides font values and the font transformation matrix, if any. The value associated with this key must be a CFNumberRef.
  340. }
  341. var kCTFontFixedAdvanceAttribute: CFStringRef; external name '_kCTFontFixedAdvanceAttribute'; (* attribute const *)
  342. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  343. {!
  344. @defined kCTFontOrientationAttribute
  345. @abstract The orientation attribute.
  346. @discussion This key is used to specify a particular orientation for the glyphs of the font. The value associated with this key is a int as a CFNumberRef. If you want to receive vertical metrics from a font for vertical rendering, specify kCTFontVerticalOrientation. If unspecified, the font will use its native orientation.
  347. }
  348. var kCTFontOrientationAttribute: CFStringRef; external name '_kCTFontOrientationAttribute'; (* attribute const *)
  349. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  350. {!
  351. @enum CTFontOrientation
  352. @abstract Specifies the intended rendering orientation of the font for obtaining glyph metrics.
  353. }
  354. const
  355. kCTFontOrientationDefault = 0;
  356. kCTFontOrientationHorizontal = 1;
  357. kCTFontOrientationVertical = 2;
  358. kCTFontDefaultOrientation = kCTFontOrientationDefault;
  359. kCTFontHorizontalOrientation = kCTFontOrientationHorizontal;
  360. kCTFontVerticalOrientation = kCTFontOrientationVertical;
  361. type
  362. CTFontOrientation = UInt32;
  363. {!
  364. @defined kCTFontFormatAttribute
  365. @abstract Specifies the recognized format of the font.
  366. @discussion The attribute is used to specify or obtain the format of the font. The returned value is a CFNumber containing one of the constants defined below.
  367. }
  368. var kCTFontFormatAttribute: CFStringRef; external name '_kCTFontFormatAttribute'; (* attribute const *)
  369. (* CT_AVAILABLE_STARTING( __MAC_10_6, __IPHONE_3_2) *)
  370. {!
  371. @constant kCTFontFormatUnrecognized
  372. The font is not a recognized format
  373. @constant kCTFontFormatOpenTypePostScript
  374. The font is an OpenType format containing PostScript data
  375. @constant kCTFontFormatOpenTypeTrueType
  376. The font is an OpenType format containing TrueType data
  377. @constant kCTFontFormatTrueType
  378. The font is a recognized TrueType format
  379. @constant kCTFontFormatPostScript
  380. The font is a recognized PostScript format
  381. @constant kCTFontFormatBitmap
  382. The font is a bitmap only format
  383. }
  384. const
  385. kCTFontFormatUnrecognized = 0;
  386. kCTFontFormatOpenTypePostScript = 1;
  387. kCTFontFormatOpenTypeTrueType = 2;
  388. kCTFontFormatTrueType = 3;
  389. kCTFontFormatPostScript = 4;
  390. kCTFontFormatBitmap = 5;
  391. type
  392. CTFontFormat = UInt32;
  393. {!
  394. @defined kCTFontRegistrationScopeAttribute
  395. @abstract Specifies the font descriptor's registration scope.
  396. @discussion The attribute is used to specify or obtain the font registration scope. The value returned is a CFNumberRef containing one of the CTFontManagerScope enumerated values. A value of NULL can be returned for font descriptors that are not registered.
  397. }
  398. var kCTFontRegistrationScopeAttribute: CFStringRef; external name '_kCTFontRegistrationScopeAttribute'; (* attribute const *)
  399. (* CT_AVAILABLE_STARTING( __MAC_10_6, __IPHONE_3_2) *)
  400. {!
  401. @defined kCTFontPriorityAttribute
  402. @abstract The font descriptors priority when resolving duplicates and sorting match results.
  403. @discussion This key is used to obtain or specify the font priority. The value returned is a CFNumberRef containing an integer value as defined below. The higher the value, the higher the priority of the font. Only registered fonts will have a priority. Unregistered font descriptors will return NULL.
  404. }
  405. var kCTFontPriorityAttribute: CFStringRef; external name '_kCTFontPriorityAttribute'; (* attribute const *)
  406. (* CT_AVAILABLE_STARTING( __MAC_10_6, __IPHONE_3_2) *)
  407. {!
  408. @constant kCTFontPrioritySystem
  409. Priority of system fonts (located in /System/Library/Fonts).
  410. @constant kCTFontPriorityNetwork
  411. Priority of network fonts (located in /Network/Library/Fonts).
  412. @constant kCTFontPriorityComputer
  413. Priority of computer local fonts (located in /Library/Fonts).
  414. @constant kCTFontPriorityUser
  415. Priority of local fonts (located in user's Library/Fonts).
  416. @constant kCTFontPriorityDynamic
  417. Priority of fonts registered dynamically, not located in a standard location (either kCTFontManagerScopeUser, or kCTFontManagerScopeSession).
  418. @constant kCTFontPriorityProcess
  419. Priority of fonts registered for the process (kCTFontManagerScopeProcess).
  420. }
  421. const
  422. kCTFontPrioritySystem = 10000;
  423. kCTFontPriorityNetwork = 20000;
  424. kCTFontPriorityComputer = 30000;
  425. kCTFontPriorityUser = 40000;
  426. kCTFontPriorityDynamic = 50000;
  427. kCTFontPriorityProcess = 60000;
  428. type
  429. CTFontPriority = UInt32;
  430. {!
  431. @defined kCTFontEnabledAttribute
  432. @abstract The font enabled state.
  433. @discussion This key is used to obtain the font state. The returned value is a CFNumberRef representing a boolean value. Unregistered font descriptors will return NULL, which is equivalent to false.
  434. }
  435. var kCTFontEnabledAttribute: CFStringRef; external name '_kCTFontEnabledAttribute'; (* attribute const *)
  436. (* CT_AVAILABLE_STARTING( __MAC_10_6, __IPHONE_3_2) *)
  437. {! --------------------------------------------------------------------------
  438. @group Descriptor Creation
  439. }//--------------------------------------------------------------------------
  440. {!
  441. @function CTFontDescriptorCreateWithNameAndSize
  442. @abstract Creates a new font descriptor with the provided PostScript name and size.
  443. @param name
  444. The PostScript name to be used for the font descriptor as a CFStringRef.
  445. @param size
  446. The point size. If 0.0, the kCTFontSizeAttribute will be omitted from the font descriptor.
  447. @result This function creates a new font descriptor reference with the given PostScript name and point size.
  448. }
  449. function CTFontDescriptorCreateWithNameAndSize( name: CFStringRef; size: CGFloat ): CTFontDescriptorRef; external name '_CTFontDescriptorCreateWithNameAndSize';
  450. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  451. {!
  452. @function CTFontDescriptorCreateWithAttributes
  453. @abstract Creates a new font descriptor reference from a dictionary of attributes.
  454. @param attributes
  455. A CFDictionaryRef of arbitrary attributes.
  456. @result This function creates a new font descriptor with the attributes specified. This dictionary can contain arbitrary attributes that will be preserved, however unrecognized attributes will be ignored on font creation and and may not be preserved over the round trip (descriptor -> font -> descriptor).
  457. }
  458. function CTFontDescriptorCreateWithAttributes( attributes: CFDictionaryRef ): CTFontDescriptorRef; external name '_CTFontDescriptorCreateWithAttributes';
  459. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  460. {!
  461. @function CTFontDescriptorCreateCopyWithAttributes
  462. @abstract Creates a copy of the original font descriptor with new attributes.
  463. @param original
  464. The original font descriptor reference.
  465. @param attributes
  466. A CFDictionaryRef of arbitrary attributes.
  467. @result This function creates a new copy of the original font descriptor with attributes augmented by those specified. If there are conflicts between attributes, the new attributes will replace existing ones, except for kCTFontVariationAttribute and kCTFontFeatureSettingsAttribute which will be merged.
  468. }
  469. function CTFontDescriptorCreateCopyWithAttributes( original: CTFontDescriptorRef; attributes: CFDictionaryRef ): CTFontDescriptorRef; external name '_CTFontDescriptorCreateCopyWithAttributes';
  470. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  471. {!
  472. @function CTFontDescriptorCreateCopyWithVariation
  473. @abstract Creates a copy of the original font descriptor with a new variation instance.
  474. @param original
  475. The original font descriptor reference.
  476. @param variationIdentifier
  477. The variation axis identifier. This is the four character code of the variation axis as a CFNumberRef.
  478. @param variationValue
  479. The value corresponding with the variation instance.
  480. @result This function returns a copy of the original font descriptor with a new variation instance. This is a convenience method for easily creating new variation font instances.
  481. }
  482. function CTFontDescriptorCreateCopyWithVariation( original: CTFontDescriptorRef; variationIdentifier: CFNumberRef; variationValue: CGFloat ): CTFontDescriptorRef; external name '_CTFontDescriptorCreateCopyWithVariation';
  483. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  484. {!
  485. @function CTFontDescriptorCreateCopyWithFeature
  486. @abstract Copies a font descriptor with new feature setting.
  487. @discussion This is a convenience method to more easily toggle the state of individual features.
  488. @param original
  489. The original font descriptor reference.
  490. @param featureTypeIdentifier
  491. The feature type identifier.
  492. @param featureSelectorIdentifier
  493. The feature selector identifier.
  494. @result A copy of the original font descriptor modified with the given feature settings.
  495. }
  496. function CTFontDescriptorCreateCopyWithFeature( original: CTFontDescriptorRef; featureTypeIdentifier: CFNumberRef; featureSelectorIdentifier: CFNumberRef ): CTFontDescriptorRef; external name '_CTFontDescriptorCreateCopyWithFeature';
  497. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  498. {!
  499. @function CTFontDescriptorCreateMatchingFontDescriptors
  500. @abstract Returns an array of font normalized font descriptors matching the provided descriptor.
  501. @param descriptor
  502. The font descriptor reference.
  503. @param mandatoryAttributes
  504. A set of attribute keys which are required to be identically matched in any returned font descriptors. Optional.
  505. @result This function returns a retained array of normalized font descriptors matching the attributes present in descriptor. If descriptor itself is normalized then the array will contain only one item, the original descriptor.
  506. }
  507. function CTFontDescriptorCreateMatchingFontDescriptors( descriptor: CTFontDescriptorRef; mandatoryAttributes: CFSetRef ): CFArrayRef; external name '_CTFontDescriptorCreateMatchingFontDescriptors';
  508. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  509. {!
  510. @function CTFontDescriptorCreateMatchingFontDescriptor
  511. @abstract Returns an the single preferred matching font descriptor based on the original descriptor and system precedence.
  512. @param descriptor
  513. The font descriptor reference.
  514. @param mandatoryAttributes
  515. A set of attribute keys which are required to be identically matched in any returned font descriptors. Optional.
  516. @result This function returns a retained normalized font descriptor matching the attributes present in descriptor. The original descriptor may be returned in normalized form.
  517. }
  518. function CTFontDescriptorCreateMatchingFontDescriptor( descriptor: CTFontDescriptorRef; mandatoryAttributes: CFSetRef ): CTFontDescriptorRef; external name '_CTFontDescriptorCreateMatchingFontDescriptor';
  519. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  520. {! --------------------------------------------------------------------------
  521. @group Descriptor Accessors
  522. }//--------------------------------------------------------------------------
  523. {!
  524. @function CTFontDescriptorCopyAttributes
  525. @abstract Returns the attributes dictionary of the font descriptor.
  526. @param descriptor
  527. The font descriptor reference.
  528. @result A retained reference to the font descriptor attributes dictionary. This dictionary will contain the minimum number of attributes to fully specify this particular font descriptor.
  529. }
  530. function CTFontDescriptorCopyAttributes( descriptor: CTFontDescriptorRef ): CFDictionaryRef; external name '_CTFontDescriptorCopyAttributes';
  531. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  532. {!
  533. @function CTFontDescriptorCopyAttribute
  534. @abstract Returns the value associated with an arbitrary attribute.
  535. @param descriptor
  536. The font descriptor.
  537. @param attribute
  538. The requested attribute.
  539. @result A retained reference to the requested attribute, or NULL if the requested attribute is not present. Refer to the attribute definitions for documentation as to how each attribute is packaged as a CFType.
  540. }
  541. function CTFontDescriptorCopyAttribute( descriptor: CTFontDescriptorRef; attribute: CFStringRef ): CFTypeRef; external name '_CTFontDescriptorCopyAttribute';
  542. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  543. {!
  544. function CTFontDescriptorCopyLocalizedAttribute
  545. @abstract Returns a localized value for the requested attribute if available.
  546. @discussion This function returns a localized attribute based on the global language list. If localization is not possible for the attribute the behavior matches CTFontDescriptorCopyAttribute(). Generally, localization of attributes is only applicable to name attributes of a normalized font descriptor.
  547. @param descriptor
  548. The font descriptor reference.
  549. @param attribute
  550. The requested font attribute.
  551. @param language
  552. If non-NULL, this will be receive a retained reference to the matched language. The language identifier will conform to the BCP 47 standard.
  553. @result A retained reference to the requested attribute, or NULL if the requested attribute is not present. Refer to the attribute definitions for documentation as to how each attribute is packaged as a CFType.
  554. }
  555. function CTFontDescriptorCopyLocalizedAttribute( descriptor: CTFontDescriptorRef; attribute: CFStringRef; language: CFStringRefPtr {can be null} ): CFTypeRef; external name '_CTFontDescriptorCopyLocalizedAttribute';
  556. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  557. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  558. end.
  559. {$endc} {not MACOSALLINCLUDE}