objc2_core_text/generated/CTFont.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7#[cfg(feature = "objc2")]
8use objc2::__framework_prelude::*;
9use objc2_core_foundation::*;
10#[cfg(feature = "objc2-core-graphics")]
11use objc2_core_graphics::*;
12
13use crate::*;
14
15/// [Apple's documentation](https://developer.apple.com/documentation/coretext/ctfont?language=objc)
16#[repr(C)]
17pub struct CTFont {
18 inner: [u8; 0],
19 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
20}
21
22cf_type!(
23 #[encoding_name = "__CTFont"]
24 unsafe impl CTFont {}
25);
26
27unsafe impl ConcreteType for CTFont {
28 /// Returns the type identifier for Core Text font references.
29 ///
30 /// Returns: The identifier for the opaque type CTFontRef.
31 #[doc(alias = "CTFontGetTypeID")]
32 #[inline]
33 fn type_id() -> CFTypeID {
34 extern "C-unwind" {
35 fn CTFontGetTypeID() -> CFTypeID;
36 }
37 unsafe { CTFontGetTypeID() }
38 }
39}
40
41extern "C" {
42 /// kCTFontCopyrightNameKey
43 ///
44 /// The name specifier for the copyright name.
45 ///
46 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontcopyrightnamekey?language=objc)
47 pub static kCTFontCopyrightNameKey: &'static CFString;
48}
49
50extern "C" {
51 /// kCTFontFamilyNameKey
52 ///
53 /// The name specifier for the family name.
54 ///
55 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontfamilynamekey?language=objc)
56 pub static kCTFontFamilyNameKey: &'static CFString;
57}
58
59extern "C" {
60 /// kCTFontSubFamilyNameKey
61 ///
62 /// The name specifier for the subfamily name.
63 ///
64 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontsubfamilynamekey?language=objc)
65 pub static kCTFontSubFamilyNameKey: &'static CFString;
66}
67
68extern "C" {
69 /// kCTFontStyleNameKey
70 ///
71 /// The name specifier for the style name.
72 ///
73 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontstylenamekey?language=objc)
74 pub static kCTFontStyleNameKey: &'static CFString;
75}
76
77extern "C" {
78 /// kCTFontUniqueNameKey
79 ///
80 /// The name specifier for the unique name.
81 ///
82 /// Note that this name is often not unique and should not be
83 /// assumed to be truly unique.
84 ///
85 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontuniquenamekey?language=objc)
86 pub static kCTFontUniqueNameKey: &'static CFString;
87}
88
89extern "C" {
90 /// kCTFontFullNameKey
91 ///
92 /// The name specifier for the full name.
93 ///
94 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontfullnamekey?language=objc)
95 pub static kCTFontFullNameKey: &'static CFString;
96}
97
98extern "C" {
99 /// kCTFontVersionNameKey
100 ///
101 /// The name specifier for the version name.
102 ///
103 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontversionnamekey?language=objc)
104 pub static kCTFontVersionNameKey: &'static CFString;
105}
106
107extern "C" {
108 /// kCTFontPostScriptNameKey
109 ///
110 /// The name specifier for the PostScript name.
111 ///
112 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontpostscriptnamekey?language=objc)
113 pub static kCTFontPostScriptNameKey: &'static CFString;
114}
115
116extern "C" {
117 /// kCTFontTrademarkNameKey
118 ///
119 /// The name specifier for the trademark name.
120 ///
121 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttrademarknamekey?language=objc)
122 pub static kCTFontTrademarkNameKey: &'static CFString;
123}
124
125extern "C" {
126 /// kCTFontManufacturerNameKey
127 ///
128 /// The name specifier for the manufacturer name.
129 ///
130 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontmanufacturernamekey?language=objc)
131 pub static kCTFontManufacturerNameKey: &'static CFString;
132}
133
134extern "C" {
135 /// kCTFontDesignerNameKey
136 ///
137 /// The name specifier for the designer name.
138 ///
139 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontdesignernamekey?language=objc)
140 pub static kCTFontDesignerNameKey: &'static CFString;
141}
142
143extern "C" {
144 /// kCTFontDescriptionNameKey
145 ///
146 /// The name specifier for the description name.
147 ///
148 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontdescriptionnamekey?language=objc)
149 pub static kCTFontDescriptionNameKey: &'static CFString;
150}
151
152extern "C" {
153 /// kCTFontVendorURLNameKey
154 ///
155 /// The name specifier for the vendor url name.
156 ///
157 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontvendorurlnamekey?language=objc)
158 pub static kCTFontVendorURLNameKey: &'static CFString;
159}
160
161extern "C" {
162 /// kCTFontDesignerURLNameKey
163 ///
164 /// The name specifier for the designer url name.
165 ///
166 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontdesignerurlnamekey?language=objc)
167 pub static kCTFontDesignerURLNameKey: &'static CFString;
168}
169
170extern "C" {
171 /// kCTFontLicenseNameKey
172 ///
173 /// The name specifier for the license name.
174 ///
175 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontlicensenamekey?language=objc)
176 pub static kCTFontLicenseNameKey: &'static CFString;
177}
178
179extern "C" {
180 /// kCTFontLicenseURLNameKey
181 ///
182 /// The name specifier for the license url name.
183 ///
184 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontlicenseurlnamekey?language=objc)
185 pub static kCTFontLicenseURLNameKey: &'static CFString;
186}
187
188extern "C" {
189 /// kCTFontSampleTextNameKey
190 ///
191 /// The name specifier for the sample text name string.
192 ///
193 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontsampletextnamekey?language=objc)
194 pub static kCTFontSampleTextNameKey: &'static CFString;
195}
196
197extern "C" {
198 /// kCTFontPostScriptCIDNameKey
199 ///
200 /// The name specifier for the PostScript CID name.
201 ///
202 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontpostscriptcidnamekey?language=objc)
203 pub static kCTFontPostScriptCIDNameKey: &'static CFString;
204}
205
206/// Returns a new font reference for the given name.
207///
208///
209/// This function uses font descriptor matching so only registered fonts can be returned; see CTFontManager.h for more information. If you are trying to create a system UI font (with name beginning with a "."), you should use CTFontCreateUIFontForLanguage() or appropriate AppKit/UIKit APIs instead.
210///
211///
212/// Parameter `name`: 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. Any font name beginning with a "." is reserved for the system and should not be used here.
213///
214///
215/// Parameter `size`: The point size for the font reference. If 0.0 is specified, the default font size of 12.0 will be used.
216///
217///
218/// Parameter `matrix`: The transformation matrix for the font. If unspecified, the identity matrix will be used. Optional.
219///
220///
221/// Returns: 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.
222#[inline]
223pub unsafe extern "C-unwind" fn CTFontCreateWithName(
224 name: &CFString,
225 size: CGFloat,
226 matrix: *const CGAffineTransform,
227) -> CFRetained<CTFont> {
228 extern "C-unwind" {
229 fn CTFontCreateWithName(
230 name: &CFString,
231 size: CGFloat,
232 matrix: *const CGAffineTransform,
233 ) -> Option<NonNull<CTFont>>;
234 }
235 let ret = unsafe { CTFontCreateWithName(name, size, matrix) };
236 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
237 unsafe { CFRetained::from_raw(ret) }
238}
239
240/// Returns a new font reference that best matches the font descriptor.
241///
242///
243/// Parameter `descriptor`: A font descriptor containing attributes that specify the requested font.
244///
245///
246/// Parameter `size`: The point size for the font reference. If 0.0 is specified and the font descriptor does not specify the size, the default font size of 12.0 will be used.
247///
248///
249/// Parameter `matrix`: The transformation matrix for the font. If unspecified, the identity matrix will be used. Optional.
250///
251///
252/// Returns: 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.
253#[cfg(feature = "CTFontDescriptor")]
254#[inline]
255pub unsafe extern "C-unwind" fn CTFontCreateWithFontDescriptor(
256 descriptor: &CTFontDescriptor,
257 size: CGFloat,
258 matrix: *const CGAffineTransform,
259) -> CFRetained<CTFont> {
260 extern "C-unwind" {
261 fn CTFontCreateWithFontDescriptor(
262 descriptor: &CTFontDescriptor,
263 size: CGFloat,
264 matrix: *const CGAffineTransform,
265 ) -> Option<NonNull<CTFont>>;
266 }
267 let ret = unsafe { CTFontCreateWithFontDescriptor(descriptor, size, matrix) };
268 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
269 unsafe { CFRetained::from_raw(ret) }
270}
271
272/// Options for descriptor match and font creation.
273///
274/// Prevents automatic font activation from taking place.
275/// This option is available only on macOS and will be deprecated on other platforms in the future.
276///
277/// Prevents automatic font download from taking place.
278///
279/// Font matching will prefer to match Apple system fonts.
280///
281/// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/ctfontoptions?language=objc)
282// NS_OPTIONS
283#[repr(transparent)]
284#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
285pub struct CTFontOptions(pub CFOptionFlags);
286bitflags::bitflags! {
287 impl CTFontOptions: CFOptionFlags {
288 #[doc(alias = "kCTFontOptionsDefault")]
289 const Default = 0;
290 #[doc(alias = "kCTFontOptionsPreventAutoActivation")]
291 const PreventAutoActivation = 1<<0;
292 #[doc(alias = "kCTFontOptionsPreventAutoDownload")]
293 const PreventAutoDownload = 1<<1;
294 #[doc(alias = "kCTFontOptionsPreferSystemFont")]
295 const PreferSystemFont = 1<<2;
296 }
297}
298
299#[cfg(feature = "objc2")]
300unsafe impl Encode for CTFontOptions {
301 const ENCODING: Encoding = CFOptionFlags::ENCODING;
302}
303
304#[cfg(feature = "objc2")]
305unsafe impl RefEncode for CTFontOptions {
306 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
307}
308
309/// Returns a new font reference for the given name.
310///
311///
312/// This function uses font descriptor matching so only registered fonts can be returned; see CTFontManager.h for more information. If you are trying to create a system UI font (with name beginning with a "."), you should use CTFontCreateUIFontForLanguage() or appropriate AppKit/UIKit APIs instead.
313///
314///
315/// Parameter `name`: 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. Any font name beginning with a "." is reserved for the system and should not be used here.
316///
317///
318/// Parameter `size`: The point size for the font reference. If 0.0 is specified, the default font size of 12.0 will be used.
319///
320///
321/// Parameter `matrix`: The transformation matrix for the font. If unspecified, the identity matrix will be used. Optional.
322///
323///
324/// Parameter `options`: Options flags.
325///
326///
327/// Returns: 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.
328#[inline]
329pub unsafe extern "C-unwind" fn CTFontCreateWithNameAndOptions(
330 name: &CFString,
331 size: CGFloat,
332 matrix: *const CGAffineTransform,
333 options: CTFontOptions,
334) -> CFRetained<CTFont> {
335 extern "C-unwind" {
336 fn CTFontCreateWithNameAndOptions(
337 name: &CFString,
338 size: CGFloat,
339 matrix: *const CGAffineTransform,
340 options: CTFontOptions,
341 ) -> Option<NonNull<CTFont>>;
342 }
343 let ret = unsafe { CTFontCreateWithNameAndOptions(name, size, matrix, options) };
344 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
345 unsafe { CFRetained::from_raw(ret) }
346}
347
348/// Returns a new font reference that best matches the font descriptor.
349///
350///
351/// Parameter `descriptor`: A font descriptor containing attributes that specify the requested font.
352///
353///
354/// Parameter `size`: The point size for the font reference. If 0.0 is specified, the default font size of 12.0 will be used.
355///
356///
357/// Parameter `matrix`: The transformation matrix for the font. If unspecified, the identity matrix will be used. Optional.
358///
359///
360/// Parameter `options`: Options flags.
361///
362///
363/// Returns: 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.
364#[cfg(feature = "CTFontDescriptor")]
365#[inline]
366pub unsafe extern "C-unwind" fn CTFontCreateWithFontDescriptorAndOptions(
367 descriptor: &CTFontDescriptor,
368 size: CGFloat,
369 matrix: *const CGAffineTransform,
370 options: CTFontOptions,
371) -> CFRetained<CTFont> {
372 extern "C-unwind" {
373 fn CTFontCreateWithFontDescriptorAndOptions(
374 descriptor: &CTFontDescriptor,
375 size: CGFloat,
376 matrix: *const CGAffineTransform,
377 options: CTFontOptions,
378 ) -> Option<NonNull<CTFont>>;
379 }
380 let ret =
381 unsafe { CTFontCreateWithFontDescriptorAndOptions(descriptor, size, matrix, options) };
382 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
383 unsafe { CFRetained::from_raw(ret) }
384}
385
386/// These constants represent the specific user interface purpose to specify for font creation.
387///
388/// Use these constants with CTFontCreateUIFontForLanguage to indicate the intended user interface usage of the font reference to be created.
389///
390/// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/ctfontuifonttype?language=objc)
391// NS_ENUM
392#[repr(transparent)]
393#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
394pub struct CTFontUIFontType(pub u32);
395impl CTFontUIFontType {
396 #[doc(alias = "kCTFontUIFontNone")]
397 pub const None: Self = Self(4294967295);
398 #[doc(alias = "kCTFontUIFontUser")]
399 pub const User: Self = Self(0);
400 #[doc(alias = "kCTFontUIFontUserFixedPitch")]
401 pub const UserFixedPitch: Self = Self(1);
402 #[doc(alias = "kCTFontUIFontSystem")]
403 pub const System: Self = Self(2);
404 #[doc(alias = "kCTFontUIFontEmphasizedSystem")]
405 pub const EmphasizedSystem: Self = Self(3);
406 #[doc(alias = "kCTFontUIFontSmallSystem")]
407 pub const SmallSystem: Self = Self(4);
408 #[doc(alias = "kCTFontUIFontSmallEmphasizedSystem")]
409 pub const SmallEmphasizedSystem: Self = Self(5);
410 #[doc(alias = "kCTFontUIFontMiniSystem")]
411 pub const MiniSystem: Self = Self(6);
412 #[doc(alias = "kCTFontUIFontMiniEmphasizedSystem")]
413 pub const MiniEmphasizedSystem: Self = Self(7);
414 #[doc(alias = "kCTFontUIFontViews")]
415 pub const Views: Self = Self(8);
416 #[doc(alias = "kCTFontUIFontApplication")]
417 pub const Application: Self = Self(9);
418 #[doc(alias = "kCTFontUIFontLabel")]
419 pub const Label: Self = Self(10);
420 #[doc(alias = "kCTFontUIFontMenuTitle")]
421 pub const MenuTitle: Self = Self(11);
422 #[doc(alias = "kCTFontUIFontMenuItem")]
423 pub const MenuItem: Self = Self(12);
424 #[doc(alias = "kCTFontUIFontMenuItemMark")]
425 pub const MenuItemMark: Self = Self(13);
426 #[doc(alias = "kCTFontUIFontMenuItemCmdKey")]
427 pub const MenuItemCmdKey: Self = Self(14);
428 #[doc(alias = "kCTFontUIFontWindowTitle")]
429 pub const WindowTitle: Self = Self(15);
430 #[doc(alias = "kCTFontUIFontPushButton")]
431 pub const PushButton: Self = Self(16);
432 #[doc(alias = "kCTFontUIFontUtilityWindowTitle")]
433 pub const UtilityWindowTitle: Self = Self(17);
434 #[doc(alias = "kCTFontUIFontAlertHeader")]
435 pub const AlertHeader: Self = Self(18);
436 #[doc(alias = "kCTFontUIFontSystemDetail")]
437 pub const SystemDetail: Self = Self(19);
438 #[doc(alias = "kCTFontUIFontEmphasizedSystemDetail")]
439 pub const EmphasizedSystemDetail: Self = Self(20);
440 #[doc(alias = "kCTFontUIFontToolbar")]
441 pub const Toolbar: Self = Self(21);
442 #[doc(alias = "kCTFontUIFontSmallToolbar")]
443 pub const SmallToolbar: Self = Self(22);
444 #[doc(alias = "kCTFontUIFontMessage")]
445 pub const Message: Self = Self(23);
446 #[doc(alias = "kCTFontUIFontPalette")]
447 pub const Palette: Self = Self(24);
448 #[doc(alias = "kCTFontUIFontToolTip")]
449 pub const ToolTip: Self = Self(25);
450 #[doc(alias = "kCTFontUIFontControlContent")]
451 pub const ControlContent: Self = Self(26);
452 #[deprecated = "Deprecated"]
453 pub const kCTFontNoFontType: Self = Self(CTFontUIFontType::None.0);
454 #[deprecated = "Deprecated"]
455 pub const kCTFontUserFontType: Self = Self(CTFontUIFontType::User.0);
456 #[deprecated = "Deprecated"]
457 pub const kCTFontUserFixedPitchFontType: Self = Self(CTFontUIFontType::UserFixedPitch.0);
458 #[deprecated = "Deprecated"]
459 pub const kCTFontSystemFontType: Self = Self(CTFontUIFontType::System.0);
460 #[deprecated = "Deprecated"]
461 pub const kCTFontEmphasizedSystemFontType: Self = Self(CTFontUIFontType::EmphasizedSystem.0);
462 #[deprecated = "Deprecated"]
463 pub const kCTFontSmallSystemFontType: Self = Self(CTFontUIFontType::SmallSystem.0);
464 #[deprecated = "Deprecated"]
465 pub const kCTFontSmallEmphasizedSystemFontType: Self =
466 Self(CTFontUIFontType::SmallEmphasizedSystem.0);
467 #[deprecated = "Deprecated"]
468 pub const kCTFontMiniSystemFontType: Self = Self(CTFontUIFontType::MiniSystem.0);
469 #[deprecated = "Deprecated"]
470 pub const kCTFontMiniEmphasizedSystemFontType: Self =
471 Self(CTFontUIFontType::MiniEmphasizedSystem.0);
472 #[deprecated = "Deprecated"]
473 pub const kCTFontViewsFontType: Self = Self(CTFontUIFontType::Views.0);
474 #[deprecated = "Deprecated"]
475 pub const kCTFontApplicationFontType: Self = Self(CTFontUIFontType::Application.0);
476 #[deprecated = "Deprecated"]
477 pub const kCTFontLabelFontType: Self = Self(CTFontUIFontType::Label.0);
478 #[deprecated = "Deprecated"]
479 pub const kCTFontMenuTitleFontType: Self = Self(CTFontUIFontType::MenuTitle.0);
480 #[deprecated = "Deprecated"]
481 pub const kCTFontMenuItemFontType: Self = Self(CTFontUIFontType::MenuItem.0);
482 #[deprecated = "Deprecated"]
483 pub const kCTFontMenuItemMarkFontType: Self = Self(CTFontUIFontType::MenuItemMark.0);
484 #[deprecated = "Deprecated"]
485 pub const kCTFontMenuItemCmdKeyFontType: Self = Self(CTFontUIFontType::MenuItemCmdKey.0);
486 #[deprecated = "Deprecated"]
487 pub const kCTFontWindowTitleFontType: Self = Self(CTFontUIFontType::WindowTitle.0);
488 #[deprecated = "Deprecated"]
489 pub const kCTFontPushButtonFontType: Self = Self(CTFontUIFontType::PushButton.0);
490 #[deprecated = "Deprecated"]
491 pub const kCTFontUtilityWindowTitleFontType: Self =
492 Self(CTFontUIFontType::UtilityWindowTitle.0);
493 #[deprecated = "Deprecated"]
494 pub const kCTFontAlertHeaderFontType: Self = Self(CTFontUIFontType::AlertHeader.0);
495 #[deprecated = "Deprecated"]
496 pub const kCTFontSystemDetailFontType: Self = Self(CTFontUIFontType::SystemDetail.0);
497 #[deprecated = "Deprecated"]
498 pub const kCTFontEmphasizedSystemDetailFontType: Self =
499 Self(CTFontUIFontType::EmphasizedSystemDetail.0);
500 #[deprecated = "Deprecated"]
501 pub const kCTFontToolbarFontType: Self = Self(CTFontUIFontType::Toolbar.0);
502 #[deprecated = "Deprecated"]
503 pub const kCTFontSmallToolbarFontType: Self = Self(CTFontUIFontType::SmallToolbar.0);
504 #[deprecated = "Deprecated"]
505 pub const kCTFontMessageFontType: Self = Self(CTFontUIFontType::Message.0);
506 #[deprecated = "Deprecated"]
507 pub const kCTFontPaletteFontType: Self = Self(CTFontUIFontType::Palette.0);
508 #[deprecated = "Deprecated"]
509 pub const kCTFontToolTipFontType: Self = Self(CTFontUIFontType::ToolTip.0);
510 #[deprecated = "Deprecated"]
511 pub const kCTFontControlContentFontType: Self = Self(CTFontUIFontType::ControlContent.0);
512}
513
514#[cfg(feature = "objc2")]
515unsafe impl Encode for CTFontUIFontType {
516 const ENCODING: Encoding = u32::ENCODING;
517}
518
519#[cfg(feature = "objc2")]
520unsafe impl RefEncode for CTFontUIFontType {
521 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
522}
523
524/// Returns the special UI font for the given language and UI type.
525///
526///
527/// Parameter `uiType`: A uiType constant specifying the intended UI use for the requested font reference.
528///
529///
530/// Parameter `size`: The point size for the font reference. If 0.0 is specified, the default size for the requested uiType is used.
531///
532///
533/// Parameter `language`: Language identifier 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 UTS #35.
534///
535///
536/// Returns: 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.
537#[inline]
538pub unsafe extern "C-unwind" fn CTFontCreateUIFontForLanguage(
539 ui_type: CTFontUIFontType,
540 size: CGFloat,
541 language: Option<&CFString>,
542) -> Option<CFRetained<CTFont>> {
543 extern "C-unwind" {
544 fn CTFontCreateUIFontForLanguage(
545 ui_type: CTFontUIFontType,
546 size: CGFloat,
547 language: Option<&CFString>,
548 ) -> Option<NonNull<CTFont>>;
549 }
550 let ret = unsafe { CTFontCreateUIFontForLanguage(ui_type, size, language) };
551 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
552}
553
554/// Returns a new font with additional attributes based on the original font.
555///
556///
557/// 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.
558///
559///
560/// Parameter `font`: Original font reference to base new font on.
561///
562///
563/// Parameter `size`: The point size for the font reference. If 0.0 is specified, the original font's size will be preserved.
564///
565///
566/// Parameter `matrix`: The transformation matrix for the font. If unspecified, the original font matrix will be preserved. Optional.
567///
568///
569/// Parameter `attributes`: A font descriptor containing additional attributes that the new font should contain.
570///
571///
572/// Returns: Returns a new font reference converted from the original with the specified attributes.
573#[cfg(feature = "CTFontDescriptor")]
574#[inline]
575pub unsafe extern "C-unwind" fn CTFontCreateCopyWithAttributes(
576 font: &CTFont,
577 size: CGFloat,
578 matrix: *const CGAffineTransform,
579 attributes: Option<&CTFontDescriptor>,
580) -> CFRetained<CTFont> {
581 extern "C-unwind" {
582 fn CTFontCreateCopyWithAttributes(
583 font: &CTFont,
584 size: CGFloat,
585 matrix: *const CGAffineTransform,
586 attributes: Option<&CTFontDescriptor>,
587 ) -> Option<NonNull<CTFont>>;
588 }
589 let ret = unsafe { CTFontCreateCopyWithAttributes(font, size, matrix, attributes) };
590 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
591 unsafe { CFRetained::from_raw(ret) }
592}
593
594/// Returns a new font based on the original font with the specified symbolic traits.
595///
596///
597/// Parameter `font`: Original font reference on which to base the new font.
598///
599///
600/// Parameter `size`: The point size for the font reference. If 0.0 is specified, the original font's size will be preserved.
601///
602///
603/// Parameter `matrix`: The transformation matrix for the font. If unspecified, the original font matrix will be preserved. Optional.
604///
605///
606/// Parameter `symTraitValue`: 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.
607///
608///
609/// Parameter `symTraitMask`: The mask bits of the symbolic traits. This bitfield is used to indicate the traits that should be changed.
610///
611///
612/// Returns: Returns a new font reference in the same family with the given symbolic traits, or NULL if none found in the system.
613#[cfg(feature = "CTFontTraits")]
614#[inline]
615pub unsafe extern "C-unwind" fn CTFontCreateCopyWithSymbolicTraits(
616 font: &CTFont,
617 size: CGFloat,
618 matrix: *const CGAffineTransform,
619 sym_trait_value: CTFontSymbolicTraits,
620 sym_trait_mask: CTFontSymbolicTraits,
621) -> Option<CFRetained<CTFont>> {
622 extern "C-unwind" {
623 fn CTFontCreateCopyWithSymbolicTraits(
624 font: &CTFont,
625 size: CGFloat,
626 matrix: *const CGAffineTransform,
627 sym_trait_value: CTFontSymbolicTraits,
628 sym_trait_mask: CTFontSymbolicTraits,
629 ) -> Option<NonNull<CTFont>>;
630 }
631 let ret = unsafe {
632 CTFontCreateCopyWithSymbolicTraits(font, size, matrix, sym_trait_value, sym_trait_mask)
633 };
634 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
635}
636
637/// Returns a new font in the specified family based on the traits of the original font.
638///
639///
640/// Parameter `font`: Original font reference to base new font on.
641///
642///
643/// Parameter `size`: The point size for the font reference. If 0.0 is specified, the original font's size will be preserved.
644///
645///
646/// Parameter `matrix`: The transformation matrix for the font. If unspecified, the original font matrix will be preserved. Optional.
647///
648///
649/// Parameter `family`: The name of the desired family.
650///
651///
652/// Returns: Returns a new font reference with the original traits in the given family. NULL if non found in the system.
653#[inline]
654pub unsafe extern "C-unwind" fn CTFontCreateCopyWithFamily(
655 font: &CTFont,
656 size: CGFloat,
657 matrix: *const CGAffineTransform,
658 family: &CFString,
659) -> Option<CFRetained<CTFont>> {
660 extern "C-unwind" {
661 fn CTFontCreateCopyWithFamily(
662 font: &CTFont,
663 size: CGFloat,
664 matrix: *const CGAffineTransform,
665 family: &CFString,
666 ) -> Option<NonNull<CTFont>>;
667 }
668 let ret = unsafe { CTFontCreateCopyWithFamily(font, size, matrix, family) };
669 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
670}
671
672/// Returns a new font reference that can best map the given string range based on the current font.
673///
674///
675/// 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.
676///
677///
678/// Parameter `currentFont`: The current font that contains a valid cascade list.
679///
680///
681/// Parameter `string`: A unicode string containing characters that cannot be encoded by the current font.
682///
683///
684/// Parameter `range`: A CFRange specifying the range of the string that needs to be mapped.
685///
686///
687/// Returns: This function returns the best substitute font that can encode the specified string range.
688///
689///
690/// See also: CTFontCopyCharacterSet
691///
692/// See also: CTFontGetGlyphsForCharacters
693///
694/// See also: kCTFontCascadeListAttribute
695#[inline]
696pub unsafe extern "C-unwind" fn CTFontCreateForString(
697 current_font: &CTFont,
698 string: &CFString,
699 range: CFRange,
700) -> CFRetained<CTFont> {
701 extern "C-unwind" {
702 fn CTFontCreateForString(
703 current_font: &CTFont,
704 string: &CFString,
705 range: CFRange,
706 ) -> Option<NonNull<CTFont>>;
707 }
708 let ret = unsafe { CTFontCreateForString(current_font, string, range) };
709 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
710 unsafe { CFRetained::from_raw(ret) }
711}
712
713/// Returns a new font reference that can best map the given string range based on the current font and language specified.
714///
715///
716/// The current font itself can be returned if it covers the string provided.
717///
718///
719/// Parameter `currentFont`: The current font that contains a valid cascade list.
720///
721///
722/// Parameter `string`: A unicode string containing characters that cannot be encoded by the current font.
723///
724///
725/// Parameter `range`: A CFRange specifying the range of the string that needs to be mapped.
726///
727///
728/// Parameter `language`: Language identifier 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 UTS #35.
729///
730///
731/// Returns: This function returns the best substitute font that can encode the specified string range.
732///
733///
734/// See also: CTFontCopyCharacterSet
735///
736/// See also: CTFontGetGlyphsForCharacters
737///
738/// See also: kCTFontCascadeListAttribute
739#[inline]
740pub unsafe extern "C-unwind" fn CTFontCreateForStringWithLanguage(
741 current_font: &CTFont,
742 string: &CFString,
743 range: CFRange,
744 language: Option<&CFString>,
745) -> CFRetained<CTFont> {
746 extern "C-unwind" {
747 fn CTFontCreateForStringWithLanguage(
748 current_font: &CTFont,
749 string: &CFString,
750 range: CFRange,
751 language: Option<&CFString>,
752 ) -> Option<NonNull<CTFont>>;
753 }
754 let ret = unsafe { CTFontCreateForStringWithLanguage(current_font, string, range, language) };
755 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
756 unsafe { CFRetained::from_raw(ret) }
757}
758
759/// Returns the normalized font descriptors for the given font reference.
760///
761///
762/// Parameter `font`: The font reference.
763///
764///
765/// Returns: This function returns a normalized font descriptor for a font. The font descriptor contains enough information to recreate this font at a later time.
766#[cfg(feature = "CTFontDescriptor")]
767#[inline]
768pub unsafe extern "C-unwind" fn CTFontCopyFontDescriptor(
769 font: &CTFont,
770) -> CFRetained<CTFontDescriptor> {
771 extern "C-unwind" {
772 fn CTFontCopyFontDescriptor(font: &CTFont) -> Option<NonNull<CTFontDescriptor>>;
773 }
774 let ret = unsafe { CTFontCopyFontDescriptor(font) };
775 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
776 unsafe { CFRetained::from_raw(ret) }
777}
778
779/// Returns the value associated with an arbitrary attribute.
780///
781///
782/// Parameter `font`: The font reference.
783///
784///
785/// Parameter `attribute`: The requested attribute.
786///
787///
788/// Returns: 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.
789#[inline]
790pub unsafe extern "C-unwind" fn CTFontCopyAttribute(
791 font: &CTFont,
792 attribute: &CFString,
793) -> Option<CFRetained<CFType>> {
794 extern "C-unwind" {
795 fn CTFontCopyAttribute(font: &CTFont, attribute: &CFString) -> Option<NonNull<CFType>>;
796 }
797 let ret = unsafe { CTFontCopyAttribute(font, attribute) };
798 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
799}
800
801extern "C-unwind" {
802 /// Returns the point size of the font reference.
803 ///
804 ///
805 /// Parameter `font`: The font reference.
806 ///
807 ///
808 /// Returns: This function returns the point size of the given font reference. This is the point size provided when the font was created.
809 pub fn CTFontGetSize(font: &CTFont) -> CGFloat;
810}
811
812extern "C-unwind" {
813 /// Returns the transformation matrix of the font.
814 ///
815 ///
816 /// Parameter `font`: The font reference.
817 ///
818 ///
819 /// Returns: This function returns the transformation matrix for this given font reference. This is the matrix that was provided when the font was created.
820 pub fn CTFontGetMatrix(font: &CTFont) -> CGAffineTransform;
821}
822
823extern "C-unwind" {
824 /// Returns the symbolic font traits.
825 ///
826 ///
827 /// Parameter `font`: The font reference.
828 ///
829 ///
830 /// Returns: 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.
831 #[cfg(feature = "CTFontTraits")]
832 pub fn CTFontGetSymbolicTraits(font: &CTFont) -> CTFontSymbolicTraits;
833}
834
835/// Returns the font traits dictionary.
836///
837///
838/// Parameter `font`: The font reference.
839///
840///
841/// Returns: 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.
842#[inline]
843pub unsafe extern "C-unwind" fn CTFontCopyTraits(font: &CTFont) -> CFRetained<CFDictionary> {
844 extern "C-unwind" {
845 fn CTFontCopyTraits(font: &CTFont) -> Option<NonNull<CFDictionary>>;
846 }
847 let ret = unsafe { CTFontCopyTraits(font) };
848 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
849 unsafe { CFRetained::from_raw(ret) }
850}
851
852/// Return an ordered list of CTFontDescriptorRef's for font fallback derived from the system default fallback according to the given language preferences, making a reasonable attempt to match the given font's style, weight, and width.
853///
854///
855/// Parameter `font`: The font reference.
856///
857///
858/// Parameter `languagePrefList`: An array of language identifiers as CFString values, in decreasing order of preference.
859///
860///
861/// Returns: The ordered list of fallback fonts - ordered array of CTFontDescriptors.
862#[inline]
863pub unsafe extern "C-unwind" fn CTFontCopyDefaultCascadeListForLanguages(
864 font: &CTFont,
865 language_pref_list: Option<&CFArray>,
866) -> Option<CFRetained<CFArray>> {
867 extern "C-unwind" {
868 fn CTFontCopyDefaultCascadeListForLanguages(
869 font: &CTFont,
870 language_pref_list: Option<&CFArray>,
871 ) -> Option<NonNull<CFArray>>;
872 }
873 let ret = unsafe { CTFontCopyDefaultCascadeListForLanguages(font, language_pref_list) };
874 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
875}
876
877/// Returns the PostScript name.
878///
879///
880/// Parameter `font`: The font reference.
881///
882///
883/// Returns: This function returns a retained reference to the PostScript name of the font.
884#[inline]
885pub unsafe extern "C-unwind" fn CTFontCopyPostScriptName(font: &CTFont) -> CFRetained<CFString> {
886 extern "C-unwind" {
887 fn CTFontCopyPostScriptName(font: &CTFont) -> Option<NonNull<CFString>>;
888 }
889 let ret = unsafe { CTFontCopyPostScriptName(font) };
890 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
891 unsafe { CFRetained::from_raw(ret) }
892}
893
894/// Returns the family name.
895///
896///
897/// Parameter `font`: The font reference.
898///
899///
900/// Returns: This function returns a retained reference to the family name of the font.
901#[inline]
902pub unsafe extern "C-unwind" fn CTFontCopyFamilyName(font: &CTFont) -> CFRetained<CFString> {
903 extern "C-unwind" {
904 fn CTFontCopyFamilyName(font: &CTFont) -> Option<NonNull<CFString>>;
905 }
906 let ret = unsafe { CTFontCopyFamilyName(font) };
907 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
908 unsafe { CFRetained::from_raw(ret) }
909}
910
911/// Returns the display name.
912///
913///
914/// Parameter `font`: The font reference.
915///
916///
917/// Returns: This function returns a retained reference to the full name of the font.
918#[inline]
919pub unsafe extern "C-unwind" fn CTFontCopyFullName(font: &CTFont) -> CFRetained<CFString> {
920 extern "C-unwind" {
921 fn CTFontCopyFullName(font: &CTFont) -> Option<NonNull<CFString>>;
922 }
923 let ret = unsafe { CTFontCopyFullName(font) };
924 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
925 unsafe { CFRetained::from_raw(ret) }
926}
927
928/// Returns the display name.
929///
930///
931/// Parameter `font`: The font reference.
932///
933///
934/// Returns: This function returns a retained reference to the localized display name of the font.
935#[inline]
936pub unsafe extern "C-unwind" fn CTFontCopyDisplayName(font: &CTFont) -> CFRetained<CFString> {
937 extern "C-unwind" {
938 fn CTFontCopyDisplayName(font: &CTFont) -> Option<NonNull<CFString>>;
939 }
940 let ret = unsafe { CTFontCopyDisplayName(font) };
941 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
942 unsafe { CFRetained::from_raw(ret) }
943}
944
945/// Returns a reference to the requested name.
946///
947///
948/// Parameter `font`: The font reference.
949///
950///
951/// Parameter `nameKey`: The name specifier. See name specifier constants.
952///
953///
954/// Returns: 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.
955#[inline]
956pub unsafe extern "C-unwind" fn CTFontCopyName(
957 font: &CTFont,
958 name_key: &CFString,
959) -> Option<CFRetained<CFString>> {
960 extern "C-unwind" {
961 fn CTFontCopyName(font: &CTFont, name_key: &CFString) -> Option<NonNull<CFString>>;
962 }
963 let ret = unsafe { CTFontCopyName(font, name_key) };
964 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
965}
966
967/// Returns a reference to a localized font name.
968///
969///
970/// Parameter `font`: The font reference.
971///
972///
973/// Parameter `nameKey`: The name specifier. See name specifier constants.
974///
975///
976/// Parameter `actualLanguage`: Pointer to a CFStringRef to receive the language identifier of the returned name string. The format of the language identifier will conform to UTS #35.
977/// If CoreText can supply its own localized string where the font cannot, this value will be NULL.
978///
979///
980/// Returns: 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.
981#[inline]
982pub unsafe extern "C-unwind" fn CTFontCopyLocalizedName(
983 font: &CTFont,
984 name_key: &CFString,
985 actual_language: *mut *const CFString,
986) -> Option<CFRetained<CFString>> {
987 extern "C-unwind" {
988 fn CTFontCopyLocalizedName(
989 font: &CTFont,
990 name_key: &CFString,
991 actual_language: *mut *const CFString,
992 ) -> Option<NonNull<CFString>>;
993 }
994 let ret = unsafe { CTFontCopyLocalizedName(font, name_key, actual_language) };
995 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
996}
997
998/// Returns the Unicode character set of the font.
999///
1000///
1001/// Parameter `font`: The font reference.
1002///
1003///
1004/// Returns: 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).
1005#[inline]
1006pub unsafe extern "C-unwind" fn CTFontCopyCharacterSet(
1007 font: &CTFont,
1008) -> CFRetained<CFCharacterSet> {
1009 extern "C-unwind" {
1010 fn CTFontCopyCharacterSet(font: &CTFont) -> Option<NonNull<CFCharacterSet>>;
1011 }
1012 let ret = unsafe { CTFontCopyCharacterSet(font) };
1013 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
1014 unsafe { CFRetained::from_raw(ret) }
1015}
1016
1017extern "C-unwind" {
1018 /// Returns the best string encoding for legacy format support.
1019 ///
1020 ///
1021 /// Parameter `font`: The font reference.
1022 ///
1023 ///
1024 /// Returns: This function returns the best string encoding for the font.
1025 pub fn CTFontGetStringEncoding(font: &CTFont) -> CFStringEncoding;
1026}
1027
1028/// Returns an array of languages supported by the font.
1029///
1030///
1031/// Parameter `font`: The font reference.
1032///
1033///
1034/// Returns: 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 UTS #35.
1035#[inline]
1036pub unsafe extern "C-unwind" fn CTFontCopySupportedLanguages(font: &CTFont) -> CFRetained<CFArray> {
1037 extern "C-unwind" {
1038 fn CTFontCopySupportedLanguages(font: &CTFont) -> Option<NonNull<CFArray>>;
1039 }
1040 let ret = unsafe { CTFontCopySupportedLanguages(font) };
1041 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
1042 unsafe { CFRetained::from_raw(ret) }
1043}
1044
1045extern "C-unwind" {
1046 /// Performs basic character-to-glyph mapping.
1047 ///
1048 ///
1049 /// 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.
1050 ///
1051 ///
1052 /// Parameter `font`: The font reference.
1053 ///
1054 ///
1055 /// Parameter `characters`: An array of characters (UTF-16 code units). Non-BMP characters must be encoded as surrogate pairs.
1056 ///
1057 ///
1058 /// Parameter `glyphs`: 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.
1059 ///
1060 ///
1061 /// Parameter `count`: The capacity of both the characters and glyphs arrays.
1062 ///
1063 ///
1064 /// Returns: 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).
1065 ///
1066 ///
1067 /// See also: CTFontCopyCharacterSet
1068 #[cfg(feature = "objc2-core-graphics")]
1069 pub fn CTFontGetGlyphsForCharacters(
1070 font: &CTFont,
1071 characters: NonNull<UniChar>,
1072 glyphs: NonNull<CGGlyph>,
1073 count: CFIndex,
1074 ) -> bool;
1075}
1076
1077extern "C-unwind" {
1078 /// Returns the scaled font ascent metric.
1079 ///
1080 ///
1081 /// Parameter `font`: The font reference.
1082 ///
1083 ///
1084 /// Returns: This function returns the font ascent metric scaled based on the point size and matrix of the font reference.
1085 pub fn CTFontGetAscent(font: &CTFont) -> CGFloat;
1086}
1087
1088extern "C-unwind" {
1089 /// Returns the scaled font descent metric.
1090 ///
1091 ///
1092 /// Parameter `font`: The font reference.
1093 ///
1094 ///
1095 /// Returns: This function returns the font descent metric scaled based on the point size and matrix of the font reference.
1096 pub fn CTFontGetDescent(font: &CTFont) -> CGFloat;
1097}
1098
1099extern "C-unwind" {
1100 /// Returns the scaled font leading metric.
1101 ///
1102 ///
1103 /// Parameter `font`: The font reference.
1104 ///
1105 ///
1106 /// Returns: This function returns the font leading metric scaled based on the point size and matrix of the font reference.
1107 pub fn CTFontGetLeading(font: &CTFont) -> CGFloat;
1108}
1109
1110extern "C-unwind" {
1111 /// Returns the units per em metric.
1112 ///
1113 ///
1114 /// Parameter `font`: The font reference.
1115 ///
1116 ///
1117 /// Returns: This function returns the units per em of the font.
1118 pub fn CTFontGetUnitsPerEm(font: &CTFont) -> c_uint;
1119}
1120
1121extern "C-unwind" {
1122 /// Returns the number of glyphs.
1123 ///
1124 ///
1125 /// Parameter `font`: The font reference.
1126 ///
1127 ///
1128 /// Returns: This function returns the number of glyphs in the font.
1129 pub fn CTFontGetGlyphCount(font: &CTFont) -> CFIndex;
1130}
1131
1132extern "C-unwind" {
1133 /// Returns the scaled bounding box.
1134 ///
1135 ///
1136 /// Parameter `font`: The font reference.
1137 ///
1138 ///
1139 /// Returns: 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.
1140 pub fn CTFontGetBoundingBox(font: &CTFont) -> CGRect;
1141}
1142
1143extern "C-unwind" {
1144 /// Returns the scaled underline position.
1145 ///
1146 ///
1147 /// Parameter `font`: The font reference.
1148 ///
1149 ///
1150 /// Returns: This function returns the font underline position metric scaled based on the point size and matrix of the font reference.
1151 pub fn CTFontGetUnderlinePosition(font: &CTFont) -> CGFloat;
1152}
1153
1154extern "C-unwind" {
1155 /// Returns the scaled underline thickness metric.
1156 ///
1157 ///
1158 /// Parameter `font`: The font reference.
1159 ///
1160 ///
1161 /// Returns: This function returns the font underline thickness metric scaled based on the point size and matrix of the font reference.
1162 pub fn CTFontGetUnderlineThickness(font: &CTFont) -> CGFloat;
1163}
1164
1165extern "C-unwind" {
1166 /// Returns the slant angle of the font.
1167 ///
1168 ///
1169 /// Parameter `font`: The font reference.
1170 ///
1171 ///
1172 /// Returns: 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.
1173 pub fn CTFontGetSlantAngle(font: &CTFont) -> CGFloat;
1174}
1175
1176extern "C-unwind" {
1177 /// Returns the cap height metric.
1178 ///
1179 ///
1180 /// Parameter `font`: The font reference.
1181 ///
1182 ///
1183 /// Returns: This function returns the font cap height metric scaled based on the point size and matrix of the font reference.
1184 pub fn CTFontGetCapHeight(font: &CTFont) -> CGFloat;
1185}
1186
1187extern "C-unwind" {
1188 /// Returns the X height metric.
1189 ///
1190 ///
1191 /// Parameter `font`: The font reference.
1192 ///
1193 ///
1194 /// Returns: This function returns the font X height metric scaled based on the point size and matrix of the font reference.
1195 pub fn CTFontGetXHeight(font: &CTFont) -> CGFloat;
1196}
1197
1198extern "C-unwind" {
1199 /// Returns the CGGlyph for the specified glyph name.
1200 ///
1201 ///
1202 /// Parameter `font`: The font reference.
1203 ///
1204 ///
1205 /// Parameter `glyphName`: The glyph name as a CFString.
1206 ///
1207 ///
1208 /// Returns: 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.
1209 #[cfg(feature = "objc2-core-graphics")]
1210 pub fn CTFontGetGlyphWithName(font: &CTFont, glyph_name: &CFString) -> CGGlyph;
1211}
1212
1213/// Returns the name for the specified glyph.
1214///
1215///
1216/// Parameter `font`: The font reference.
1217///
1218///
1219/// Parameter `glyph`: The glyph.
1220///
1221///
1222/// Returns: The glyph name as a CFString or NULL if the glyph is invalid.
1223///
1224///
1225/// See also: CTFontGetGlyphWithName
1226#[cfg(feature = "objc2-core-graphics")]
1227#[inline]
1228pub unsafe extern "C-unwind" fn CTFontCopyNameForGlyph(
1229 font: &CTFont,
1230 glyph: CGGlyph,
1231) -> Option<CFRetained<CFString>> {
1232 extern "C-unwind" {
1233 fn CTFontCopyNameForGlyph(font: &CTFont, glyph: CGGlyph) -> Option<NonNull<CFString>>;
1234 }
1235 let ret = unsafe { CTFontCopyNameForGlyph(font, glyph) };
1236 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1237}
1238
1239extern "C-unwind" {
1240 /// Calculates the bounding rects for an array of glyphs and returns the overall bounding rect for the run.
1241 ///
1242 ///
1243 /// Parameter `font`: The font reference.
1244 ///
1245 ///
1246 /// Parameter `orientation`: The intended drawing orientation of the glyphs. Used to determined which glyph metrics to return.
1247 ///
1248 ///
1249 /// Parameter `glyphs`: An array of count number of glyphs.
1250 ///
1251 ///
1252 /// Parameter `boundingRects`: 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.
1253 ///
1254 ///
1255 /// Parameter `count`: The capacity of the glyphs and boundingRects buffers.
1256 ///
1257 ///
1258 /// Returns: 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.
1259 #[cfg(all(feature = "CTFontDescriptor", feature = "objc2-core-graphics"))]
1260 pub fn CTFontGetBoundingRectsForGlyphs(
1261 font: &CTFont,
1262 orientation: CTFontOrientation,
1263 glyphs: NonNull<CGGlyph>,
1264 bounding_rects: *mut CGRect,
1265 count: CFIndex,
1266 ) -> CGRect;
1267}
1268
1269extern "C-unwind" {
1270 /// Calculates the optical bounding rects for an array of glyphs and returns the overall optical bounding rect for the run.
1271 ///
1272 ///
1273 /// 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).
1274 ///
1275 ///
1276 /// Parameter `font`: The font reference.
1277 ///
1278 ///
1279 /// Parameter `glyphs`: An array of count number of glyphs.
1280 ///
1281 ///
1282 /// Parameter `boundingRects`: 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.
1283 ///
1284 ///
1285 /// Parameter `count`: The capacity of the glyphs and boundingRects buffers.
1286 ///
1287 ///
1288 /// Parameter `options`: Reserved, set to zero.
1289 ///
1290 ///
1291 /// Returns: 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.
1292 #[cfg(feature = "objc2-core-graphics")]
1293 pub fn CTFontGetOpticalBoundsForGlyphs(
1294 font: &CTFont,
1295 glyphs: NonNull<CGGlyph>,
1296 bounding_rects: *mut CGRect,
1297 count: CFIndex,
1298 options: CFOptionFlags,
1299 ) -> CGRect;
1300}
1301
1302extern "C-unwind" {
1303 /// Calculates the advances for an array of glyphs and returns the summed advance.
1304 ///
1305 ///
1306 /// Parameter `font`: The font reference.
1307 ///
1308 ///
1309 /// Parameter `orientation`: The intended drawing orientation of the glyphs. Used to determined which glyph metrics to return.
1310 ///
1311 ///
1312 /// Parameter `glyphs`: An array of count number of glyphs.
1313 ///
1314 ///
1315 /// Parameter `advances`: 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.
1316 ///
1317 ///
1318 /// Parameter `count`: The capacity of the glyphs and advances buffers.
1319 ///
1320 ///
1321 /// Returns: 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.
1322 #[cfg(all(feature = "CTFontDescriptor", feature = "objc2-core-graphics"))]
1323 pub fn CTFontGetAdvancesForGlyphs(
1324 font: &CTFont,
1325 orientation: CTFontOrientation,
1326 glyphs: NonNull<CGGlyph>,
1327 advances: *mut CGSize,
1328 count: CFIndex,
1329 ) -> c_double;
1330}
1331
1332extern "C-unwind" {
1333 /// Calculates the offset from the default (horizontal) origin to the vertical origin for an array of glyphs.
1334 ///
1335 ///
1336 /// Parameter `font`: The font reference.
1337 ///
1338 ///
1339 /// Parameter `glyphs`: An array of count number of glyphs.
1340 ///
1341 ///
1342 /// Parameter `translations`: An array of count number of CGSize to receive the computed origin offsets.
1343 ///
1344 ///
1345 /// Parameter `count`: The capacity of the glyphs and translations buffers.
1346 #[cfg(feature = "objc2-core-graphics")]
1347 pub fn CTFontGetVerticalTranslationsForGlyphs(
1348 font: &CTFont,
1349 glyphs: NonNull<CGGlyph>,
1350 translations: NonNull<CGSize>,
1351 count: CFIndex,
1352 );
1353}
1354
1355/// Creates a path for the specified glyph.
1356///
1357///
1358/// 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.
1359///
1360///
1361/// Parameter `font`: The font reference.
1362///
1363///
1364/// Parameter `glyph`: The glyph.
1365///
1366///
1367/// Parameter `matrix`: An affine transform applied to the path. Can be NULL, in which case CGAffineTransformIdentity will be used.
1368///
1369///
1370/// Returns: A retained CGPath reference containing the glyph outlines or NULL if there is no such glyph or it has no outline.
1371#[cfg(feature = "objc2-core-graphics")]
1372#[inline]
1373pub unsafe extern "C-unwind" fn CTFontCreatePathForGlyph(
1374 font: &CTFont,
1375 glyph: CGGlyph,
1376 matrix: *const CGAffineTransform,
1377) -> Option<CFRetained<CGPath>> {
1378 extern "C-unwind" {
1379 fn CTFontCreatePathForGlyph(
1380 font: &CTFont,
1381 glyph: CGGlyph,
1382 matrix: *const CGAffineTransform,
1383 ) -> Option<NonNull<CGPath>>;
1384 }
1385 let ret = unsafe { CTFontCreatePathForGlyph(font, glyph, matrix) };
1386 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1387}
1388
1389extern "C" {
1390 /// kCTFontVariationAxisIdentifierKey
1391 ///
1392 /// Key to get the variation axis identifier.
1393 ///
1394 /// This key is used with a variation axis dictionary to get the axis identifier value as a CFNumberRef.
1395 ///
1396 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontvariationaxisidentifierkey?language=objc)
1397 pub static kCTFontVariationAxisIdentifierKey: &'static CFString;
1398}
1399
1400extern "C" {
1401 /// kCTFontVariationAxisMinimumValueKey
1402 ///
1403 /// Key to get the variation axis minimum value.
1404 ///
1405 /// This key is used with a variation axis dictionary to get the minimum axis value as a CFNumberRef.
1406 ///
1407 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontvariationaxisminimumvaluekey?language=objc)
1408 pub static kCTFontVariationAxisMinimumValueKey: &'static CFString;
1409}
1410
1411extern "C" {
1412 /// kCTFontVariationAxisMaximumValueKey
1413 ///
1414 /// Key to get the variation axis maximum value.
1415 ///
1416 /// This key is used with a variation axis dictionary to get the maximum axis value as a CFNumberRef.
1417 ///
1418 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontvariationaxismaximumvaluekey?language=objc)
1419 pub static kCTFontVariationAxisMaximumValueKey: &'static CFString;
1420}
1421
1422extern "C" {
1423 /// kCTFontVariationAxisDefaultValueKey
1424 ///
1425 /// Key to get the variation axis default value.
1426 ///
1427 /// This key is used with a variation axis dictionary to get the default axis value as a CFNumberRef.
1428 ///
1429 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontvariationaxisdefaultvaluekey?language=objc)
1430 pub static kCTFontVariationAxisDefaultValueKey: &'static CFString;
1431}
1432
1433extern "C" {
1434 /// kCTFontVariationAxisNameKey
1435 ///
1436 /// Key to get the variation axis name string.
1437 ///
1438 /// This key is used with a variation axis dictionary to get the variation axis name.
1439 ///
1440 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontvariationaxisnamekey?language=objc)
1441 pub static kCTFontVariationAxisNameKey: &'static CFString;
1442}
1443
1444extern "C" {
1445 /// kCTFontVariationAxisHiddenKey
1446 ///
1447 /// Key to get the hidden axis flag.
1448 ///
1449 /// This key contains a CFBoolean value that is true when the font designer recommends the axis not be exposed directly to end users in application interfaces.
1450 ///
1451 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontvariationaxishiddenkey?language=objc)
1452 pub static kCTFontVariationAxisHiddenKey: &'static CFString;
1453}
1454
1455/// Returns an array of variation axis dictionaries.
1456///
1457/// Each variation axis dictionary contains the five kCTFontVariationAxis* keys above, and kCTFontVariationAxisNameKey values will be localized when supported by the font.
1458///
1459///
1460/// Parameter `font`: The font reference.
1461///
1462///
1463/// Returns: An array of variation axis dictionaries or null if the font does not support variations.
1464#[inline]
1465pub unsafe extern "C-unwind" fn CTFontCopyVariationAxes(
1466 font: &CTFont,
1467) -> Option<CFRetained<CFArray>> {
1468 extern "C-unwind" {
1469 fn CTFontCopyVariationAxes(font: &CTFont) -> Option<NonNull<CFArray>>;
1470 }
1471 let ret = unsafe { CTFontCopyVariationAxes(font) };
1472 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1473}
1474
1475/// Returns a variation dictionary.
1476///
1477/// This function describes the current configuration of a variation font: a dictionary of number values with variation identifier number keys. As of macOS 10.12 and iOS 10.0, only non-default values (as determined by the variation axis) are returned.
1478///
1479///
1480/// Parameter `font`: The font reference.
1481///
1482///
1483/// Returns: This function returns a variation dictionary or null if the font does not support variations.
1484///
1485///
1486/// See also: kCTFontVariationAxisIdentifierKey
1487///
1488/// See also: kCTFontVariationAxisDefaultValueKey
1489#[inline]
1490pub unsafe extern "C-unwind" fn CTFontCopyVariation(
1491 font: &CTFont,
1492) -> Option<CFRetained<CFDictionary>> {
1493 extern "C-unwind" {
1494 fn CTFontCopyVariation(font: &CTFont) -> Option<NonNull<CFDictionary>>;
1495 }
1496 let ret = unsafe { CTFontCopyVariation(font) };
1497 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1498}
1499
1500extern "C" {
1501 /// kCTFontOpenTypeFeatureTag
1502 ///
1503 /// Key to get the OpenType feature tag.
1504 ///
1505 /// This key can be used with a font feature dictionary to get the tag as a CFStringRef.
1506 ///
1507 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontopentypefeaturetag?language=objc)
1508 pub static kCTFontOpenTypeFeatureTag: &'static CFString;
1509}
1510
1511extern "C" {
1512 /// kCTFontOpenTypeFeatureValue
1513 ///
1514 /// Key to get the OpenType feature value.
1515 ///
1516 /// This key can be used with a font feature dictionary to get the value as a CFNumberRef.
1517 ///
1518 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontopentypefeaturevalue?language=objc)
1519 pub static kCTFontOpenTypeFeatureValue: &'static CFString;
1520}
1521
1522extern "C" {
1523 /// kCTFontFeatureTypeIdentifierKey
1524 ///
1525 /// Key to get the font feature type value.
1526 ///
1527 /// This key can be used with a font feature dictionary to get the type identifier as a CFNumberRef.
1528 ///
1529 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontfeaturetypeidentifierkey?language=objc)
1530 pub static kCTFontFeatureTypeIdentifierKey: &'static CFString;
1531}
1532
1533extern "C" {
1534 /// kCTFontFeatureTypeNameKey
1535 ///
1536 /// Key to get the font feature name.
1537 ///
1538 /// This key can be used with a font feature dictionary to get the localized type name string as a CFString.
1539 ///
1540 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontfeaturetypenamekey?language=objc)
1541 pub static kCTFontFeatureTypeNameKey: &'static CFString;
1542}
1543
1544extern "C" {
1545 /// kCTFontFeatureTypeExclusiveKey
1546 ///
1547 /// Key to get the font feature exclusive setting.
1548 ///
1549 /// 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.
1550 ///
1551 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontfeaturetypeexclusivekey?language=objc)
1552 pub static kCTFontFeatureTypeExclusiveKey: &'static CFString;
1553}
1554
1555extern "C" {
1556 /// kCTFontFeatureTypeSelectorsKey
1557 ///
1558 /// Key to get the font feature selectors.
1559 ///
1560 /// 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.
1561 ///
1562 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontfeaturetypeselectorskey?language=objc)
1563 pub static kCTFontFeatureTypeSelectorsKey: &'static CFString;
1564}
1565
1566extern "C" {
1567 /// kCTFontFeatureSelectorIdentifierKey
1568 ///
1569 /// Key to get the font feature selector identifier.
1570 ///
1571 /// This key can be used with a selector dictionary corresponding to a feature type to obtain the selector identifier value as a CFNumberRef.
1572 ///
1573 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontfeatureselectoridentifierkey?language=objc)
1574 pub static kCTFontFeatureSelectorIdentifierKey: &'static CFString;
1575}
1576
1577extern "C" {
1578 /// kCTFontFeatureSelectorNameKey
1579 ///
1580 /// Key to get the font feature selector name.
1581 ///
1582 /// This key is used with a selector dictionary to get the localized name string for the selector as a CFStringRef.
1583 ///
1584 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontfeatureselectornamekey?language=objc)
1585 pub static kCTFontFeatureSelectorNameKey: &'static CFString;
1586}
1587
1588extern "C" {
1589 /// kCTFontFeatureSelectorDefaultKey
1590 ///
1591 /// Key to get the font feature selector default setting value.
1592 ///
1593 /// 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.
1594 ///
1595 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontfeatureselectordefaultkey?language=objc)
1596 pub static kCTFontFeatureSelectorDefaultKey: &'static CFString;
1597}
1598
1599extern "C" {
1600 /// kCTFontFeatureSelectorSettingKey
1601 ///
1602 /// Key to get or specify the current feature setting.
1603 ///
1604 /// 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.
1605 ///
1606 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontfeatureselectorsettingkey?language=objc)
1607 pub static kCTFontFeatureSelectorSettingKey: &'static CFString;
1608}
1609
1610extern "C" {
1611 /// kCTFontFeatureSampleTextKey
1612 ///
1613 /// Key to get the font feature sample text.
1614 ///
1615 /// This key can be used with a font feature dictionary to get the localized sample text as a CFStringRef.
1616 ///
1617 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontfeaturesampletextkey?language=objc)
1618 pub static kCTFontFeatureSampleTextKey: &'static CFString;
1619}
1620
1621extern "C" {
1622 /// kCTFontFeatureTooltipTextKey
1623 ///
1624 /// Key to get the font feature tooltip text.
1625 ///
1626 /// This key can be used with a font feature dictionary to get the localized tooltip text as a CFStringRef.
1627 ///
1628 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontfeaturetooltiptextkey?language=objc)
1629 pub static kCTFontFeatureTooltipTextKey: &'static CFString;
1630}
1631
1632/// Returns an array of font features
1633///
1634///
1635/// Parameter `font`: The font reference.
1636///
1637///
1638/// Returns: This function returns an array of font feature dictionaries for the font reference.
1639#[inline]
1640pub unsafe extern "C-unwind" fn CTFontCopyFeatures(font: &CTFont) -> Option<CFRetained<CFArray>> {
1641 extern "C-unwind" {
1642 fn CTFontCopyFeatures(font: &CTFont) -> Option<NonNull<CFArray>>;
1643 }
1644 let ret = unsafe { CTFontCopyFeatures(font) };
1645 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1646}
1647
1648/// Returns an array of font feature setting tuples
1649///
1650///
1651/// 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.
1652///
1653///
1654/// Parameter `font`: The font reference.
1655///
1656///
1657/// Returns: 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.
1658#[inline]
1659pub unsafe extern "C-unwind" fn CTFontCopyFeatureSettings(
1660 font: &CTFont,
1661) -> Option<CFRetained<CFArray>> {
1662 extern "C-unwind" {
1663 fn CTFontCopyFeatureSettings(font: &CTFont) -> Option<NonNull<CFArray>>;
1664 }
1665 let ret = unsafe { CTFontCopyFeatureSettings(font) };
1666 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1667}
1668
1669/// Returns a CGFontRef and attributes.
1670///
1671///
1672/// Parameter `font`: The font reference.
1673///
1674///
1675/// Parameter `attributes`: A pointer to a CTFontDescriptorRef to receive a font descriptor containing additional attributes. Can be NULL. Must be released by caller.
1676///
1677///
1678/// Returns: 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.
1679#[cfg(all(feature = "CTFontDescriptor", feature = "objc2-core-graphics"))]
1680#[inline]
1681pub unsafe extern "C-unwind" fn CTFontCopyGraphicsFont(
1682 font: &CTFont,
1683 attributes: *mut *const CTFontDescriptor,
1684) -> CFRetained<CGFont> {
1685 extern "C-unwind" {
1686 fn CTFontCopyGraphicsFont(
1687 font: &CTFont,
1688 attributes: *mut *const CTFontDescriptor,
1689 ) -> Option<NonNull<CGFont>>;
1690 }
1691 let ret = unsafe { CTFontCopyGraphicsFont(font, attributes) };
1692 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
1693 unsafe { CFRetained::from_raw(ret) }
1694}
1695
1696/// Creates a new font reference from a CGFontRef.
1697///
1698///
1699/// Parameter `graphicsFont`: A valid CGFontRef.
1700///
1701///
1702/// Parameter `size`: The point size for the font reference. If 0.0 is specified, the default font size of 12.0 will be used.
1703///
1704///
1705/// Parameter `matrix`: The transformation matrix for the font. If unspecified, the identity matrix will be used. Optional.
1706///
1707///
1708/// Parameter `attributes`: A CTFontDescriptorRef containing additional attributes that should be matched. Optional.
1709///
1710///
1711/// Returns: This function returns a new font reference for an existing CGFontRef with the specified size, matrix, and additional attributes.
1712#[cfg(all(feature = "CTFontDescriptor", feature = "objc2-core-graphics"))]
1713#[inline]
1714pub unsafe extern "C-unwind" fn CTFontCreateWithGraphicsFont(
1715 graphics_font: &CGFont,
1716 size: CGFloat,
1717 matrix: *const CGAffineTransform,
1718 attributes: Option<&CTFontDescriptor>,
1719) -> CFRetained<CTFont> {
1720 extern "C-unwind" {
1721 fn CTFontCreateWithGraphicsFont(
1722 graphics_font: &CGFont,
1723 size: CGFloat,
1724 matrix: *const CGAffineTransform,
1725 attributes: Option<&CTFontDescriptor>,
1726 ) -> Option<NonNull<CTFont>>;
1727 }
1728 let ret = unsafe { CTFontCreateWithGraphicsFont(graphics_font, size, matrix, attributes) };
1729 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
1730 unsafe { CFRetained::from_raw(ret) }
1731}
1732
1733/// [Apple's documentation](https://developer.apple.com/documentation/coretext/atsfontref?language=objc)
1734pub type ATSFontRef = u32;
1735
1736/// Returns a font reference for the given Quickdraw instance.
1737///
1738///
1739/// This function is provided for compatibility support between Core Text and clients needing to support Quickdraw font references.
1740///
1741///
1742/// Parameter `name`: The Quickdraw font name. If NULL or zero length, an identifier must be specified instead.
1743///
1744///
1745/// Parameter `identifier`: The Quickdraw font identifier. If 0, a name must be specified instead.
1746///
1747///
1748/// Parameter `style`: The Quickdraw font style.
1749///
1750///
1751/// Parameter `size`: The point size for the font reference. If 0.0 is specified, the default size of 12.0 is used.
1752///
1753///
1754/// Returns: This function returns the best font instance matching the Quickdraw instance information.
1755#[deprecated = "Quickdraw font references are deprecated"]
1756#[inline]
1757pub unsafe extern "C-unwind" fn CTFontCreateWithQuickdrawInstance(
1758 name: ConstStr255Param,
1759 identifier: i16,
1760 style: u8,
1761 size: CGFloat,
1762) -> CFRetained<CTFont> {
1763 extern "C-unwind" {
1764 fn CTFontCreateWithQuickdrawInstance(
1765 name: ConstStr255Param,
1766 identifier: i16,
1767 style: u8,
1768 size: CGFloat,
1769 ) -> Option<NonNull<CTFont>>;
1770 }
1771 let ret = unsafe { CTFontCreateWithQuickdrawInstance(name, identifier, style, size) };
1772 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
1773 unsafe { CFRetained::from_raw(ret) }
1774}
1775
1776/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablebase?language=objc)
1777pub const kCTFontTableBASE: c_uint = 0x42415345;
1778/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablecbdt?language=objc)
1779pub const kCTFontTableCBDT: c_uint = 0x43424454;
1780/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablecblc?language=objc)
1781pub const kCTFontTableCBLC: c_uint = 0x43424c43;
1782/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablecff?language=objc)
1783pub const kCTFontTableCFF: c_uint = 0x43464620;
1784/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablecff2?language=objc)
1785pub const kCTFontTableCFF2: c_uint = 0x43464632;
1786/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablecolr?language=objc)
1787pub const kCTFontTableCOLR: c_uint = 0x434f4c52;
1788/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablecpal?language=objc)
1789pub const kCTFontTableCPAL: c_uint = 0x4350414c;
1790/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttabledsig?language=objc)
1791pub const kCTFontTableDSIG: c_uint = 0x44534947;
1792/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttableebdt?language=objc)
1793pub const kCTFontTableEBDT: c_uint = 0x45424454;
1794/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttableeblc?language=objc)
1795pub const kCTFontTableEBLC: c_uint = 0x45424c43;
1796/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttableebsc?language=objc)
1797pub const kCTFontTableEBSC: c_uint = 0x45425343;
1798/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablegdef?language=objc)
1799pub const kCTFontTableGDEF: c_uint = 0x47444546;
1800/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablegpos?language=objc)
1801pub const kCTFontTableGPOS: c_uint = 0x47504f53;
1802/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablegsub?language=objc)
1803pub const kCTFontTableGSUB: c_uint = 0x47535542;
1804/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablehvar?language=objc)
1805pub const kCTFontTableHVAR: c_uint = 0x48564152;
1806/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablejstf?language=objc)
1807pub const kCTFontTableJSTF: c_uint = 0x4a535446;
1808/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttableltsh?language=objc)
1809pub const kCTFontTableLTSH: c_uint = 0x4c545348;
1810/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablemath?language=objc)
1811pub const kCTFontTableMATH: c_uint = 0x4d415448;
1812/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablemerg?language=objc)
1813pub const kCTFontTableMERG: c_uint = 0x4d455247;
1814/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablemvar?language=objc)
1815pub const kCTFontTableMVAR: c_uint = 0x4d564152;
1816/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttableos2?language=objc)
1817pub const kCTFontTableOS2: c_uint = 0x4f532f32;
1818/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablepclt?language=objc)
1819pub const kCTFontTablePCLT: c_uint = 0x50434c54;
1820/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablestat?language=objc)
1821pub const kCTFontTableSTAT: c_uint = 0x53544154;
1822/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablesvg?language=objc)
1823pub const kCTFontTableSVG: c_uint = 0x53564720;
1824/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablevdmx?language=objc)
1825pub const kCTFontTableVDMX: c_uint = 0x56444d58;
1826/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablevorg?language=objc)
1827pub const kCTFontTableVORG: c_uint = 0x564f5247;
1828/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablevvar?language=objc)
1829pub const kCTFontTableVVAR: c_uint = 0x56564152;
1830/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablezapf?language=objc)
1831pub const kCTFontTableZapf: c_uint = 0x5a617066;
1832/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttableacnt?language=objc)
1833pub const kCTFontTableAcnt: c_uint = 0x61636e74;
1834/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttableankr?language=objc)
1835pub const kCTFontTableAnkr: c_uint = 0x616e6b72;
1836/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttableavar?language=objc)
1837pub const kCTFontTableAvar: c_uint = 0x61766172;
1838/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablebdat?language=objc)
1839pub const kCTFontTableBdat: c_uint = 0x62646174;
1840/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablebhed?language=objc)
1841pub const kCTFontTableBhed: c_uint = 0x62686564;
1842/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablebloc?language=objc)
1843pub const kCTFontTableBloc: c_uint = 0x626c6f63;
1844/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablebsln?language=objc)
1845pub const kCTFontTableBsln: c_uint = 0x62736c6e;
1846/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablecidg?language=objc)
1847pub const kCTFontTableCidg: c_uint = 0x63696467;
1848/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablecmap?language=objc)
1849pub const kCTFontTableCmap: c_uint = 0x636d6170;
1850/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablecvar?language=objc)
1851pub const kCTFontTableCvar: c_uint = 0x63766172;
1852/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablecvt?language=objc)
1853pub const kCTFontTableCvt: c_uint = 0x63767420;
1854/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablefdsc?language=objc)
1855pub const kCTFontTableFdsc: c_uint = 0x66647363;
1856/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablefeat?language=objc)
1857pub const kCTFontTableFeat: c_uint = 0x66656174;
1858/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablefmtx?language=objc)
1859pub const kCTFontTableFmtx: c_uint = 0x666d7478;
1860/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablefond?language=objc)
1861pub const kCTFontTableFond: c_uint = 0x666f6e64;
1862/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablefpgm?language=objc)
1863pub const kCTFontTableFpgm: c_uint = 0x6670676d;
1864/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablefvar?language=objc)
1865pub const kCTFontTableFvar: c_uint = 0x66766172;
1866/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablegasp?language=objc)
1867pub const kCTFontTableGasp: c_uint = 0x67617370;
1868/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttableglyf?language=objc)
1869pub const kCTFontTableGlyf: c_uint = 0x676c7966;
1870/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablegvar?language=objc)
1871pub const kCTFontTableGvar: c_uint = 0x67766172;
1872/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablehdmx?language=objc)
1873pub const kCTFontTableHdmx: c_uint = 0x68646d78;
1874/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablehead?language=objc)
1875pub const kCTFontTableHead: c_uint = 0x68656164;
1876/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablehhea?language=objc)
1877pub const kCTFontTableHhea: c_uint = 0x68686561;
1878/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablehmtx?language=objc)
1879pub const kCTFontTableHmtx: c_uint = 0x686d7478;
1880/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablehsty?language=objc)
1881pub const kCTFontTableHsty: c_uint = 0x68737479;
1882/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablejust?language=objc)
1883pub const kCTFontTableJust: c_uint = 0x6a757374;
1884/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablekern?language=objc)
1885pub const kCTFontTableKern: c_uint = 0x6b65726e;
1886/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablekerx?language=objc)
1887pub const kCTFontTableKerx: c_uint = 0x6b657278;
1888/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablelcar?language=objc)
1889pub const kCTFontTableLcar: c_uint = 0x6c636172;
1890/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttableloca?language=objc)
1891pub const kCTFontTableLoca: c_uint = 0x6c6f6361;
1892/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttableltag?language=objc)
1893pub const kCTFontTableLtag: c_uint = 0x6c746167;
1894/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablemaxp?language=objc)
1895pub const kCTFontTableMaxp: c_uint = 0x6d617870;
1896/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablemeta?language=objc)
1897pub const kCTFontTableMeta: c_uint = 0x6d657461;
1898/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablemort?language=objc)
1899pub const kCTFontTableMort: c_uint = 0x6d6f7274;
1900/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablemorx?language=objc)
1901pub const kCTFontTableMorx: c_uint = 0x6d6f7278;
1902/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablename?language=objc)
1903pub const kCTFontTableName: c_uint = 0x6e616d65;
1904/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttableopbd?language=objc)
1905pub const kCTFontTableOpbd: c_uint = 0x6f706264;
1906/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablepost?language=objc)
1907pub const kCTFontTablePost: c_uint = 0x706f7374;
1908/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttableprep?language=objc)
1909pub const kCTFontTablePrep: c_uint = 0x70726570;
1910/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttableprop?language=objc)
1911pub const kCTFontTableProp: c_uint = 0x70726f70;
1912/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablesbit?language=objc)
1913pub const kCTFontTableSbit: c_uint = 0x73626974;
1914/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablesbix?language=objc)
1915pub const kCTFontTableSbix: c_uint = 0x73626978;
1916/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttabletrak?language=objc)
1917pub const kCTFontTableTrak: c_uint = 0x7472616b;
1918/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablevhea?language=objc)
1919pub const kCTFontTableVhea: c_uint = 0x76686561;
1920/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablevmtx?language=objc)
1921pub const kCTFontTableVmtx: c_uint = 0x766d7478;
1922/// [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfonttablexref?language=objc)
1923pub const kCTFontTableXref: c_uint = 0x78726566;
1924
1925/// [Apple's documentation](https://developer.apple.com/documentation/coretext/ctfonttabletag?language=objc)
1926pub type CTFontTableTag = FourCharCode;
1927
1928/// [Apple's documentation](https://developer.apple.com/documentation/coretext/ctfonttableoptions?language=objc)
1929// NS_OPTIONS
1930#[repr(transparent)]
1931#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1932pub struct CTFontTableOptions(pub u32);
1933bitflags::bitflags! {
1934 impl CTFontTableOptions: u32 {
1935 #[doc(alias = "kCTFontTableOptionNoOptions")]
1936 const NoOptions = 0;
1937#[deprecated = "Unsupported"]
1938 #[doc(alias = "kCTFontTableOptionExcludeSynthetic")]
1939 const ExcludeSynthetic = 1<<0;
1940 }
1941}
1942
1943#[cfg(feature = "objc2")]
1944unsafe impl Encode for CTFontTableOptions {
1945 const ENCODING: Encoding = u32::ENCODING;
1946}
1947
1948#[cfg(feature = "objc2")]
1949unsafe impl RefEncode for CTFontTableOptions {
1950 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1951}
1952
1953/// Returns an array of font table tags.
1954///
1955///
1956/// Parameter `font`: The font reference.
1957///
1958///
1959/// Parameter `options`: The options used when copying font tables.
1960///
1961///
1962/// Returns: 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:
1963/// <code>
1964/// CTFontTableTag tag = (CTFontTableTag)(uintptr_t)CFArrayGetValueAtIndex(tags, index);
1965/// </code>
1966#[inline]
1967pub unsafe extern "C-unwind" fn CTFontCopyAvailableTables(
1968 font: &CTFont,
1969 options: CTFontTableOptions,
1970) -> Option<CFRetained<CFArray>> {
1971 extern "C-unwind" {
1972 fn CTFontCopyAvailableTables(
1973 font: &CTFont,
1974 options: CTFontTableOptions,
1975 ) -> Option<NonNull<CFArray>>;
1976 }
1977 let ret = unsafe { CTFontCopyAvailableTables(font, options) };
1978 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1979}
1980
1981extern "C-unwind" {
1982 /// Determine whether a table is present in a font.
1983 ///
1984 /// This is a convenience function to avoid requesting an array of table tags or any table data. It behaves according as if using `kCTFontTableOptionNoOptions`.
1985 ///
1986 ///
1987 /// Parameter `font`: The font reference.
1988 ///
1989 ///
1990 /// Parameter `tag`: The font table identifier as a CTFontTableTag.
1991 ///
1992 ///
1993 /// Returns: Returns true if the call was successful and the requested table is present.
1994 pub fn CTFontHasTable(font: &CTFont, tag: CTFontTableTag) -> bool;
1995}
1996
1997/// Returns a reference to the font table data.
1998///
1999///
2000/// Parameter `font`: The font reference.
2001///
2002///
2003/// Parameter `table`: The font table identifier as a CTFontTableTag.
2004///
2005///
2006/// Parameter `options`: The options used when copying font table.
2007///
2008///
2009/// Returns: This function returns a retained reference to the font table data as CFDataRef or NULL if the table is not present.
2010#[inline]
2011pub unsafe extern "C-unwind" fn CTFontCopyTable(
2012 font: &CTFont,
2013 table: CTFontTableTag,
2014 options: CTFontTableOptions,
2015) -> Option<CFRetained<CFData>> {
2016 extern "C-unwind" {
2017 fn CTFontCopyTable(
2018 font: &CTFont,
2019 table: CTFontTableTag,
2020 options: CTFontTableOptions,
2021 ) -> Option<NonNull<CFData>>;
2022 }
2023 let ret = unsafe { CTFontCopyTable(font, table, options) };
2024 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2025}
2026
2027extern "C-unwind" {
2028 /// Renders the given glyphs from the CTFont at the given positions in the CGContext.
2029 ///
2030 /// This function will modify the CGContext's font, text size, and text matrix if specified in the CTFont. These attributes will not be restored.
2031 /// 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.
2032 ///
2033 ///
2034 /// Parameter `font`: The font to render glyphs from. If the font has a size or matrix attribute, the CGContext will be set with these values.
2035 ///
2036 ///
2037 /// Parameter `glyphs`: The glyphs to be rendered. See above discussion of how the glyphs should be derived.
2038 ///
2039 ///
2040 /// Parameter `positions`: 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.
2041 ///
2042 ///
2043 /// Parameter `count`: The number of glyphs to be rendered from the glyphs array.
2044 ///
2045 ///
2046 /// Parameter `context`: CGContext used to render the glyphs.
2047 #[cfg(feature = "objc2-core-graphics")]
2048 pub fn CTFontDrawGlyphs(
2049 font: &CTFont,
2050 glyphs: NonNull<CGGlyph>,
2051 positions: NonNull<CGPoint>,
2052 count: usize,
2053 context: &CGContext,
2054 );
2055}
2056
2057extern "C-unwind" {
2058 /// Returns caret positions within a glyph.
2059 ///
2060 /// This function is used to obtain caret positions for a specific glyph.
2061 /// The return value is the max number of positions possible, and the function
2062 /// will populate the caller's positions buffer with available positions if possible.
2063 /// This function may not be able to produce positions if the font does not
2064 /// have the appropriate data, in which case it will return 0.
2065 ///
2066 ///
2067 /// Parameter `font`: The font reference.
2068 ///
2069 ///
2070 /// Parameter `glyph`: The glyph.
2071 ///
2072 ///
2073 /// Parameter `positions`: A buffer of at least maxPositions to receive the ligature caret positions for
2074 /// the glyph.
2075 ///
2076 ///
2077 /// Parameter `maxPositions`: The maximum number of positions to return.
2078 ///
2079 ///
2080 /// Returns: Returns the number of caret positions for the specified glyph.
2081 #[cfg(feature = "objc2-core-graphics")]
2082 pub fn CTFontGetLigatureCaretPositions(
2083 font: &CTFont,
2084 glyph: CGGlyph,
2085 positions: *mut CGFloat,
2086 max_positions: CFIndex,
2087 ) -> CFIndex;
2088}
2089
2090extern "C" {
2091 /// kCTBaselineClassRoman
2092 ///
2093 ///
2094 /// Key to reference the Roman baseline class.
2095 ///
2096 ///
2097 /// 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.
2098 ///
2099 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctbaselineclassroman?language=objc)
2100 pub static kCTBaselineClassRoman: &'static CFString;
2101}
2102
2103extern "C" {
2104 /// kCTBaselineClassIdeographicCentered
2105 ///
2106 ///
2107 /// Key to reference the Ideographic Centered baseline class.
2108 ///
2109 ///
2110 /// 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.
2111 ///
2112 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctbaselineclassideographiccentered?language=objc)
2113 pub static kCTBaselineClassIdeographicCentered: &'static CFString;
2114}
2115
2116extern "C" {
2117 /// kCTBaselineClassIdeographicLow
2118 ///
2119 ///
2120 /// Key to reference the Ideographic Low baseline class.
2121 ///
2122 ///
2123 /// 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.
2124 ///
2125 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctbaselineclassideographiclow?language=objc)
2126 pub static kCTBaselineClassIdeographicLow: &'static CFString;
2127}
2128
2129extern "C" {
2130 /// kCTBaselineClassIdeographicHigh
2131 ///
2132 ///
2133 /// Key to reference the Ideographic High baseline class.
2134 ///
2135 ///
2136 /// 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.
2137 ///
2138 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctbaselineclassideographichigh?language=objc)
2139 pub static kCTBaselineClassIdeographicHigh: &'static CFString;
2140}
2141
2142extern "C" {
2143 /// kCTBaselineClassHanging
2144 ///
2145 ///
2146 /// Key to reference the Hanging baseline class.
2147 ///
2148 ///
2149 /// 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.
2150 ///
2151 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctbaselineclasshanging?language=objc)
2152 pub static kCTBaselineClassHanging: &'static CFString;
2153}
2154
2155extern "C" {
2156 /// kCTBaselineClassMath
2157 ///
2158 ///
2159 /// Key to reference the Math baseline class.
2160 ///
2161 ///
2162 /// 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.
2163 ///
2164 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctbaselineclassmath?language=objc)
2165 pub static kCTBaselineClassMath: &'static CFString;
2166}
2167
2168extern "C" {
2169 /// kCTBaselineReferenceFont
2170 ///
2171 ///
2172 /// Key to reference a font for the reference baseline.
2173 ///
2174 ///
2175 /// This key can be used to specify a font for the reference baseline. The value is a CTFontRef or the kCTBaselineOriginalFont constant.
2176 ///
2177 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctbaselinereferencefont?language=objc)
2178 pub static kCTBaselineReferenceFont: &'static CFString;
2179}
2180
2181extern "C" {
2182 /// kCTBaselineOriginalFont
2183 ///
2184 ///
2185 /// Use the original font for setting the reference baseline.
2186 ///
2187 ///
2188 /// This constant can be used as the value for kCTBaselineReferenceFont to specify that the original font should be used for the reference baseline.
2189 ///
2190 /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctbaselineoriginalfont?language=objc)
2191 pub static kCTBaselineOriginalFont: &'static CFString;
2192}
2193
2194extern "C-unwind" {
2195 #[cfg(all(feature = "CTRunDelegate", feature = "objc2"))]
2196 pub fn CTFontGetTypographicBoundsForAdaptiveImageProvider(
2197 font: &CTFont,
2198 provider: Option<&ProtocolObject<dyn CTAdaptiveImageProviding>>,
2199 ) -> CGRect;
2200}
2201
2202extern "C-unwind" {
2203 #[cfg(all(
2204 feature = "CTRunDelegate",
2205 feature = "objc2",
2206 feature = "objc2-core-graphics"
2207 ))]
2208 pub fn CTFontDrawImageFromAdaptiveImageProviderAtPoint(
2209 font: &CTFont,
2210 provider: &ProtocolObject<dyn CTAdaptiveImageProviding>,
2211 point: CGPoint,
2212 context: &CGContext,
2213 );
2214}