CTFontDescriptor.pas 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745
  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. { Pascal Translation Updated: Jonas Maebe, <[email protected]>, August 2015 }
  11. {
  12. Modified for use with Free Pascal
  13. Version 308
  14. Please report any bugs to <[email protected]>
  15. }
  16. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  17. {$mode macpas}
  18. {$modeswitch cblocks}
  19. {$packenum 1}
  20. {$macro on}
  21. {$inline on}
  22. {$calling mwpascal}
  23. unit CTFontDescriptor;
  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 not defined __arm64__ and defined CPUAARCH64}
  62. {$setc __arm64__ := 1}
  63. {$elsec}
  64. {$setc __arm64__ := 0}
  65. {$endc}
  66. {$ifc defined cpu64}
  67. {$setc __LP64__ := 1}
  68. {$elsec}
  69. {$setc __LP64__ := 0}
  70. {$endc}
  71. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  72. {$error Conflicting definitions for __ppc__ and __i386__}
  73. {$endc}
  74. {$ifc defined __ppc__ and __ppc__}
  75. {$setc TARGET_CPU_PPC := TRUE}
  76. {$setc TARGET_CPU_PPC64 := FALSE}
  77. {$setc TARGET_CPU_X86 := FALSE}
  78. {$setc TARGET_CPU_X86_64 := FALSE}
  79. {$setc TARGET_CPU_ARM := FALSE}
  80. {$setc TARGET_CPU_ARM64 := FALSE}
  81. {$setc TARGET_OS_MAC := TRUE}
  82. {$setc TARGET_OS_IPHONE := FALSE}
  83. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  84. {$setc TARGET_OS_EMBEDDED := FALSE}
  85. {$elifc defined __ppc64__ and __ppc64__}
  86. {$setc TARGET_CPU_PPC := FALSE}
  87. {$setc TARGET_CPU_PPC64 := TRUE}
  88. {$setc TARGET_CPU_X86 := FALSE}
  89. {$setc TARGET_CPU_X86_64 := FALSE}
  90. {$setc TARGET_CPU_ARM := FALSE}
  91. {$setc TARGET_CPU_ARM64 := FALSE}
  92. {$setc TARGET_OS_MAC := TRUE}
  93. {$setc TARGET_OS_IPHONE := FALSE}
  94. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  95. {$setc TARGET_OS_EMBEDDED := FALSE}
  96. {$elifc defined __i386__ and __i386__}
  97. {$setc TARGET_CPU_PPC := FALSE}
  98. {$setc TARGET_CPU_PPC64 := FALSE}
  99. {$setc TARGET_CPU_X86 := TRUE}
  100. {$setc TARGET_CPU_X86_64 := FALSE}
  101. {$setc TARGET_CPU_ARM := FALSE}
  102. {$setc TARGET_CPU_ARM64 := FALSE}
  103. {$ifc defined(iphonesim)}
  104. {$setc TARGET_OS_MAC := FALSE}
  105. {$setc TARGET_OS_IPHONE := TRUE}
  106. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  107. {$elsec}
  108. {$setc TARGET_OS_MAC := TRUE}
  109. {$setc TARGET_OS_IPHONE := FALSE}
  110. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  111. {$endc}
  112. {$setc TARGET_OS_EMBEDDED := FALSE}
  113. {$elifc defined __x86_64__ and __x86_64__}
  114. {$setc TARGET_CPU_PPC := FALSE}
  115. {$setc TARGET_CPU_PPC64 := FALSE}
  116. {$setc TARGET_CPU_X86 := FALSE}
  117. {$setc TARGET_CPU_X86_64 := TRUE}
  118. {$setc TARGET_CPU_ARM := FALSE}
  119. {$setc TARGET_CPU_ARM64 := FALSE}
  120. {$ifc defined(iphonesim)}
  121. {$setc TARGET_OS_MAC := FALSE}
  122. {$setc TARGET_OS_IPHONE := TRUE}
  123. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  124. {$elsec}
  125. {$setc TARGET_OS_MAC := TRUE}
  126. {$setc TARGET_OS_IPHONE := FALSE}
  127. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  128. {$endc}
  129. {$setc TARGET_OS_EMBEDDED := FALSE}
  130. {$elifc defined __arm__ and __arm__}
  131. {$setc TARGET_CPU_PPC := FALSE}
  132. {$setc TARGET_CPU_PPC64 := FALSE}
  133. {$setc TARGET_CPU_X86 := FALSE}
  134. {$setc TARGET_CPU_X86_64 := FALSE}
  135. {$setc TARGET_CPU_ARM := TRUE}
  136. {$setc TARGET_CPU_ARM64 := FALSE}
  137. { will require compiler define when/if other Apple devices with ARM cpus ship }
  138. {$setc TARGET_OS_MAC := FALSE}
  139. {$setc TARGET_OS_IPHONE := TRUE}
  140. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  141. {$setc TARGET_OS_EMBEDDED := TRUE}
  142. {$elifc defined __arm64__ and __arm64__}
  143. {$setc TARGET_CPU_PPC := FALSE}
  144. {$setc TARGET_CPU_PPC64 := FALSE}
  145. {$setc TARGET_CPU_X86 := FALSE}
  146. {$setc TARGET_CPU_X86_64 := FALSE}
  147. {$setc TARGET_CPU_ARM := FALSE}
  148. {$setc TARGET_CPU_ARM64 := TRUE}
  149. { will require compiler define when/if other Apple devices with ARM cpus ship }
  150. {$setc TARGET_OS_MAC := FALSE}
  151. {$setc TARGET_OS_IPHONE := TRUE}
  152. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  153. {$setc TARGET_OS_EMBEDDED := TRUE}
  154. {$elsec}
  155. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
  156. {$endc}
  157. {$ifc defined __LP64__ and __LP64__ }
  158. {$setc TARGET_CPU_64 := TRUE}
  159. {$elsec}
  160. {$setc TARGET_CPU_64 := FALSE}
  161. {$endc}
  162. {$ifc defined FPC_BIG_ENDIAN}
  163. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  164. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  165. {$elifc defined FPC_LITTLE_ENDIAN}
  166. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  167. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  168. {$elsec}
  169. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  170. {$endc}
  171. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  172. {$setc CALL_NOT_IN_CARBON := FALSE}
  173. {$setc OLDROUTINENAMES := FALSE}
  174. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  175. {$setc OPAQUE_UPP_TYPES := TRUE}
  176. {$setc OTCARBONAPPLICATION := TRUE}
  177. {$setc OTKERNEL := FALSE}
  178. {$setc PM_USE_SESSION_APIS := TRUE}
  179. {$setc TARGET_API_MAC_CARBON := TRUE}
  180. {$setc TARGET_API_MAC_OS8 := FALSE}
  181. {$setc TARGET_API_MAC_OSX := TRUE}
  182. {$setc TARGET_CARBON := TRUE}
  183. {$setc TARGET_CPU_68K := FALSE}
  184. {$setc TARGET_CPU_MIPS := FALSE}
  185. {$setc TARGET_CPU_SPARC := FALSE}
  186. {$setc TARGET_OS_UNIX := FALSE}
  187. {$setc TARGET_OS_WIN32 := FALSE}
  188. {$setc TARGET_RT_MAC_68881 := FALSE}
  189. {$setc TARGET_RT_MAC_CFM := FALSE}
  190. {$setc TARGET_RT_MAC_MACHO := TRUE}
  191. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  192. {$setc TYPE_BOOL := FALSE}
  193. {$setc TYPE_EXTENDED := FALSE}
  194. {$setc TYPE_LONGLONG := TRUE}
  195. uses MacTypes,CTFontTraits,CFBase,CFArray,CFCharacterSet,CFData,CFDictionary,CFNumber,CFSet,CGBase,CGAffineTransforms;
  196. {$endc} {not MACOSALLINCLUDE}
  197. {$ALIGN POWER}
  198. {!
  199. @header
  200. Thread Safety Information
  201. All functions in this header are thread safe unless otherwise specified.
  202. }
  203. {! --------------------------------------------------------------------------
  204. @group Descriptor Types
  205. }//--------------------------------------------------------------------------
  206. {!
  207. @typedef CTFontDescriptorRef
  208. @abstract The Core Text Font Descriptor reference.
  209. @discussion This is a opaque reference to a font descriptor.
  210. }
  211. type
  212. CTFontDescriptorRef = ^__CTFontDescriptor; { an opaque type }
  213. __CTFontDescriptor = record end;
  214. CTFontDescriptorRefPtr = ^CTFontDescriptorRef;
  215. {!
  216. @function CTFontDescriptorGetTypeID
  217. @abstract Returns the type identifier for Core Text font descriptor
  218. references.
  219. @result The identifier for the opaque type CTFontDescriptorRef.
  220. }
  221. function CTFontDescriptorGetTypeID: CFTypeID; external name '_CTFontDescriptorGetTypeID';
  222. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  223. {! --------------------------------------------------------------------------
  224. @group Descriptor Constants
  225. }//--------------------------------------------------------------------------
  226. {!
  227. @defined kCTFontURLAttribute
  228. @abstract The font URL.
  229. @discussion This is the key for accessing the font URL from the font descriptor. The value associated with this key is a CFURLRef.
  230. }
  231. var kCTFontURLAttribute: CFStringRef; external name '_kCTFontURLAttribute'; (* attribute const *)
  232. (* CT_AVAILABLE_STARTING( __MAC_10_6, __IPHONE_3_2) *)
  233. {!
  234. @defined kCTFontNameAttribute
  235. @abstract The PostScript name.
  236. @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.
  237. }
  238. var kCTFontNameAttribute: CFStringRef; external name '_kCTFontNameAttribute'; (* attribute const *)
  239. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  240. {!
  241. @defined kCTFontDisplayNameAttribute
  242. @abstract The display name.
  243. @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.
  244. }
  245. var kCTFontDisplayNameAttribute: CFStringRef; external name '_kCTFontDisplayNameAttribute'; (* attribute const *)
  246. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  247. {!
  248. @defined kCTFontFamilyNameAttribute
  249. @abstract The family name.
  250. @discussion This is the key for accessing the family name from the font descriptor. The value associated with this key is a CFStringRef.
  251. }
  252. var kCTFontFamilyNameAttribute: CFStringRef; external name '_kCTFontFamilyNameAttribute'; (* attribute const *)
  253. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  254. {!
  255. @defined kCTFontStyleNameAttribute
  256. @abstract The style name.
  257. @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.
  258. }
  259. var kCTFontStyleNameAttribute: CFStringRef; external name '_kCTFontStyleNameAttribute'; (* attribute const *)
  260. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  261. {!
  262. @defined kCTFontTraitsAttribute
  263. @abstract The font traits dictionary.
  264. @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.
  265. }
  266. var kCTFontTraitsAttribute: CFStringRef; external name '_kCTFontTraitsAttribute'; (* attribute const *)
  267. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  268. {!
  269. @defined kCTFontVariationAttribute
  270. @abstract The font variation dictionary.
  271. @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.
  272. }
  273. var kCTFontVariationAttribute: CFStringRef; external name '_kCTFontVariationAttribute'; (* attribute const *)
  274. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  275. {!
  276. @defined kCTFontSizeAttribute
  277. @abstract The font point size.
  278. @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.
  279. }
  280. var kCTFontSizeAttribute: CFStringRef; external name '_kCTFontSizeAttribute'; (* attribute const *)
  281. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  282. {!
  283. @defined kCTFontMatrixAttribute
  284. @abstract The font transformation matrix.
  285. @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.
  286. }
  287. var kCTFontMatrixAttribute: CFStringRef; external name '_kCTFontMatrixAttribute'; (* attribute const *)
  288. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  289. {!
  290. @defined kCTFontCascadeListAttribute
  291. @abstract The font cascade list.
  292. @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.
  293. }
  294. var kCTFontCascadeListAttribute: CFStringRef; external name '_kCTFontCascadeListAttribute'; (* attribute const *)
  295. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  296. {!
  297. @defined kCTFontCharacterSetAttribute
  298. @abstract The font unicode character coverage set.
  299. @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.
  300. }
  301. var kCTFontCharacterSetAttribute: CFStringRef; external name '_kCTFontCharacterSetAttribute'; (* attribute const *)
  302. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  303. {!
  304. @defined kCTFontLanguagesAttribute
  305. @abstract The list of supported languages.
  306. @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.
  307. }
  308. var kCTFontLanguagesAttribute: CFStringRef; external name '_kCTFontLanguagesAttribute'; (* attribute const *)
  309. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  310. {!
  311. @defined kCTFontBaselineAdjustAttribute
  312. @abstract The baseline adjustment to apply to font metrics.
  313. @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.
  314. }
  315. var kCTFontBaselineAdjustAttribute: CFStringRef; external name '_kCTFontBaselineAdjustAttribute'; (* attribute const *)
  316. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  317. {!
  318. @defined kCTFontMacintoshEncodingsAttribute
  319. @abstract The macintosh encodings attribute.
  320. @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.
  321. }
  322. var kCTFontMacintoshEncodingsAttribute: CFStringRef; external name '_kCTFontMacintoshEncodingsAttribute'; (* attribute const *)
  323. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  324. {!
  325. @defined kCTFontFeaturesAttribute
  326. @abstract The array of font features.
  327. @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.
  328. }
  329. var kCTFontFeaturesAttribute: CFStringRef; external name '_kCTFontFeaturesAttribute'; (* attribute const *)
  330. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  331. {!
  332. @defined kCTFontFeatureSettingsAttribute
  333. @abstract The array of font settings.
  334. @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.
  335. }
  336. var kCTFontFeatureSettingsAttribute: CFStringRef; external name '_kCTFontFeatureSettingsAttribute'; (* attribute const *)
  337. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  338. {!
  339. @defined kCTFontFixedAdvanceAttribute
  340. @abstract Specifies advance width.
  341. @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.
  342. }
  343. var kCTFontFixedAdvanceAttribute: CFStringRef; external name '_kCTFontFixedAdvanceAttribute'; (* attribute const *)
  344. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  345. {!
  346. @defined kCTFontOrientationAttribute
  347. @abstract The orientation attribute.
  348. @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.
  349. }
  350. var kCTFontOrientationAttribute: CFStringRef; external name '_kCTFontOrientationAttribute'; (* attribute const *)
  351. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  352. {!
  353. @enum CTFontOrientation
  354. @abstract Specifies the intended rendering orientation of the font for obtaining glyph metrics.
  355. }
  356. const
  357. kCTFontOrientationDefault = 0;
  358. kCTFontOrientationHorizontal = 1;
  359. kCTFontOrientationVertical = 2;
  360. kCTFontDefaultOrientation = kCTFontOrientationDefault;
  361. kCTFontHorizontalOrientation = kCTFontOrientationHorizontal;
  362. kCTFontVerticalOrientation = kCTFontOrientationVertical;
  363. type
  364. CTFontOrientation = UInt32;
  365. {!
  366. @defined kCTFontFormatAttribute
  367. @abstract Specifies the recognized format of the font.
  368. @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.
  369. }
  370. var kCTFontFormatAttribute: CFStringRef; external name '_kCTFontFormatAttribute'; (* attribute const *)
  371. (* CT_AVAILABLE_STARTING( __MAC_10_6, __IPHONE_3_2) *)
  372. {!
  373. @constant kCTFontFormatUnrecognized
  374. The font is not a recognized format
  375. @constant kCTFontFormatOpenTypePostScript
  376. The font is an OpenType format containing PostScript data
  377. @constant kCTFontFormatOpenTypeTrueType
  378. The font is an OpenType format containing TrueType data
  379. @constant kCTFontFormatTrueType
  380. The font is a recognized TrueType format
  381. @constant kCTFontFormatPostScript
  382. The font is a recognized PostScript format
  383. @constant kCTFontFormatBitmap
  384. The font is a bitmap only format
  385. }
  386. const
  387. kCTFontFormatUnrecognized = 0;
  388. kCTFontFormatOpenTypePostScript = 1;
  389. kCTFontFormatOpenTypeTrueType = 2;
  390. kCTFontFormatTrueType = 3;
  391. kCTFontFormatPostScript = 4;
  392. kCTFontFormatBitmap = 5;
  393. type
  394. CTFontFormat = UInt32;
  395. {!
  396. @defined kCTFontRegistrationScopeAttribute
  397. @abstract Specifies the font descriptor's registration scope.
  398. @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.
  399. }
  400. var kCTFontRegistrationScopeAttribute: CFStringRef; external name '_kCTFontRegistrationScopeAttribute'; (* attribute const *)
  401. (* CT_AVAILABLE_STARTING( __MAC_10_6, __IPHONE_3_2) *)
  402. {!
  403. @defined kCTFontPriorityAttribute
  404. @abstract The font descriptors priority when resolving duplicates and sorting match results.
  405. @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.
  406. }
  407. var kCTFontPriorityAttribute: CFStringRef; external name '_kCTFontPriorityAttribute'; (* attribute const *)
  408. (* CT_AVAILABLE_STARTING( __MAC_10_6, __IPHONE_3_2) *)
  409. {!
  410. @constant kCTFontPrioritySystem
  411. Priority of system fonts (located in /System/Library/Fonts).
  412. @constant kCTFontPriorityNetwork
  413. Priority of network fonts (located in /Network/Library/Fonts).
  414. @constant kCTFontPriorityComputer
  415. Priority of computer local fonts (located in /Library/Fonts).
  416. @constant kCTFontPriorityUser
  417. Priority of local fonts (located in user's Library/Fonts).
  418. @constant kCTFontPriorityDynamic
  419. Priority of fonts registered dynamically, not located in a standard location (either kCTFontManagerScopeUser, or kCTFontManagerScopeSession).
  420. @constant kCTFontPriorityProcess
  421. Priority of fonts registered for the process (kCTFontManagerScopeProcess).
  422. }
  423. const
  424. kCTFontPrioritySystem = 10000;
  425. kCTFontPriorityNetwork = 20000;
  426. kCTFontPriorityComputer = 30000;
  427. kCTFontPriorityUser = 40000;
  428. kCTFontPriorityDynamic = 50000;
  429. kCTFontPriorityProcess = 60000;
  430. type
  431. CTFontPriority = UInt32;
  432. {!
  433. @defined kCTFontEnabledAttribute
  434. @abstract The font enabled state.
  435. @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.
  436. }
  437. var kCTFontEnabledAttribute: CFStringRef; external name '_kCTFontEnabledAttribute'; (* attribute const *)
  438. (* CT_AVAILABLE_STARTING( __MAC_10_6, __IPHONE_3_2) *)
  439. {!
  440. @defined kCTFontDownloadableAttribute
  441. @abstract The font downloadable state.
  442. @discussion The value associated with this key is a CFBoolean. If it is kCFBooleanTrue, CoreText attempts to download a font if necessary when matching a descriptor.
  443. }
  444. var kCTFontDownloadableAttribute: CFStringRef; external name '_kCTFontDownloadableAttribute'; (* attribute const *)
  445. (* CT_AVAILABLE_STARTING( __MAC_10_8, __IPHONE_6_0) *)
  446. {$ifc TARGET_OS_IPHONE}
  447. {!
  448. @defined kCTFontDownloadedAttribute
  449. @abstract The download state.
  450. @discussion The value associated with this key is a CFBoolean. If it is kCFBooleanTrue, corresponding FontAsset has been downloaded. (but still it may be necessary to call appropriate API in order to use the font in the FontAsset.)
  451. }
  452. var kCTFontDownloadedAttribute: CFStringRef; external name '_kCTFontDownloadedAttribute'; (* attribute const *)
  453. (* CT_AVAILABLE_STARTING( __MAC_NA, __IPHONE_7_0) *)
  454. {$endc} {TARGET_OS_IPHONE}
  455. {! --------------------------------------------------------------------------
  456. @group Descriptor Creation
  457. }//--------------------------------------------------------------------------
  458. {!
  459. @function CTFontDescriptorCreateWithNameAndSize
  460. @abstract Creates a new font descriptor with the provided PostScript name and size.
  461. @param name
  462. The PostScript name to be used for the font descriptor as a CFStringRef.
  463. @param size
  464. The point size. If 0.0, the kCTFontSizeAttribute will be omitted from the font descriptor.
  465. @result This function creates a new font descriptor reference with the given PostScript name and point size.
  466. }
  467. function CTFontDescriptorCreateWithNameAndSize( name: CFStringRef; size: CGFloat ): CTFontDescriptorRef; external name '_CTFontDescriptorCreateWithNameAndSize';
  468. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  469. {!
  470. @function CTFontDescriptorCreateWithAttributes
  471. @abstract Creates a new font descriptor reference from a dictionary of attributes.
  472. @param attributes
  473. A CFDictionaryRef of arbitrary attributes.
  474. @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).
  475. }
  476. function CTFontDescriptorCreateWithAttributes( attributes: CFDictionaryRef ): CTFontDescriptorRef; external name '_CTFontDescriptorCreateWithAttributes';
  477. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  478. {!
  479. @function CTFontDescriptorCreateCopyWithAttributes
  480. @abstract Creates a copy of the original font descriptor with new attributes.
  481. @param original
  482. The original font descriptor reference.
  483. @param attributes
  484. A CFDictionaryRef of arbitrary attributes.
  485. @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.
  486. }
  487. function CTFontDescriptorCreateCopyWithAttributes( original: CTFontDescriptorRef; attributes: CFDictionaryRef ): CTFontDescriptorRef; external name '_CTFontDescriptorCreateCopyWithAttributes';
  488. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  489. {!
  490. @function CTFontCreateCopyWithFamily
  491. @abstract Returns a new font descriptor in the specified family based on the traits of the original descriptor.
  492. @param original
  493. The original font descriptor reference.
  494. @param family
  495. The name of the desired family.
  496. @result Returns a new font reference with the original traits in the given family, or NULL if none found in the system.
  497. }
  498. function CTFontDescriptorCreateCopyWithFamily( original: CTFontDescriptorRef; family: CFStringRef ): CTFontDescriptorRef; external name '_CTFontDescriptorCreateCopyWithFamily';
  499. (* CT_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) *)
  500. {!
  501. @function CTFontDescriptorCreateCopyWithSymbolicTraits
  502. @abstract Returns a new font descriptor based on the original descriptor having the specified symbolic traits.
  503. @param original
  504. The original font descriptor reference.
  505. @param symTraitValue
  506. The value of the symbolic traits. This bitfield is used to indicate the desired value for the traits specified by the symTraitMask parameter. Used in conjunction, they can allow for trait removal as well as addition.
  507. @param symTraitMask
  508. The mask bits of the symbolic traits. This bitfield is used to indicate the traits that should be changed.
  509. @result Returns a new font descriptor reference in the same family with the given symbolic traits, or NULL if none found in the system.
  510. }
  511. function CTFontDescriptorCreateCopyWithSymbolicTraits( original: CTFontDescriptorRef; symTraitValue: CTFontSymbolicTraits; symTraitMask: CTFontSymbolicTraits ): CTFontDescriptorRef; external name '_CTFontDescriptorCreateCopyWithSymbolicTraits';
  512. (* CT_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0) *)
  513. {!
  514. @function CTFontDescriptorCreateCopyWithVariation
  515. @abstract Creates a copy of the original font descriptor with a new variation instance.
  516. @param original
  517. The original font descriptor reference.
  518. @param variationIdentifier
  519. The variation axis identifier. This is the four character code of the variation axis as a CFNumberRef.
  520. @param variationValue
  521. The value corresponding with the variation instance.
  522. @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.
  523. }
  524. function CTFontDescriptorCreateCopyWithVariation( original: CTFontDescriptorRef; variationIdentifier: CFNumberRef; variationValue: CGFloat ): CTFontDescriptorRef; external name '_CTFontDescriptorCreateCopyWithVariation';
  525. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  526. {!
  527. @function CTFontDescriptorCreateCopyWithFeature
  528. @abstract Copies a font descriptor with new feature setting.
  529. @discussion This is a convenience method to more easily toggle the state of individual features.
  530. @param original
  531. The original font descriptor reference.
  532. @param featureTypeIdentifier
  533. The feature type identifier.
  534. @param featureSelectorIdentifier
  535. The feature selector identifier.
  536. @result A copy of the original font descriptor modified with the given feature settings.
  537. }
  538. function CTFontDescriptorCreateCopyWithFeature( original: CTFontDescriptorRef; featureTypeIdentifier: CFNumberRef; featureSelectorIdentifier: CFNumberRef ): CTFontDescriptorRef; external name '_CTFontDescriptorCreateCopyWithFeature';
  539. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  540. {!
  541. @function CTFontDescriptorCreateMatchingFontDescriptors
  542. @abstract Returns an array of font normalized font descriptors matching the provided descriptor.
  543. @param descriptor
  544. The font descriptor reference.
  545. @param mandatoryAttributes
  546. A set of attribute keys which are required to be identically matched in any returned font descriptors. Optional.
  547. @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.
  548. }
  549. function CTFontDescriptorCreateMatchingFontDescriptors( descriptor: CTFontDescriptorRef; mandatoryAttributes: CFSetRef ): CFArrayRef; external name '_CTFontDescriptorCreateMatchingFontDescriptors';
  550. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  551. {!
  552. @function CTFontDescriptorCreateMatchingFontDescriptor
  553. @abstract Returns an the single preferred matching font descriptor based on the original descriptor and system precedence.
  554. @param descriptor
  555. The font descriptor reference.
  556. @param mandatoryAttributes
  557. A set of attribute keys which are required to be identically matched in any returned font descriptors. Optional.
  558. @result This function returns a retained normalized font descriptor matching the attributes present in descriptor. The original descriptor may be returned in normalized form.
  559. }
  560. function CTFontDescriptorCreateMatchingFontDescriptor( descriptor: CTFontDescriptorRef; mandatoryAttributes: CFSetRef ): CTFontDescriptorRef; external name '_CTFontDescriptorCreateMatchingFontDescriptor';
  561. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  562. {!
  563. Progress state
  564. }
  565. type
  566. CTFontDescriptorMatchingState = SInt32;
  567. const
  568. kCTFontDescriptorMatchingDidBegin = 0; // called once at the beginning.
  569. kCTFontDescriptorMatchingDidFinish = 1; // called once at the end.
  570. kCTFontDescriptorMatchingWillBeginQuerying = 2; // called once before talking to the server. Skipped if not necessary.
  571. kCTFontDescriptorMatchingStalled = 3; // called when stalled. (e.g. while waiting for server response.)
  572. // Downloading and activating are repeated for each descriptor.
  573. kCTFontDescriptorMatchingWillBeginDownloading = 4; // Downloading part may be skipped if all the assets are already downloaded
  574. kCTFontDescriptorMatchingDownloading = 5;
  575. kCTFontDescriptorMatchingDidFinishDownloading = 6;
  576. kCTFontDescriptorMatchingDidMatch = 7; // called when font descriptor is matched.
  577. kCTFontDescriptorMatchingDidFailWithError = 8; // called when an error occurred. (may be called multiple times.)
  578. {!
  579. keys for progressParameter dictionary.
  580. }
  581. { CTFontDescriptorRef; The current font descriptor. Valid when state is kCTFontDescriptorMatchingDidMatch. }
  582. var kCTFontDescriptorMatchingSourceDescriptor: CFStringRef; external name '_kCTFontDescriptorMatchingSourceDescriptor'; (* attribute const *)
  583. (* CT_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0) *)
  584. { CFArray; Array of descriptors to be queried. Valid while downloading or when state is kCTFontDescriptorMatchingWillBeginQuerying. }
  585. var kCTFontDescriptorMatchingDescriptors: CFStringRef; external name '_kCTFontDescriptorMatchingDescriptors'; (* attribute const *)
  586. (* CT_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0) *)
  587. { CFArray; Array of matched font descriptors. Valid when state is kCTFontDescriptorMatchingDidMatch or CTFontDescriptorMatchingEnd. }
  588. var kCTFontDescriptorMatchingResult: CFStringRef; external name '_kCTFontDescriptorMatchingResult'; (* attribute const *)
  589. (* CT_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0) *)
  590. { CFNumber; Progress in 0 - 100 for the current descriptor. Valid during Downloading state. }
  591. var kCTFontDescriptorMatchingPercentage: CFStringRef; external name '_kCTFontDescriptorMatchingPercentage'; (* attribute const *)
  592. (* CT_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0) *)
  593. { CFNumber; Byte size to download for the current descriptor. Valid during Downloading state. }
  594. var kCTFontDescriptorMatchingCurrentAssetSize: CFStringRef; external name '_kCTFontDescriptorMatchingCurrentAssetSize'; (* attribute const *)
  595. (* CT_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0) *)
  596. { CFNumber; Total downloaded byte size. Valid during Downloading state. }
  597. var kCTFontDescriptorMatchingTotalDownloadedSize: CFStringRef; external name '_kCTFontDescriptorMatchingTotalDownloadedSize'; (* attribute const *)
  598. (* CT_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0) *)
  599. { CFNumber; Total byte size to download. Always valid, but may be Zero when information is not available. }
  600. var kCTFontDescriptorMatchingTotalAssetSize: CFStringRef; external name '_kCTFontDescriptorMatchingTotalAssetSize'; (* attribute const *)
  601. (* CT_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0) *)
  602. { CFError; Valid when state kCTFontDescriptorMatchingDidFailWithError. }
  603. var kCTFontDescriptorMatchingError: CFStringRef; external name '_kCTFontDescriptorMatchingError'; (* attribute const *)
  604. (* CT_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0) *)
  605. {! --------------------------------------------------------------------------
  606. @group Descriptor Accessors
  607. }//--------------------------------------------------------------------------
  608. {!
  609. @function CTFontDescriptorCopyAttributes
  610. @abstract Returns the attributes dictionary of the font descriptor.
  611. @param descriptor
  612. The font descriptor reference.
  613. @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.
  614. }
  615. function CTFontDescriptorCopyAttributes( descriptor: CTFontDescriptorRef ): CFDictionaryRef; external name '_CTFontDescriptorCopyAttributes';
  616. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  617. {!
  618. @function CTFontDescriptorCopyAttribute
  619. @abstract Returns the value associated with an arbitrary attribute.
  620. @param descriptor
  621. The font descriptor.
  622. @param attribute
  623. The requested attribute.
  624. @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.
  625. }
  626. function CTFontDescriptorCopyAttribute( descriptor: CTFontDescriptorRef; attribute: CFStringRef ): CFTypeRef; external name '_CTFontDescriptorCopyAttribute';
  627. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  628. {!
  629. function CTFontDescriptorCopyLocalizedAttribute
  630. @abstract Returns a localized value for the requested attribute if available.
  631. @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.
  632. @param descriptor
  633. The font descriptor reference.
  634. @param attribute
  635. The requested font attribute.
  636. @param language
  637. If non-NULL, this will be receive a retained reference to the matched language. The language identifier will conform to the BCP 47 standard.
  638. @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.
  639. }
  640. function CTFontDescriptorCopyLocalizedAttribute( descriptor: CTFontDescriptorRef; attribute: CFStringRef; language: CFStringRefPtr {can be null} ): CFTypeRef; external name '_CTFontDescriptorCopyLocalizedAttribute';
  641. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  642. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  643. end.
  644. {$endc} {not MACOSALLINCLUDE}