CTFont.pas 74 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651
  1. {
  2. * CTFont.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 CTFont;
  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. {$setc TARGET_OS_MAC := FALSE}
  138. {$setc TARGET_OS_IPHONE := TRUE}
  139. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  140. {$setc TARGET_OS_EMBEDDED := TRUE}
  141. {$elifc defined __arm64__ and __arm64__}
  142. {$setc TARGET_CPU_PPC := FALSE}
  143. {$setc TARGET_CPU_PPC64 := FALSE}
  144. {$setc TARGET_CPU_X86 := FALSE}
  145. {$setc TARGET_CPU_X86_64 := FALSE}
  146. {$setc TARGET_CPU_ARM := FALSE}
  147. {$setc TARGET_CPU_ARM64 := TRUE}
  148. {$ifc defined ios}
  149. {$setc TARGET_OS_MAC := FALSE}
  150. {$setc TARGET_OS_IPHONE := TRUE}
  151. {$setc TARGET_OS_EMBEDDED := TRUE}
  152. {$elsec}
  153. {$setc TARGET_OS_MAC := TRUE}
  154. {$setc TARGET_OS_IPHONE := FALSE}
  155. {$setc TARGET_OS_EMBEDDED := FALSE}
  156. {$endc}
  157. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  158. {$elsec}
  159. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
  160. {$endc}
  161. {$ifc defined __LP64__ and __LP64__ }
  162. {$setc TARGET_CPU_64 := TRUE}
  163. {$elsec}
  164. {$setc TARGET_CPU_64 := FALSE}
  165. {$endc}
  166. {$ifc defined FPC_BIG_ENDIAN}
  167. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  168. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  169. {$elifc defined FPC_LITTLE_ENDIAN}
  170. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  171. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  172. {$elsec}
  173. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  174. {$endc}
  175. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  176. {$setc CALL_NOT_IN_CARBON := FALSE}
  177. {$setc OLDROUTINENAMES := FALSE}
  178. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  179. {$setc OPAQUE_UPP_TYPES := TRUE}
  180. {$setc OTCARBONAPPLICATION := TRUE}
  181. {$setc OTKERNEL := FALSE}
  182. {$setc PM_USE_SESSION_APIS := TRUE}
  183. {$setc TARGET_API_MAC_CARBON := TRUE}
  184. {$setc TARGET_API_MAC_OS8 := FALSE}
  185. {$setc TARGET_API_MAC_OSX := TRUE}
  186. {$setc TARGET_CARBON := TRUE}
  187. {$setc TARGET_CPU_68K := FALSE}
  188. {$setc TARGET_CPU_MIPS := FALSE}
  189. {$setc TARGET_CPU_SPARC := FALSE}
  190. {$setc TARGET_OS_UNIX := FALSE}
  191. {$setc TARGET_OS_WIN32 := FALSE}
  192. {$setc TARGET_RT_MAC_68881 := FALSE}
  193. {$setc TARGET_RT_MAC_CFM := FALSE}
  194. {$setc TARGET_RT_MAC_MACHO := TRUE}
  195. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  196. {$setc TYPE_BOOL := FALSE}
  197. {$setc TYPE_EXTENDED := FALSE}
  198. {$setc TYPE_LONGLONG := TRUE}
  199. uses MacTypes,CTFontDescriptor,CTFontTraits,ATSTypes,CFBase,CFArray,CFCharacterSet,CFData,CFDictionary,CFString,CGBase,CGAffineTransforms,CGContext,CGFont,CGGeometry,CGPath;
  200. {$endc} {not MACOSALLINCLUDE}
  201. {$ALIGN POWER}
  202. {!
  203. @header
  204. Thread Safety Information
  205. All functions in this header are thread safe unless otherwise specified.
  206. }
  207. {! --------------------------------------------------------------------------
  208. @group Font Types
  209. }//--------------------------------------------------------------------------
  210. {!
  211. @typedef CTFontRef
  212. @abstract The Core Text Font reference.
  213. @discussion This is a opaque reference to a core font object.
  214. }
  215. type
  216. CTFontRef = ^__CTFont; { an opaque type }
  217. __CTFont = record end;
  218. {!
  219. @function CTFontGetTypeID
  220. @abstract Returns the type identifier for Core Text font references.
  221. @result The identifier for the opaque type CTFontRef.
  222. }
  223. function CTFontGetTypeID: CFTypeID; external name '_CTFontGetTypeID';
  224. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  225. {! --------------------------------------------------------------------------
  226. @group Font Constants
  227. }//--------------------------------------------------------------------------
  228. // Name specifier constants
  229. {!
  230. @defined kCTFontCopyrightNameKey
  231. @abstract The name specifier for the copyright name.
  232. }
  233. var kCTFontCopyrightNameKey: CFStringRef; external name '_kCTFontCopyrightNameKey'; (* attribute const *)
  234. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  235. {!
  236. @defined kCTFontFamilyNameKey
  237. @abstract The name specifier for the family name.
  238. }
  239. var kCTFontFamilyNameKey: CFStringRef; external name '_kCTFontFamilyNameKey'; (* attribute const *)
  240. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  241. {!
  242. @defined kCTFontSubFamilyNameKey
  243. @abstract The name specifier for the subfamily name.
  244. }
  245. var kCTFontSubFamilyNameKey: CFStringRef; external name '_kCTFontSubFamilyNameKey'; (* attribute const *)
  246. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  247. {!
  248. @defined kCTFontStyleNameKey
  249. @abstract The name specifier for the style name.
  250. }
  251. var kCTFontStyleNameKey: CFStringRef; external name '_kCTFontStyleNameKey'; (* attribute const *)
  252. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  253. {!
  254. @defined kCTFontUniqueNameKey
  255. @abstract The name specifier for the unique name.
  256. @discussion Note that this name is often not unique and should not be
  257. assumed to be truly unique.
  258. }
  259. var kCTFontUniqueNameKey: CFStringRef; external name '_kCTFontUniqueNameKey'; (* attribute const *)
  260. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  261. {!
  262. @defined kCTFontFullNameKey
  263. @abstract The name specifier for the full name.
  264. }
  265. var kCTFontFullNameKey: CFStringRef; external name '_kCTFontFullNameKey'; (* attribute const *)
  266. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  267. {!
  268. @defined kCTFontVersionNameKey
  269. @abstract The name specifier for the version name.
  270. }
  271. var kCTFontVersionNameKey: CFStringRef; external name '_kCTFontVersionNameKey'; (* attribute const *)
  272. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  273. {!
  274. @defined kCTFontPostScriptNameKey
  275. @abstract The name specifier for the Postscript name.
  276. }
  277. var kCTFontPostScriptNameKey: CFStringRef; external name '_kCTFontPostScriptNameKey'; (* attribute const *)
  278. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  279. {!
  280. @defined kCTFontTrademarkNameKey
  281. @abstract The name specifier for the trademark name.
  282. }
  283. var kCTFontTrademarkNameKey: CFStringRef; external name '_kCTFontTrademarkNameKey'; (* attribute const *)
  284. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  285. {!
  286. @defined kCTFontManufacturerNameKey
  287. @abstract The name specifier for the manufacturer name.
  288. }
  289. var kCTFontManufacturerNameKey: CFStringRef; external name '_kCTFontManufacturerNameKey'; (* attribute const *)
  290. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  291. {!
  292. @defined kCTFontDesignerNameKey
  293. @abstract The name specifier for the designer name.
  294. }
  295. var kCTFontDesignerNameKey: CFStringRef; external name '_kCTFontDesignerNameKey'; (* attribute const *)
  296. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  297. {!
  298. @defined kCTFontDescriptionNameKey
  299. @abstract The name specifier for the description name.
  300. }
  301. var kCTFontDescriptionNameKey: CFStringRef; external name '_kCTFontDescriptionNameKey'; (* attribute const *)
  302. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  303. {!
  304. @defined kCTFontVendorURLNameKey
  305. @abstract The name specifier for the vendor url name.
  306. }
  307. var kCTFontVendorURLNameKey: CFStringRef; external name '_kCTFontVendorURLNameKey'; (* attribute const *)
  308. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  309. {!
  310. @defined kCTFontDesignerURLNameKey
  311. @abstract The name specifier for the designer url name.
  312. }
  313. var kCTFontDesignerURLNameKey: CFStringRef; external name '_kCTFontDesignerURLNameKey'; (* attribute const *)
  314. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  315. {!
  316. @defined kCTFontLicenseNameKey
  317. @abstract The name specifier for the license name.
  318. }
  319. var kCTFontLicenseNameKey: CFStringRef; external name '_kCTFontLicenseNameKey'; (* attribute const *)
  320. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  321. {!
  322. @defined kCTFontLicenseURLNameKey
  323. @abstract The name specifier for the license url name.
  324. }
  325. var kCTFontLicenseURLNameKey: CFStringRef; external name '_kCTFontLicenseURLNameKey'; (* attribute const *)
  326. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  327. {!
  328. @defined kCTFontSampleTextNameKey
  329. @abstract The name specifier for the sample text name string.
  330. }
  331. var kCTFontSampleTextNameKey: CFStringRef; external name '_kCTFontSampleTextNameKey'; (* attribute const *)
  332. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  333. {!
  334. @defined kCTFontPostScriptCIDNameKey
  335. @abstract The name specifier for the Postscript CID name.
  336. }
  337. var kCTFontPostScriptCIDNameKey: CFStringRef; external name '_kCTFontPostScriptCIDNameKey'; (* attribute const *)
  338. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  339. {! --------------------------------------------------------------------------
  340. @group Font Creation
  341. }//--------------------------------------------------------------------------
  342. {!
  343. @function CTFontCreateWithName
  344. @abstract Returns a new font reference for the given name.
  345. @param name
  346. The font name for which you wish to create a new font reference. A valid PostScript name is preferred, although other font name types will be matched in a fallback manner.
  347. @param size
  348. The point size for the font reference. If 0.0 is specified, the default font size of 12.0 will be used.
  349. @param matrix
  350. The transformation matrix for the font. If unspecified, the identity matrix will be used. Optional.
  351. @result This function will return a CTFontRef that best matches the name provided with size and matrix attributes. The name parameter is the only required parameters, and default values will be used for unspecified parameters. A best match will be found if all parameters cannot be matched identically.
  352. }
  353. function CTFontCreateWithName( name: CFStringRef; size: CGFloat; matrix: {const} CGAffineTransformPtr {can be null} ): CTFontRef; external name '_CTFontCreateWithName';
  354. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  355. {!
  356. @function CTFontCreateWithFontDescriptor
  357. @abstract Returns a new font reference that best matches the font descriptor.
  358. @param descriptor
  359. A font descriptor containing attributes that specify the requested font.
  360. @param size
  361. The point size for the font reference. If 0.0 is specified, the default font size of 12.0 will be used.
  362. @param matrix
  363. The transformation matrix for the font. If unspecified, the identity matrix will be used. Optional.
  364. @result This function will return a CTFontRef that best matches the attributes provided with the font descriptor. The size and matrix parameters will override any specified in the font descriptor, unless they are unspecified. A best match font will always be returned, and default values will be used for any unspecified.
  365. }
  366. function CTFontCreateWithFontDescriptor( descriptor: CTFontDescriptorRef; size: CGFloat; matrix: {const} CGAffineTransformPtr {can be null} ): CTFontRef; external name '_CTFontCreateWithFontDescriptor';
  367. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  368. {!
  369. @enum CTFontOptions
  370. @abstract Options for descriptor match and font creation.
  371. @constant kCTFontOptionsPreventAutoActivation
  372. Prevents automatic font activation from taking place.
  373. @constant kCTFontOptionsPreferSystemFont
  374. Font matching will prefer to match Apple system fonts.
  375. }
  376. const
  377. kCTFontOptionsDefault = 0;
  378. kCTFontOptionsPreventAutoActivation = 1 shl 0;
  379. kCTFontOptionsPreferSystemFont = 1 shl 2;
  380. type
  381. CTFontOptions = CFOptionFlags;
  382. {!
  383. @function CTFontCreateWithNameAndOptions
  384. @abstract Returns a new font reference for the given name.
  385. @param name
  386. The font name for which you wish to create a new font reference. A valid PostScript name is preferred, although other font name types will be matched in a fallback manner.
  387. @param size
  388. The point size for the font reference. If 0.0 is specified, the default font size of 12.0 will be used.
  389. @param matrix
  390. The transformation matrix for the font. If unspecified, the identity matrix will be used. Optional.
  391. @param options
  392. Options flags.
  393. @result This function will return a CTFontRef that best matches the name provided with size and matrix attributes. The name parameter is the only required parameters, and default values will be used for unspecified parameters. A best match will be found if all parameters cannot be matched identically.
  394. }
  395. function CTFontCreateWithNameAndOptions( name: CFStringRef; size: CGFloat; matrix: {const} CGAffineTransformPtr {can be null}; options: CTFontOptions ): CTFontRef; external name '_CTFontCreateWithNameAndOptions';
  396. (* CT_AVAILABLE_STARTING( __MAC_10_6, __IPHONE_3_2) *)
  397. {!
  398. @function CTFontCreateWithFontDescriptorAndOptions
  399. @abstract Returns a new font reference that best matches the font descriptor.
  400. @param descriptor
  401. A font descriptor containing attributes that specify the requested font.
  402. @param size
  403. The point size for the font reference. If 0.0 is specified, the default font size of 12.0 will be used.
  404. @param matrix
  405. The transformation matrix for the font. If unspecified, the identity matrix will be used. Optional.
  406. @param options
  407. Options flags.
  408. @result This function will return a CTFontRef that best matches the attributes provided with the font descriptor. The size and matrix parameters will override any specified in the font descriptor, unless they are unspecified. A best match font will always be returned, and default values will be used for any unspecified.
  409. }
  410. function CTFontCreateWithFontDescriptorAndOptions( descriptor: CTFontDescriptorRef; size: CGFloat; matrix: {const} CGAffineTransformPtr {can be null}; options: CTFontOptions ): CTFontRef; external name '_CTFontCreateWithFontDescriptorAndOptions';
  411. (* CT_AVAILABLE_STARTING( __MAC_10_6, __IPHONE_3_2) *)
  412. {!
  413. @enum UI Type constants
  414. @abstract These constants represent the specific user interface purpose to specify for font creation.
  415. @discussion Use these constants with CTFontCreateUIFontForLanguage to indicate the intended user interface usage of the font reference to be created.
  416. }
  417. const
  418. kCTFontUIFontNone = $ffffffff;
  419. kCTFontUIFontUser = 0;
  420. kCTFontUIFontUserFixedPitch = 1;
  421. kCTFontUIFontSystem = 2;
  422. kCTFontUIFontEmphasizedSystem = 3;
  423. kCTFontUIFontSmallSystem = 4;
  424. kCTFontUIFontSmallEmphasizedSystem = 5;
  425. kCTFontUIFontMiniSystem = 6;
  426. kCTFontUIFontMiniEmphasizedSystem = 7;
  427. kCTFontUIFontViews = 8;
  428. kCTFontUIFontApplication = 9;
  429. kCTFontUIFontLabel = 10;
  430. kCTFontUIFontMenuTitle = 11;
  431. kCTFontUIFontMenuItem = 12;
  432. kCTFontUIFontMenuItemMark = 13;
  433. kCTFontUIFontMenuItemCmdKey = 14;
  434. kCTFontUIFontWindowTitle = 15;
  435. kCTFontUIFontPushButton = 16;
  436. kCTFontUIFontUtilityWindowTitle = 17;
  437. kCTFontUIFontAlertHeader = 18;
  438. kCTFontUIFontSystemDetail = 19;
  439. kCTFontUIFontEmphasizedSystemDetail = 20;
  440. kCTFontUIFontToolbar = 21;
  441. kCTFontUIFontSmallToolbar = 22;
  442. kCTFontUIFontMessage = 23;
  443. kCTFontUIFontPalette = 24;
  444. kCTFontUIFontToolTip = 25;
  445. kCTFontUIFontControlContent = 26;
  446. kCTFontNoFontType = kCTFontUIFontNone;
  447. kCTFontUserFontType = kCTFontUIFontUser;
  448. kCTFontUserFixedPitchFontType = kCTFontUIFontUserFixedPitch;
  449. kCTFontSystemFontType = kCTFontUIFontSystem;
  450. kCTFontEmphasizedSystemFontType = kCTFontUIFontEmphasizedSystem;
  451. kCTFontSmallSystemFontType = kCTFontUIFontSmallSystem;
  452. kCTFontSmallEmphasizedSystemFontType = kCTFontUIFontSmallEmphasizedSystem;
  453. kCTFontMiniSystemFontType = kCTFontUIFontMiniSystem;
  454. kCTFontMiniEmphasizedSystemFontType = kCTFontUIFontMiniEmphasizedSystem;
  455. kCTFontViewsFontType = kCTFontUIFontViews;
  456. kCTFontApplicationFontType = kCTFontUIFontApplication;
  457. kCTFontLabelFontType = kCTFontUIFontLabel;
  458. kCTFontMenuTitleFontType = kCTFontUIFontMenuTitle;
  459. kCTFontMenuItemFontType = kCTFontUIFontMenuItem;
  460. kCTFontMenuItemMarkFontType = kCTFontUIFontMenuItemMark;
  461. kCTFontMenuItemCmdKeyFontType = kCTFontUIFontMenuItemCmdKey;
  462. kCTFontWindowTitleFontType = kCTFontUIFontWindowTitle;
  463. kCTFontPushButtonFontType = kCTFontUIFontPushButton;
  464. kCTFontUtilityWindowTitleFontType = kCTFontUIFontUtilityWindowTitle;
  465. kCTFontAlertHeaderFontType = kCTFontUIFontAlertHeader;
  466. kCTFontSystemDetailFontType = kCTFontUIFontSystemDetail;
  467. kCTFontEmphasizedSystemDetailFontType = kCTFontUIFontEmphasizedSystemDetail;
  468. kCTFontToolbarFontType = kCTFontUIFontToolbar;
  469. kCTFontSmallToolbarFontType = kCTFontUIFontSmallToolbar;
  470. kCTFontMessageFontType = kCTFontUIFontMessage;
  471. kCTFontPaletteFontType = kCTFontUIFontPalette;
  472. kCTFontToolTipFontType = kCTFontUIFontToolTip;
  473. kCTFontControlContentFontType = kCTFontUIFontControlContent;
  474. type
  475. CTFontUIFontType = UInt32;
  476. {!
  477. @function CTFontCreateUIFontForLanguage
  478. @abstract Returns the special UI font for the given language and UI type.
  479. @param uiType
  480. A uiType constant specifying the intended UI use for the requested font reference.
  481. @param size
  482. The point size for the font reference. If 0.0 is specified, the default size for the requested uiType is used.
  483. @param language
  484. Language specifier string to select a font for a particular localization. If unspecified, the current system language is used. The format of the language identifier should conform to the BCP 47 standard.
  485. @result This function returns the correct font for various UI uses. The only required parameter is the uiType selector, unspecified optional parameters will use default values.
  486. }
  487. function CTFontCreateUIFontForLanguage( uiType: CTFontUIFontType; size: CGFloat; language: CFStringRef ): CTFontRef; external name '_CTFontCreateUIFontForLanguage';
  488. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  489. {!
  490. @function CTFontCreateCopyWithAttributes
  491. @abstract Returns a new font with additional attributes based on the original font.
  492. @discussion This function provides a mechanism to quickly change attributes on a given font reference in response to user actions. For instance, the size can be changed in response to a user manipulating a size slider.
  493. @param font
  494. Original font reference to base new font on.
  495. @param size
  496. The point size for the font reference. If 0.0 is specified, the original font's size will be preserved.
  497. @param matrix
  498. The transformation matrix for the font. If unspecified, the original font matrix will be preserved. Optional.
  499. @param attributes
  500. A font descriptor containing additional attributes that the new font should contain.
  501. @result Returns a new font reference converted from the original with the specified attributes.
  502. }
  503. function CTFontCreateCopyWithAttributes( font: CTFontRef; size: CGFloat; matrix: {const} CGAffineTransformPtr {can be null}; attributes: CTFontDescriptorRef ): CTFontRef; external name '_CTFontCreateCopyWithAttributes';
  504. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  505. {!
  506. @function CTFontCreateCopyWithSymbolicTraits
  507. @abstract Returns a new font based on the original font with the specified symbolic traits.
  508. @param font
  509. Original font reference on which to base the new font.
  510. @param size
  511. The point size for the font reference. If 0.0 is specified, the original font's size will be preserved.
  512. @param matrix
  513. The transformation matrix for the font. If unspecified, the original font matrix will be preserved. Optional.
  514. @param symTraitValue
  515. 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.
  516. @param symTraitMask
  517. The mask bits of the symbolic traits. This bitfield is used to indicate the traits that should be changed.
  518. @result Returns a new font reference in the same family with the given symbolic traits, or NULL if none found in the system.
  519. }
  520. function CTFontCreateCopyWithSymbolicTraits( font: CTFontRef; size: CGFloat; matrix: {const} CGAffineTransformPtr {can be null}; symTraitValue: CTFontSymbolicTraits; symTraitMask: CTFontSymbolicTraits ): CTFontRef; external name '_CTFontCreateCopyWithSymbolicTraits';
  521. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  522. {!
  523. @function CTFontCreateCopyWithFamily
  524. @abstract Returns a new font in the specified family based on the traits of the original font.
  525. @param font
  526. Original font reference to base new font on.
  527. @param size
  528. The point size for the font reference. If 0.0 is specified, the original font's size will be preserved.
  529. @param matrix
  530. The transformation matrix for the font. If unspecified, the original font matrix will be preserved. Optional.
  531. @param family
  532. The name of the desired family.
  533. @result Returns a new font reference with the original traits in the given family. NULL if non found in the system.
  534. }
  535. function CTFontCreateCopyWithFamily( font: CTFontRef; size: CGFloat; matrix: {const} CGAffineTransformPtr {can be null}; family: CFStringRef ): CTFontRef; external name '_CTFontCreateCopyWithFamily';
  536. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  537. {! --------------------------------------------------------------------------
  538. @group Font Cascading
  539. }//--------------------------------------------------------------------------
  540. {!
  541. @function CTFontCreateForString
  542. @abstract Returns a new font reference that can best map the given string range based on the current font.
  543. @discussion This function is to be used when the current font does not cover the given range of the string. The current font itself will not be returned, but preference is given to fonts in its cascade list.
  544. @param currentFont
  545. The current font that contains a valid cascade list.
  546. @param string
  547. A unicode string containing characters that cannot be encoded by the current font.
  548. @param range
  549. A CFRange specifying the range of the string that needs to be mapped.
  550. @result This function returns the best substitute font that can encode the specified string range.
  551. @seealso CTFontCopyCharacterSet
  552. @seealso CTFontGetGlyphsForCharacters
  553. @seealso kCTFontCascadeListAttribute
  554. }
  555. function CTFontCreateForString( currentFont: CTFontRef; strng: CFStringRef; range: CFRange ): CTFontRef; external name '_CTFontCreateForString';
  556. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  557. {! --------------------------------------------------------------------------
  558. @group Font Accessors
  559. }//--------------------------------------------------------------------------
  560. {!
  561. @function CTFontCopyFontDescriptor
  562. @abstract Returns the normalized font descriptors for the given font reference.
  563. @param font
  564. The font reference.
  565. @result This function returns a normalized font descriptor for a font. The font descriptor contains enough information to recreate this font at a later time.
  566. }
  567. function CTFontCopyFontDescriptor( font: CTFontRef ): CTFontDescriptorRef; external name '_CTFontCopyFontDescriptor';
  568. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  569. {!
  570. @function CTFontCopyAttribute
  571. @abstract Returns the value associated with an arbitrary attribute.
  572. @param font
  573. The font reference.
  574. @param attribute
  575. The requested attribute.
  576. @result This function returns a retained reference to an arbitrary attribute. If the requested attribute is not present, NULL is returned. Refer to the attribute definitions for documentation as to how each attribute is packaged as a CFType.
  577. }
  578. function CTFontCopyAttribute( font: CTFontRef; attribute: CFStringRef ): CFTypeRef; external name '_CTFontCopyAttribute';
  579. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  580. {!
  581. @function CTFontGetSize
  582. @abstract Returns the point size of the font reference.
  583. @param font
  584. The font reference.
  585. @result This function returns the point size of the given font reference. This is the point size provided when the font was created.
  586. }
  587. function CTFontGetSize( font: CTFontRef ): CGFloat; external name '_CTFontGetSize';
  588. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  589. {!
  590. @function CTFontGetMatrix
  591. @abstract Returns the transformation matrix of the font.
  592. @param font
  593. The font reference.
  594. @result This function returns the transformation matrix for this given font reference. This is the matrix that was provided when the font was created.
  595. }
  596. function CTFontGetMatrix( font: CTFontRef ): CGAffineTransform; external name '_CTFontGetMatrix';
  597. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  598. {!
  599. @function CTFontGetSymbolicTraits
  600. @abstract Returns the symbolic font traits.
  601. @param font
  602. The font reference.
  603. @result This function returns the symbolic traits of the font. This is equivalent to the kCTFontSymbolicTrait of traits dictionary. See CTFontTraits.h for a definition of the font traits.
  604. }
  605. function CTFontGetSymbolicTraits( font: CTFontRef ): CTFontSymbolicTraits; external name '_CTFontGetSymbolicTraits';
  606. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  607. {!
  608. @function CTFontCopyTraits
  609. @abstract Returns the font traits dictionary.
  610. @param font
  611. The font reference.
  612. @result This function returns a retained reference to the font traits dictionary. Individual traits can be accessed with the trait key constants. See CTFontTraits.h for a definition of the font traits.
  613. }
  614. function CTFontCopyTraits( font: CTFontRef ): CFDictionaryRef; external name '_CTFontCopyTraits';
  615. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  616. {! --------------------------------------------------------------------------
  617. @group Font Names
  618. }//--------------------------------------------------------------------------
  619. {!
  620. @function CTFontCopyPostScriptName
  621. @abstract Returns the PostScript name.
  622. @param font
  623. The font reference.
  624. @result This function returns a retained reference to the PostScript name of the font.
  625. }
  626. function CTFontCopyPostScriptName( font: CTFontRef ): CFStringRef; external name '_CTFontCopyPostScriptName';
  627. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  628. {!
  629. @function CTFontCopyFamilyName
  630. @abstract Returns the family name.
  631. @param font
  632. The font reference.
  633. @result This function returns a retained reference to the family name of the font.
  634. }
  635. function CTFontCopyFamilyName( font: CTFontRef ): CFStringRef; external name '_CTFontCopyFamilyName';
  636. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  637. {!
  638. @function CTFontCopyFullName
  639. @abstract Returns the display name.
  640. @param font
  641. The font reference.
  642. @result This function returns a retained reference to the full name of the font.
  643. }
  644. function CTFontCopyFullName( font: CTFontRef ): CFStringRef; external name '_CTFontCopyFullName';
  645. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  646. {!
  647. @function CTFontCopyDisplayName
  648. @abstract Returns the display name.
  649. @param font
  650. The font reference.
  651. @result This function returns a retained reference to the localized display name of the font.
  652. }
  653. function CTFontCopyDisplayName( font: CTFontRef ): CFStringRef; external name '_CTFontCopyDisplayName';
  654. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  655. {!
  656. @function CTFontCopyName
  657. @abstract Returns a reference to the requested name.
  658. @param font
  659. The font reference.
  660. @param nameKey
  661. The name specifier. See name specifier constants.
  662. @result This function creates the requested name for the font, or NULL if the font does not have an entry for the requested name. The Unicode version of the name will be preferred, otherwise the first available will be used.
  663. }
  664. function CTFontCopyName( font: CTFontRef; nameKey: CFStringRef ): CFStringRef; external name '_CTFontCopyName';
  665. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  666. {!
  667. @function CTFontCopyLocalizedName
  668. @abstract Returns a reference to a localized font name.
  669. @param font
  670. The font reference.
  671. @param nameKey
  672. The name specifier. See name specifier constants.
  673. @param language
  674. Pointer to a CFStringRef to receive the language string of the returned name string. The format of the language identifier will conform to the BCP 47 standard.
  675. @result This function returns a specific localized name from the font reference. The name is localized based on the user's global language precedence. If the font does not have an entry for the requested name, NULL will be returned. The matched language will be returned in the caller's buffer.
  676. }
  677. function CTFontCopyLocalizedName( font: CTFontRef; nameKey: CFStringRef; var language: CFStringRef ): CFStringRef; external name '_CTFontCopyLocalizedName';
  678. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  679. {! --------------------------------------------------------------------------
  680. @group Font Encoding
  681. }//--------------------------------------------------------------------------
  682. {!
  683. @function CTFontCopyCharacterSet
  684. @abstract Returns the Unicode character set of the font.
  685. @param font
  686. The font reference.
  687. @result This function returns a retained reference to the font's character set. This character set covers the nominal referenced by the font's Unicode cmap table (or equivalent).
  688. }
  689. function CTFontCopyCharacterSet( font: CTFontRef ): CFCharacterSetRef; external name '_CTFontCopyCharacterSet';
  690. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  691. {!
  692. @function CTFontGetStringEncoding
  693. @abstract Returns the best string encoding for legacy format support.
  694. @param font
  695. The font reference.
  696. @result This function returns the best string encoding for the font.
  697. }
  698. function CTFontGetStringEncoding( font: CTFontRef ): CFStringEncoding; external name '_CTFontGetStringEncoding';
  699. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  700. {!
  701. @function CTFontCopySupportedLanguages
  702. @abstract Returns an array of languages supported by the font.
  703. @param font
  704. The font reference.
  705. @result This function returns a retained reference to an array of languages supported by the font. The array contains language identifier strings as CFStringRefs. The format of the language identifier will conform to the BCP 47 standard.
  706. }
  707. function CTFontCopySupportedLanguages( font: CTFontRef ): CFArrayRef; external name '_CTFontCopySupportedLanguages';
  708. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  709. {!
  710. @function CTFontGetGlyphsForCharacters
  711. @abstract Performs basic character-to-glyph mapping.
  712. @discussion This function only provides the nominal mapping as specified by the font's Unicode cmap (or equivalent); such mapping does not constitute proper Unicode layout: it is the caller's responsibility to handle the Unicode properties of the characters.
  713. @param font
  714. The font reference.
  715. @param characters
  716. An array of characters (UTF-16 code units). Non-BMP characters must be encoded as surrogate pairs.
  717. @param glyphs
  718. A pointer to a buffer to receive the glyphs. Glyphs for non-BMP characters are sparse: the first glyph corresponds to the full character and the second glyph will be 0.
  719. @param count
  720. The capacity of both the characters and glyphs arrays.
  721. @result The return value indicates whether all provided characters were successfully mapped. A return value of true indicates that the font mapped all characters. A return value of false indicates that some or all of the characters were not mapped; glyphs for unmapped characters will be 0 (with the exception of those corresponding non-BMP characters as described above).
  722. @seealso CTFontCopyCharacterSet
  723. }
  724. function CTFontGetGlyphsForCharacters( font: CTFontRef; {const} characters: {variable-size-array} UniCharPtr; glyphs: {variable-size-array} CGGlyphPtr; count: CFIndex ): CBool; external name '_CTFontGetGlyphsForCharacters';
  725. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  726. {! --------------------------------------------------------------------------
  727. @group Font Metrics
  728. }//--------------------------------------------------------------------------
  729. {!
  730. @function CTFontGetAscent
  731. @abstract Returns the scaled font ascent metric.
  732. @param font
  733. The font reference.
  734. @result This function returns the font ascent metric scaled based on the point size and matrix of the font reference.
  735. }
  736. function CTFontGetAscent( font: CTFontRef ): CGFloat; external name '_CTFontGetAscent';
  737. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  738. {!
  739. @function CTFontGetDescent
  740. @abstract Returns the scaled font descent metric.
  741. @param font
  742. The font reference.
  743. @result This function returns the font descent metric scaled based on the point size and matrix of the font reference.
  744. }
  745. function CTFontGetDescent( font: CTFontRef ): CGFloat; external name '_CTFontGetDescent';
  746. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  747. {!
  748. @function CTFontGetLeading
  749. @abstract Returns the scaled font leading metric.
  750. @param font
  751. The font reference.
  752. @result This function returns the font leading metric scaled based on the point size and matrix of the font reference.
  753. }
  754. function CTFontGetLeading( font: CTFontRef ): CGFloat; external name '_CTFontGetLeading';
  755. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  756. {!
  757. @function CTFontGetUnitsPerEm
  758. @abstract Returns the units per em metric.
  759. @param font
  760. The font reference.
  761. @result This function returns the units per em of the font.
  762. }
  763. function CTFontGetUnitsPerEm( font: CTFontRef ): UInt32; external name '_CTFontGetUnitsPerEm';
  764. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  765. {!
  766. @function CTFontGetGlyphCount
  767. @abstract Returns the number of glyphs.
  768. @param font
  769. The font reference.
  770. @result This function returns the number of glyphs in the font.
  771. }
  772. function CTFontGetGlyphCount( font: CTFontRef ): CFIndex; external name '_CTFontGetGlyphCount';
  773. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  774. {!
  775. @function CTFontGetBoundingBox
  776. @abstract Returns the scaled bounding box.
  777. @param font
  778. The font reference.
  779. @result This will return the design bounding box of the font, which is the rectangle defined by xMin, yMin, xMax, and yMax values for the font.
  780. }
  781. function CTFontGetBoundingBox( font: CTFontRef ): CGRect; external name '_CTFontGetBoundingBox';
  782. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  783. {!
  784. @function CTFontGetUnderlinePosition
  785. @abstract Returns the scaled underline position.
  786. @param font
  787. The font reference.
  788. @result This function returns the font underline position metric scaled based on the point size and matrix of the font reference.
  789. }
  790. function CTFontGetUnderlinePosition( font: CTFontRef ): CGFloat; external name '_CTFontGetUnderlinePosition';
  791. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  792. {!
  793. @function CTFontGetUnderlineThickness
  794. @abstract Returns the scaled underline thickness metric.
  795. @param font
  796. The font reference.
  797. @result This function returns the font underline thickness metric scaled based on the point size and matrix of the font reference.
  798. }
  799. function CTFontGetUnderlineThickness( font: CTFontRef ): CGFloat; external name '_CTFontGetUnderlineThickness';
  800. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  801. {!
  802. @function CTFontGetSlantAngle
  803. @abstract Returns the slant angle of the font.
  804. @param font
  805. The font reference.
  806. @result This function returns the transformed slant angle of the font. This is equivalent to the italic or caret angle with any skew from the transformation matrix applied.
  807. }
  808. function CTFontGetSlantAngle( font: CTFontRef ): CGFloat; external name '_CTFontGetSlantAngle';
  809. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  810. {!
  811. @function CTFontGetCapHeight
  812. @abstract Returns the cap height metric.
  813. @param font
  814. The font reference.
  815. @result This function returns the font cap height metric scaled based on the point size and matrix of the font reference.
  816. }
  817. function CTFontGetCapHeight( font: CTFontRef ): CGFloat; external name '_CTFontGetCapHeight';
  818. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  819. {!
  820. @function CTFontGetXHeight
  821. @abstract Returns the X height metric.
  822. @param font
  823. The font reference.
  824. @result This function returns the font X height metric scaled based on the point size and matrix of the font reference.
  825. }
  826. function CTFontGetXHeight( font: CTFontRef ): CGFloat; external name '_CTFontGetXHeight';
  827. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  828. {! --------------------------------------------------------------------------
  829. @group Font Glyphs
  830. }//--------------------------------------------------------------------------
  831. {!
  832. @function CTFontGetGlyphWithName
  833. @abstract Returns the CGGlyph for the specified glyph name.
  834. @param font
  835. The font reference.
  836. @param glyphName
  837. The glyph name as a CFString.
  838. @result The glyph with the specified name or 0 if the name is not recognized; this glyph can be used with other Core Text glyph data accessors or with Quartz.
  839. }
  840. function CTFontGetGlyphWithName( font: CTFontRef; glyphName: CFStringRef ): CGGlyph; external name '_CTFontGetGlyphWithName';
  841. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  842. {!
  843. @function CTFontGetBoundingRectsForGlyphs
  844. @abstract Calculates the bounding rects for an array of glyphs and returns the overall bounding rect for the run.
  845. @param font
  846. The font reference.
  847. @param orientation
  848. The intended drawing orientation of the glyphs. Used to determined which glyph metrics to return.
  849. @param glyphs
  850. An array of count number of glyphs.
  851. @param boundingRects
  852. An array of count number of CGRects to receive the computed glyph rects. Can be NULL, in which case only the overall bounding rect is calculated.
  853. @param count
  854. The capacity of the glyphs and boundingRects buffers.
  855. @result This function returns the overall bounding rectangle for an array or run of glyphs. The bounding rects of the individual glyphs are returned through the boundingRects parameter. These are the design metrics from the font transformed in font space.
  856. }
  857. function CTFontGetBoundingRectsForGlyphs( font: CTFontRef; orientation: CTFontOrientation; {const} glyphs: {variable-size-array} CGGlyphPtr; boundingRects: {variable-size-array} CGRectPtr; count: CFIndex ): CGRect; external name '_CTFontGetBoundingRectsForGlyphs';
  858. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  859. {!
  860. @function CTFontGetOpticalBoundsForGlyphs
  861. @abstract Calculates the optical bounding rects for an array of glyphs and returns the overall optical bounding rect for the run.
  862. @discussion Fonts may specify the optical edges of glyphs that can be used to make the edges of lines of text line up in a more visually pleasing way. This function returns bounding rects corresponding to this information if present in a font, otherwise it returns typographic bounding rects (composed of the font's ascent and descent and a glyph's advance width).
  863. @param font
  864. The font reference.
  865. @param glyphs
  866. An array of count number of glyphs.
  867. @param boundingRects
  868. An array of count number of CGRects to receive the computed glyph rects. Can be NULL, in which case only the overall bounding rect is calculated.
  869. @param count
  870. The capacity of the glyphs and boundingRects buffers.
  871. @param options
  872. Reserved, set to zero.
  873. @result This function returns the overall bounding rectangle for an array or run of glyphs. The bounding rects of the individual glyphs are returned through the boundingRects parameter. These are the design metrics from the font transformed in font space.
  874. }
  875. function CTFontGetOpticalBoundsForGlyphs( font: CTFontRef; {const} glyphs: {variable-size-array} CGGlyphPtr; boundingRects: {variable-size-array} CGRectPtr; count: CFIndex; options: CFOptionFlags ): CGRect; external name '_CTFontGetOpticalBoundsForGlyphs';
  876. (* CT_AVAILABLE_STARTING( __MAC_10_8, __IPHONE_6_0) *)
  877. {!
  878. @function CTFontGetAdvancesForGlyphs
  879. @abstract Calculates the advances for an array of glyphs and returns the summed advance.
  880. @param font
  881. The font reference.
  882. @param orientation
  883. The intended drawing orientation of the glyphs. Used to determined which glyph metrics to return.
  884. @param glyphs
  885. An array of count number of glyphs.
  886. @param advances
  887. An array of count number of CGSize to receive the computed glyph advances. Can be NULL, in which case only the overall advance is calculated.
  888. @param count
  889. The capacity of the glyphs and advances buffers.
  890. @result This function returns the summed glyph advance of an array of glyphs. Individual glyph advances are passed back via the advances parameter. These are the ideal metrics for each glyph scaled and transformed in font space.
  891. }
  892. function CTFontGetAdvancesForGlyphs( font: CTFontRef; orientation: CTFontOrientation; {const} glyphs: {variable-size-array} CGGlyphPtr; advances: {variable-size-array} CGSizePtr; count: CFIndex ): Float64; external name '_CTFontGetAdvancesForGlyphs';
  893. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  894. {!
  895. @function CTFontGetVerticalTranslationsForGlyphs
  896. @abstract Calculates the offset from the default (horizontal) origin to the vertical origin for an array of glyphs.
  897. @param font
  898. The font reference.
  899. @param glyphs
  900. An array of count number of glyphs.
  901. @param translations
  902. An array of count number of CGSize to receive the computed origin offsets.
  903. @param count
  904. The capacity of the glyphs and translations buffers.
  905. }
  906. procedure CTFontGetVerticalTranslationsForGlyphs( font: CTFontRef; {const} glyphs: {variable-size-array} CGGlyphPtr; translations: {variable-size-array} CGSizePtr; count: CFIndex ); external name '_CTFontGetVerticalTranslationsForGlyphs';
  907. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  908. {!
  909. @function CTFontCreatePathForGlyph
  910. @abstract Creates a path for the specified glyph.
  911. @discussion Creates a path from the outlines of the glyph for the specified font. The path will reflect the font point size, matrix, and transform parameter, in that order. The transform parameter will most commonly be used to provide a translation to the desired glyph origin.
  912. @param font
  913. The font reference.
  914. @param glyph
  915. The glyph.
  916. @param transform
  917. An affine transform applied to the path. Can be NULL, in which case CGAffineTransformIdentity will be used.
  918. @result A retained CGPath reference containing the glyph outlines or NULL if an error occurred.
  919. }
  920. function CTFontCreatePathForGlyph( font: CTFontRef; glyph: CGGlyph; transform: {const} CGAffineTransformPtr {can be null} ): CGPathRef; external name '_CTFontCreatePathForGlyph';
  921. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  922. {! --------------------------------------------------------------------------
  923. @group Font Variations (this functionality is not supported on iOS)
  924. }//--------------------------------------------------------------------------
  925. {!
  926. @defined kCTFontVariationAxisIdentifierKey
  927. @abstract Key to get the variation axis identifier.
  928. @discussion This key is used with a variation axis dictionary to get the axis identifier value as a CFNumberRef.
  929. }
  930. var kCTFontVariationAxisIdentifierKey: CFStringRef; external name '_kCTFontVariationAxisIdentifierKey'; (* attribute const *)
  931. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  932. {!
  933. @defined kCTFontVariationAxisMinimumValueKey
  934. @abstract Key to get the variation axis minimum value.
  935. @discussion This key is used with a variation axis dictionary to get the minimum axis value as a CFNumberRef.
  936. }
  937. var kCTFontVariationAxisMinimumValueKey: CFStringRef; external name '_kCTFontVariationAxisMinimumValueKey'; (* attribute const *)
  938. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  939. {!
  940. @defined kCTFontVariationAxisMaximumValueKey
  941. @abstract Key to get the variation axis maximum value.
  942. @discussion This key is used with a variation axis dictionary to get the maximum axis value as a CFNumberRef.
  943. }
  944. var kCTFontVariationAxisMaximumValueKey: CFStringRef; external name '_kCTFontVariationAxisMaximumValueKey'; (* attribute const *)
  945. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  946. {!
  947. @defined kCTFontVariationAxisDefaultValueKey
  948. @abstract Key to get the variation axis default value.
  949. @discussion This key is used with a variation axis dictionary to get the default axis value as a CFNumberRef.
  950. }
  951. var kCTFontVariationAxisDefaultValueKey: CFStringRef; external name '_kCTFontVariationAxisDefaultValueKey'; (* attribute const *)
  952. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  953. {!
  954. @defined kCTFontVariationAxisNameKey
  955. @abstract Key to get the variation axis name string.
  956. @discussion This key is used with a variation axis dictionary to get the localized variation axis name.
  957. }
  958. var kCTFontVariationAxisNameKey: CFStringRef; external name '_kCTFontVariationAxisNameKey'; (* attribute const *)
  959. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  960. {!
  961. @function CTFontCopyVariationAxes
  962. @abstract Returns an array of variation axes.
  963. @param font
  964. The font reference.
  965. @result This function returns an array of variation axis dictionaries. Each variation axis dictionary contains the five variation axis keys above.
  966. }
  967. function CTFontCopyVariationAxes( font: CTFontRef ): CFArrayRef; external name '_CTFontCopyVariationAxes';
  968. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  969. {!
  970. @function CTFontCopyVariation
  971. @abstract Returns a variation dictionary from the font reference.
  972. @param font
  973. The font reference.
  974. @result This function returns the current variation instance as a dictionary. The keys for each variation correspond to the variation identifier obtained via kCTVariationAxisIdentifierKey which represents the axis' four character code as a CFNumber.
  975. }
  976. function CTFontCopyVariation( font: CTFontRef ): CFDictionaryRef; external name '_CTFontCopyVariation';
  977. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  978. {! --------------------------------------------------------------------------
  979. @group Font Features (only AAT features are supported on iOS)
  980. }//--------------------------------------------------------------------------
  981. {!
  982. @defined kCTFontFeatureTypeIdentifierKey
  983. @abstract Key to get the font feature type value.
  984. @discussion This key can be used with a font feature dictionary to get the type identifier as a CFNumberRef.
  985. }
  986. var kCTFontFeatureTypeIdentifierKey: CFStringRef; external name '_kCTFontFeatureTypeIdentifierKey'; (* attribute const *)
  987. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  988. {!
  989. @defined kCTFontFeatureTypeNameKey
  990. @abstract Key to get the font feature name.
  991. @discussion This key can be used with a font feature dictionary to get the localized type name string as a CFString.
  992. }
  993. var kCTFontFeatureTypeNameKey: CFStringRef; external name '_kCTFontFeatureTypeNameKey'; (* attribute const *)
  994. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  995. {!
  996. @defined kCTFontFeatureTypeExclusiveKey
  997. @abstract Key to get the font feature exclusive setting.
  998. @discussion This key can be used with a font feature dictionary to get the the exclusive setting of the feature as a CFBoolean. The value associated with this key indicates whether the feature selectors associated with this type should be mutually exclusive.
  999. }
  1000. var kCTFontFeatureTypeExclusiveKey: CFStringRef; external name '_kCTFontFeatureTypeExclusiveKey'; (* attribute const *)
  1001. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  1002. {!
  1003. @defined kCTFontFeatureTypeSelectorsKey
  1004. @abstract Key to get the font feature selectors.
  1005. @discussion This key can be used with a font feature dictionary to get the array of font feature selectors as a CFArrayRef. This is an array of selector dictionaries that contain the values for the following selector keys.
  1006. }
  1007. var kCTFontFeatureTypeSelectorsKey: CFStringRef; external name '_kCTFontFeatureTypeSelectorsKey'; (* attribute const *)
  1008. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  1009. {!
  1010. @defined kCTFontFeatureSelectorIdentifierKey
  1011. @abstract Key to get the font feature selector identifier.
  1012. @discussion This key can be used with a selector dictionary corresponding to a feature type to obtain the selector identifier value as a CFNumberRef.
  1013. }
  1014. var kCTFontFeatureSelectorIdentifierKey: CFStringRef; external name '_kCTFontFeatureSelectorIdentifierKey'; (* attribute const *)
  1015. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  1016. {!
  1017. @defined kCTFontFeatureSelectorNameKey
  1018. @abstract Key to get the font feature selector name.
  1019. @discussion This key is used with a selector dictionary to get the localized name string for the selector as a CFStringRef.
  1020. }
  1021. var kCTFontFeatureSelectorNameKey: CFStringRef; external name '_kCTFontFeatureSelectorNameKey'; (* attribute const *)
  1022. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  1023. {!
  1024. @defined kCTFontFeatureSelectorDefaultKey
  1025. @abstract Key to get the font feature selector default setting value.
  1026. @discussion This key is used with a selector dictionary to get the default indicator for the selector. This value is a CFBooleanRef which if present and true indicates that this selector is the default setting for the current feature type.
  1027. }
  1028. var kCTFontFeatureSelectorDefaultKey: CFStringRef; external name '_kCTFontFeatureSelectorDefaultKey'; (* attribute const *)
  1029. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  1030. {!
  1031. @defined kCTFontFeatureSelectorSettingKey
  1032. @abstract Key to get or specify the current feature setting.
  1033. @discussion This key is used with a selector dictionary to get or specify the current setting for the selector. This value is a CFBooleanRef to indicate whether this selector is on or off. If this key is not present, the default setting is used.
  1034. }
  1035. var kCTFontFeatureSelectorSettingKey: CFStringRef; external name '_kCTFontFeatureSelectorSettingKey'; (* attribute const *)
  1036. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  1037. {!
  1038. @function CTFontCopyFeatures
  1039. @abstract Returns an array of font features
  1040. @param font
  1041. The font reference.
  1042. @result This function returns an array of font feature dictionaries for the font reference.
  1043. }
  1044. function CTFontCopyFeatures( font: CTFontRef ): CFArrayRef; external name '_CTFontCopyFeatures';
  1045. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  1046. {!
  1047. @function CTFontCopyFeatureSettings
  1048. @abstract Returns an array of font feature setting tuples
  1049. @discussion A setting tuple is a dictionary of a kCTFontFeatureTypeIdentifierKey key-value pair and a kCTFontFeatureSelectorIdentifierKey key-value pair. Each tuple corresponds to an enabled non-default setting. It is the caller's responsibility to handle exclusive and non-exclusive settings as necessary.
  1050. @param font
  1051. The font reference.
  1052. @result This function returns a normalized array of font feature setting dictionaries. The array will only contain the non-default settings that should be applied to the font, or NULL if the default settings should be used.
  1053. }
  1054. function CTFontCopyFeatureSettings( font: CTFontRef ): CFArrayRef; external name '_CTFontCopyFeatureSettings';
  1055. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  1056. {! --------------------------------------------------------------------------
  1057. @group Font Conversion
  1058. }//--------------------------------------------------------------------------
  1059. {!
  1060. @function CTFontCopyGraphicsFont
  1061. @abstract Returns a CGFontRef and attributes.
  1062. @param font
  1063. The font reference.
  1064. @param attributes
  1065. A pointer to a CTFontDescriptorRef to receive a font descriptor containing additional attributes. Can be NULL. Must be released by caller.
  1066. @result This function returns a CGFontRef for the given font reference. Additional attributes from the font will be passed back as a font descriptor via the attributes parameter. The result must be released by the caller.
  1067. }
  1068. function CTFontCopyGraphicsFont( font: CTFontRef; attributes: CTFontDescriptorRefPtr { can be NULL } ): CGFontRef; external name '_CTFontCopyGraphicsFont';
  1069. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  1070. {!
  1071. @function CTFontCreateWithGraphicsFont
  1072. @abstract Creates a new font reference from a CGFontRef.
  1073. @param graphicsFont
  1074. A valid CGFontRef.
  1075. @param size
  1076. The point size for the font reference. If 0.0 is specified, the default font size of 12.0 will be used.
  1077. @param matrix
  1078. The transformation matrix for the font. If unspecified, the identity matrix will be used. Optional.
  1079. @param attributes
  1080. A CTFontDescriptorRef containing additional attributes that should be matched. Optional.
  1081. @result This function returns a new font reference for an existing CGFontRef with the specified size, matrix, and additional attributes.
  1082. }
  1083. function CTFontCreateWithGraphicsFont( graphicsFont: CGFontRef; size: CGFloat; matrix: {const} CGAffineTransformPtr {can be null}; attributes: CTFontDescriptorRef ): CTFontRef; external name '_CTFontCreateWithGraphicsFont';
  1084. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  1085. {$ifc TARGET_OS_MAC}
  1086. {!
  1087. @function CTFontGetPlatformFont
  1088. @abstract Returns the ATSFontRef and attributes.
  1089. @param font
  1090. The font reference.
  1091. @param attributes
  1092. A pointer to a CTFontDescriptorRef to receive a font descriptor containing additional attributes. Can be NULL. Must be released by caller.
  1093. @result This function returns a an ATSFontRef for the given font reference. Additional attributes from the font will be passed back as a font descriptor via the attributes parameter.
  1094. }
  1095. function CTFontGetPlatformFont( font: CTFontRef; attributes: CTFontDescriptorRefPtr {can be null} ): ATSFontRef; external name '_CTFontGetPlatformFont';
  1096. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_NA) *)
  1097. {!
  1098. @function CTFontCreateWithPlatformFont
  1099. @abstract Creates a new font reference from an ATSFontRef.
  1100. @param platformFont
  1101. A valid ATSFontRef.
  1102. @param size
  1103. The point size for the font reference. If 0.0 is specified, the default font size of 12.0 will be used.
  1104. @param matrix
  1105. The transformation matrix for the font. If unspecified, the identity matrix will be used. Optional.
  1106. @param attributes
  1107. A CTFontDescriptorRef containing additional attributes that should be matched. Optional.
  1108. @result This function returns a new font reference for an ATSFontRef with the specified size, matrix, and additional attributes.
  1109. }
  1110. function CTFontCreateWithPlatformFont( platformFont: ATSFontRef; size: CGFloat; matrix: {const} CGAffineTransformPtr {can be null}; attributes: CTFontDescriptorRef ): CTFontRef; external name '_CTFontCreateWithPlatformFont';
  1111. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_NA) *)
  1112. {!
  1113. @function CTFontCreateWithQuickdrawInstance
  1114. @abstract Returns a font reference for the given Quickdraw instance.
  1115. @discussion This function is provided for compatibility support between Core Text and clients needing to support Quickdraw font references.
  1116. @param name
  1117. The Quickdraw font name. If NULL or zero length, an identifier must be specified instead.
  1118. @param identifier
  1119. The Quickdraw font identifier. If 0, a name must be specified instead.
  1120. @param style
  1121. The Quickdraw font style.
  1122. @param size
  1123. The point size for the font reference. If 0.0 is specified, the default size of 12.0 is used.
  1124. @result This function returns the best font instance matching the Quickdraw instance information.
  1125. }
  1126. function CTFontCreateWithQuickdrawInstance( name: StringPtr {can be null}; identifier: SInt16; style: UInt8; size: CGFloat ): CTFontRef; external name '_CTFontCreateWithQuickdrawInstance';
  1127. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_NA) *)
  1128. {$endc} { TARGET_OS_MAC }
  1129. {! --------------------------------------------------------------------------
  1130. @group Font Tables
  1131. }//--------------------------------------------------------------------------
  1132. const
  1133. kCTFontTableBASE = FourCharCode('BASE'); // Baseline
  1134. kCTFontTableCFF = FourCharCode('CFF '); // PostScript font program
  1135. kCTFontTableDSIG = FourCharCode('DSIG'); // Digital signature
  1136. kCTFontTableEBDT = FourCharCode('EBDT'); // Embedded bitmap
  1137. kCTFontTableEBLC = FourCharCode('EBLC'); // Embedded bitmap location
  1138. kCTFontTableEBSC = FourCharCode('EBSC'); // Embedded bitmap scaling
  1139. kCTFontTableGDEF = FourCharCode('GDEF'); // Glyph definition
  1140. kCTFontTableGPOS = FourCharCode('GPOS'); // Glyph positioning
  1141. kCTFontTableGSUB = FourCharCode('GSUB'); // Glyph substitution
  1142. kCTFontTableJSTF = FourCharCode('JSTF'); // Justification
  1143. kCTFontTableLTSH = FourCharCode('LTSH'); // Linear threshold
  1144. kCTFontTableOS2 = FourCharCode('OS/2'); // OS/2 and Windows specific metrics
  1145. kCTFontTablePCLT = FourCharCode('PCLT'); // PCL 5 data
  1146. kCTFontTableVDMX = FourCharCode('VDMX'); // Vertical device metrics
  1147. kCTFontTableVORG = FourCharCode('VORG'); // Vertical origin
  1148. kCTFontTableZapf = FourCharCode('Zapf'); // Glyph reference
  1149. kCTFontTableAcnt = FourCharCode('acnt'); // Accent attachment
  1150. kCTFontTableAnkr = FourCharCode('ankr'); // Anchor points
  1151. kCTFontTableAvar = FourCharCode('avar'); // Axis variation
  1152. kCTFontTableBdat = FourCharCode('bdat'); // Bitmap data
  1153. kCTFontTableBhed = FourCharCode('bhed'); // Bitmap font header
  1154. kCTFontTableBloc = FourCharCode('bloc'); // Bitmap location
  1155. kCTFontTableBsln = FourCharCode('bsln'); // Baseline
  1156. kCTFontTableCmap = FourCharCode('cmap'); // Character to glyph mapping
  1157. kCTFontTableCvar = FourCharCode('cvar'); // CVT variation
  1158. kCTFontTableCvt = FourCharCode('cvt '); // Control value table
  1159. kCTFontTableFdsc = FourCharCode('fdsc'); // Font descriptor
  1160. kCTFontTableFeat = FourCharCode('feat'); // Layout feature
  1161. kCTFontTableFmtx = FourCharCode('fmtx'); // Font metrics
  1162. kCTFontTableFpgm = FourCharCode('fpgm'); // Font program
  1163. kCTFontTableFvar = FourCharCode('fvar'); // Font variation
  1164. kCTFontTableGasp = FourCharCode('gasp'); // Grid-fitting/Scan-conversion
  1165. kCTFontTableGlyf = FourCharCode('glyf'); // Glyph data
  1166. kCTFontTableGvar = FourCharCode('gvar'); // Glyph variation
  1167. kCTFontTableHdmx = FourCharCode('hdmx'); // Horizontal device metrics
  1168. kCTFontTableHead = FourCharCode('head'); // Font header
  1169. kCTFontTableHhea = FourCharCode('hhea'); // Horizontal header
  1170. kCTFontTableHmtx = FourCharCode('hmtx'); // Horizontal metrics
  1171. kCTFontTableHsty = FourCharCode('hsty'); // Horizontal style
  1172. kCTFontTableJust = FourCharCode('just'); // Justification
  1173. kCTFontTableKern = FourCharCode('kern'); // Kerning
  1174. kCTFontTableKerx = FourCharCode('kerx'); // Extended kerning
  1175. kCTFontTableLcar = FourCharCode('lcar'); // Ligature caret
  1176. kCTFontTableLtag = FourCharCode('ltag'); // Language tags
  1177. kCTFontTableLoca = FourCharCode('loca'); // Index to location
  1178. kCTFontTableMaxp = FourCharCode('maxp'); // Maximum profile
  1179. kCTFontTableMort = FourCharCode('mort'); // Morph
  1180. kCTFontTableMorx = FourCharCode('morx'); // Extended morph
  1181. kCTFontTableName = FourCharCode('name'); // Naming table
  1182. kCTFontTableOpbd = FourCharCode('opbd'); // Optical bounds
  1183. kCTFontTablePost = FourCharCode('post'); // PostScript information
  1184. kCTFontTablePrep = FourCharCode('prep'); // CVT program
  1185. kCTFontTableProp = FourCharCode('prop'); // Properties
  1186. kCTFontTableSbit = FourCharCode('sbit'); // Bitmap data
  1187. kCTFontTableSbix = FourCharCode('sbix'); // Extended bitmap data
  1188. kCTFontTableTrak = FourCharCode('trak'); // Tracking
  1189. kCTFontTableVhea = FourCharCode('vhea'); // Vertical header
  1190. kCTFontTableVmtx = FourCharCode('vmtx'); // Vertical metrics
  1191. type
  1192. CTFontTableTag = UInt32;
  1193. const
  1194. kCTFontTableOptionNoOptions = 0;
  1195. kCTFontTableOptionExcludeSynthetic = 1 shl 0;
  1196. type
  1197. CTFontTableOptions = UInt32;
  1198. {!
  1199. @function CTFontCopyAvailableTables
  1200. @abstract Returns an array of font table tags.
  1201. @param font
  1202. The font reference.
  1203. @param options
  1204. @result This function returns an array of CTFontTableTag values for the given font and the supplied options. The returned set will contain unboxed values, which may be extracted like so:
  1205. <code>CTFontTableTag tag = (CTFontTableTag)(uintptr_t)CFArrayGetValueAtIndex(tags, index);</code>
  1206. }
  1207. function CTFontCopyAvailableTables( font: CTFontRef; options: CTFontTableOptions ): CFArrayRef; external name '_CTFontCopyAvailableTables';
  1208. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  1209. {!
  1210. @function CTFontCopyTable
  1211. @abstract Returns a reference to the font table data.
  1212. @param font
  1213. The font reference.
  1214. @param table
  1215. The font table identifier as a CTFontTableTag.
  1216. @param options
  1217. @result This function returns a retained reference to the font table data as CFDataRef. The table data is not actually copied, however the data reference must be released.
  1218. }
  1219. function CTFontCopyTable( font: CTFontRef; table: CTFontTableTag; options: CTFontTableOptions ): CFDataRef; external name '_CTFontCopyTable';
  1220. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  1221. {!
  1222. @function CTFontDrawGlyphs
  1223. @abstract Renders the given glyphs from the CTFont at the given positions in the CGContext.
  1224. @discussion This function will modify the CGContext's font, text size, and text matrix if specified in the CTFont. These attributes will not be restored.
  1225. The given glyphs should be the result of proper Unicode text layout operations (such as CTLine). Results from CTFontGetGlyphsForCharacters (or similar APIs) do not perform any Unicode text layout.
  1226. @param font
  1227. The font to render glyphs from. If the font has a size or matrix attribute, the CGContext will be set with these values.
  1228. @param glyphs
  1229. The glyphs to be rendered. See above discussion of how the glyphs should be derived.
  1230. @param positions
  1231. The positions (origins) for each glyph. The positions are in user space. The number of positions passed in must be equivalent to the number of glyphs.
  1232. @param count
  1233. The number of glyphs to be rendered from the glyphs array.
  1234. @param context
  1235. CGContext used to render the glyphs.
  1236. @result void
  1237. }
  1238. procedure CTFontDrawGlyphs( font: CTFontRef; {const} glyphs: {variable-size-array} CGGlyphPtr; {const} positions: {variable-size-array} CGPointPtr; count: size_t; context: CGContextRef ); external name '_CTFontDrawGlyphs';
  1239. (* CT_AVAILABLE_STARTING( __MAC_10_7, __IPHONE_4_2) *)
  1240. {!
  1241. @function CTFontGetLigatureCaretPositions
  1242. @abstract Returns caret positions within a glyph.
  1243. @discussion This function is used to obtain caret positions for a specific glyph.
  1244. The return value is the max number of positions possible, and the function
  1245. will populate the caller's positions buffer with available positions if possible.
  1246. This function may not be able to produce positions if the font does not
  1247. have the appropriate data, in which case it will return 0.
  1248. @param font
  1249. The font reference.
  1250. @param glyph
  1251. The glyph.
  1252. @param positions
  1253. A buffer of at least maxPositions to receive the ligature caret positions for
  1254. the glyph.
  1255. @param maxPositions
  1256. The maximum number of positions to return.
  1257. @result Returns the number of caret positions for the specified glyph.
  1258. }
  1259. function CTFontGetLigatureCaretPositions( font: CTFontRef; glyph: CGGlyph; positions: {variable-size-array} CGFloatPtr; maxPositions: CFIndex ): CFIndex; external name '_CTFontGetLigatureCaretPositions';
  1260. (* CT_AVAILABLE_STARTING( __MAC_10_5, __IPHONE_3_2) *)
  1261. {! --------------------------------------------------------------------------
  1262. @group Baseline Alignment
  1263. }//--------------------------------------------------------------------------
  1264. {!
  1265. @defined kCTBaselineClassRoman
  1266. @abstract Key to reference the Roman baseline class.
  1267. @discussion This key can be used with a baseline info dictionary to offset to the Roman baseline as a CFNumberRef float. It can also be used as the value for kCTBaselineClassAttributeName.
  1268. }
  1269. var kCTBaselineClassRoman: CFStringRef; external name '_kCTBaselineClassRoman'; (* attribute const *)
  1270. (* CT_AVAILABLE_STARTING( __MAC_10_8, __IPHONE_6_0) *)
  1271. {!
  1272. @defined kCTBaselineClassIdeographicCentered
  1273. @abstract Key to reference the Ideographic Centered baseline class.
  1274. @discussion This key can be used with a baseline info dictionary to offset to the Ideographic Centered baseline as a CFNumberRef float. It can also be used as the value for kCTBaselineClassAttributeName.
  1275. }
  1276. var kCTBaselineClassIdeographicCentered: CFStringRef; external name '_kCTBaselineClassIdeographicCentered'; (* attribute const *)
  1277. (* CT_AVAILABLE_STARTING( __MAC_10_8, __IPHONE_6_0) *)
  1278. {!
  1279. @defined kCTBaselineClassIdeographicLow
  1280. @abstract Key to reference the Ideographic Low baseline class.
  1281. @discussion This key can be used with a baseline info dictionary to offset to the Ideographic Low baseline as a CFNumberRef float. It can also be used as the value for kCTBaselineClassAttributeName.
  1282. }
  1283. var kCTBaselineClassIdeographicLow: CFStringRef; external name '_kCTBaselineClassIdeographicLow'; (* attribute const *)
  1284. (* CT_AVAILABLE_STARTING( __MAC_10_8, __IPHONE_6_0) *)
  1285. {!
  1286. @defined kCTBaselineClassIdeographicHigh
  1287. @abstract Key to reference the Ideographic High baseline class.
  1288. @discussion This key can be used with a baseline info dictionary to offset to the Ideographic High baseline as a CFNumberRef float. It can also be used as the value for kCTBaselineClassAttributeName.
  1289. }
  1290. var kCTBaselineClassIdeographicHigh: CFStringRef; external name '_kCTBaselineClassIdeographicHigh'; (* attribute const *)
  1291. (* CT_AVAILABLE_STARTING( __MAC_10_8, __IPHONE_6_0) *)
  1292. {!
  1293. @defined kCTBaselineClassHanging
  1294. @abstract Key to reference the Hanging baseline class.
  1295. @discussion This key can be used with a baseline info dictionary to offset to the Hanging baseline as a CFNumberRef float. It can also be used as the value for kCTBaselineClassAttributeName.
  1296. }
  1297. var kCTBaselineClassHanging: CFStringRef; external name '_kCTBaselineClassHanging'; (* attribute const *)
  1298. (* CT_AVAILABLE_STARTING( __MAC_10_8, __IPHONE_6_0) *)
  1299. {!
  1300. @defined kCTBaselineClassMathKey
  1301. @abstract Key to reference the Math baseline class.
  1302. @discussion This key can be used with a baseline info dictionary to offset to the Math baseline as a CFNumberRef float. It can also be used as the value for kCTBaselineClassAttributeName.
  1303. }
  1304. var kCTBaselineClassMath: CFStringRef; external name '_kCTBaselineClassMath'; (* attribute const *)
  1305. (* CT_AVAILABLE_STARTING( __MAC_10_8, __IPHONE_6_0) *)
  1306. {!
  1307. @defined kCTBaselineReferenceFont
  1308. @abstract Key to reference a font for the reference baseline.
  1309. @discussion This key can be used to specify a font for the reference baseline. The value is a CTFontRef or the kCTBaselineOriginalFont constant.
  1310. }
  1311. var kCTBaselineReferenceFont: CFStringRef; external name '_kCTBaselineReferenceFont'; (* attribute const *)
  1312. (* CT_AVAILABLE_STARTING( __MAC_10_8, __IPHONE_6_0) *)
  1313. {!
  1314. @defined kCTBaselineOriginalFont
  1315. @abstract Use the original font for setting the reference baseline.
  1316. @discussion This constant can be used as the value for kCTBaselineReferenceFont to specify that the original font should be used for the reference baseline.
  1317. }
  1318. var kCTBaselineOriginalFont: CFStringRef; external name '_kCTBaselineOriginalFont'; (* attribute const *)
  1319. (* CT_AVAILABLE_STARTING( __MAC_10_8, __IPHONE_6_0) *)
  1320. {!
  1321. @function CTFontCopyDefaultCascadeListForLanguages
  1322. @abstract Return an ordered list of CTFontDescriptorRef's for font fallback derived from the system default fallback region according to the given language preferences. The style of the given is also matched as well as the weight and width of the font is not one of the system UI font, otherwise the UI font fallback is applied.
  1323. @param font
  1324. The font reference.
  1325. @param languagePrefList
  1326. The language preference list - ordered array of CFStringRef's of ISO language codes.
  1327. @result The ordered list of fallback fonts - ordered array of CTFontDescriptors.
  1328. }
  1329. function CTFontCopyDefaultCascadeListForLanguages( font: CTFontRef; languagePrefList: CFArrayRef ): CFArrayRef; external name '_CTFontCopyDefaultCascadeListForLanguages';
  1330. (* CT_AVAILABLE_STARTING( __MAC_10_8, __IPHONE_6_0) *)
  1331. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  1332. end.
  1333. {$endc} {not MACOSALLINCLUDE}