1use 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#[repr(C)]
17pub struct CTFont {
18 inner: [u8; 0],
19 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
20}
21
22cf_type!(
23 unsafe impl CTFont {}
24);
25#[cfg(feature = "objc2")]
26cf_objc2_type!(
27 unsafe impl RefEncode<"__CTFont"> for CTFont {}
28);
29
30unsafe impl ConcreteType for CTFont {
31 #[doc(alias = "CTFontGetTypeID")]
35 #[inline]
36 fn type_id() -> CFTypeID {
37 extern "C-unwind" {
38 fn CTFontGetTypeID() -> CFTypeID;
39 }
40 unsafe { CTFontGetTypeID() }
41 }
42}
43
44extern "C" {
45 pub static kCTFontCopyrightNameKey: &'static CFString;
51}
52
53extern "C" {
54 pub static kCTFontFamilyNameKey: &'static CFString;
60}
61
62extern "C" {
63 pub static kCTFontSubFamilyNameKey: &'static CFString;
69}
70
71extern "C" {
72 pub static kCTFontStyleNameKey: &'static CFString;
78}
79
80extern "C" {
81 pub static kCTFontUniqueNameKey: &'static CFString;
90}
91
92extern "C" {
93 pub static kCTFontFullNameKey: &'static CFString;
99}
100
101extern "C" {
102 pub static kCTFontVersionNameKey: &'static CFString;
108}
109
110extern "C" {
111 pub static kCTFontPostScriptNameKey: &'static CFString;
117}
118
119extern "C" {
120 pub static kCTFontTrademarkNameKey: &'static CFString;
126}
127
128extern "C" {
129 pub static kCTFontManufacturerNameKey: &'static CFString;
135}
136
137extern "C" {
138 pub static kCTFontDesignerNameKey: &'static CFString;
144}
145
146extern "C" {
147 pub static kCTFontDescriptionNameKey: &'static CFString;
153}
154
155extern "C" {
156 pub static kCTFontVendorURLNameKey: &'static CFString;
162}
163
164extern "C" {
165 pub static kCTFontDesignerURLNameKey: &'static CFString;
171}
172
173extern "C" {
174 pub static kCTFontLicenseNameKey: &'static CFString;
180}
181
182extern "C" {
183 pub static kCTFontLicenseURLNameKey: &'static CFString;
189}
190
191extern "C" {
192 pub static kCTFontSampleTextNameKey: &'static CFString;
198}
199
200extern "C" {
201 pub static kCTFontPostScriptCIDNameKey: &'static CFString;
207}
208
209impl CTFont {
210 #[doc(alias = "CTFontCreateWithName")]
227 #[inline]
228 pub unsafe fn with_name(
229 name: &CFString,
230 size: CGFloat,
231 matrix: *const CGAffineTransform,
232 ) -> CFRetained<CTFont> {
233 extern "C-unwind" {
234 fn CTFontCreateWithName(
235 name: &CFString,
236 size: CGFloat,
237 matrix: *const CGAffineTransform,
238 ) -> Option<NonNull<CTFont>>;
239 }
240 let ret = unsafe { CTFontCreateWithName(name, size, matrix) };
241 let ret =
242 ret.expect("function was marked as returning non-null, but actually returned NULL");
243 unsafe { CFRetained::from_raw(ret) }
244 }
245
246 #[doc(alias = "CTFontCreateWithFontDescriptor")]
260 #[cfg(feature = "CTFontDescriptor")]
261 #[inline]
262 pub unsafe fn with_font_descriptor(
263 descriptor: &CTFontDescriptor,
264 size: CGFloat,
265 matrix: *const CGAffineTransform,
266 ) -> CFRetained<CTFont> {
267 extern "C-unwind" {
268 fn CTFontCreateWithFontDescriptor(
269 descriptor: &CTFontDescriptor,
270 size: CGFloat,
271 matrix: *const CGAffineTransform,
272 ) -> Option<NonNull<CTFont>>;
273 }
274 let ret = unsafe { CTFontCreateWithFontDescriptor(descriptor, size, matrix) };
275 let ret =
276 ret.expect("function was marked as returning non-null, but actually returned NULL");
277 unsafe { CFRetained::from_raw(ret) }
278 }
279}
280
281#[repr(transparent)]
293#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
294pub struct CTFontOptions(pub CFOptionFlags);
295bitflags::bitflags! {
296 impl CTFontOptions: CFOptionFlags {
297 #[doc(alias = "kCTFontOptionsDefault")]
298 const Default = 0;
299 #[doc(alias = "kCTFontOptionsPreventAutoActivation")]
300 const PreventAutoActivation = 1<<0;
301 #[doc(alias = "kCTFontOptionsPreventAutoDownload")]
302 const PreventAutoDownload = 1<<1;
303 #[doc(alias = "kCTFontOptionsPreferSystemFont")]
304 const PreferSystemFont = 1<<2;
305 }
306}
307
308#[cfg(feature = "objc2")]
309unsafe impl Encode for CTFontOptions {
310 const ENCODING: Encoding = CFOptionFlags::ENCODING;
311}
312
313#[cfg(feature = "objc2")]
314unsafe impl RefEncode for CTFontOptions {
315 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
316}
317
318impl CTFont {
319 #[doc(alias = "CTFontCreateWithNameAndOptions")]
339 #[inline]
340 pub unsafe fn with_name_and_options(
341 name: &CFString,
342 size: CGFloat,
343 matrix: *const CGAffineTransform,
344 options: CTFontOptions,
345 ) -> CFRetained<CTFont> {
346 extern "C-unwind" {
347 fn CTFontCreateWithNameAndOptions(
348 name: &CFString,
349 size: CGFloat,
350 matrix: *const CGAffineTransform,
351 options: CTFontOptions,
352 ) -> Option<NonNull<CTFont>>;
353 }
354 let ret = unsafe { CTFontCreateWithNameAndOptions(name, size, matrix, options) };
355 let ret =
356 ret.expect("function was marked as returning non-null, but actually returned NULL");
357 unsafe { CFRetained::from_raw(ret) }
358 }
359
360 #[doc(alias = "CTFontCreateWithFontDescriptorAndOptions")]
377 #[cfg(feature = "CTFontDescriptor")]
378 #[inline]
379 pub unsafe fn with_font_descriptor_and_options(
380 descriptor: &CTFontDescriptor,
381 size: CGFloat,
382 matrix: *const CGAffineTransform,
383 options: CTFontOptions,
384 ) -> CFRetained<CTFont> {
385 extern "C-unwind" {
386 fn CTFontCreateWithFontDescriptorAndOptions(
387 descriptor: &CTFontDescriptor,
388 size: CGFloat,
389 matrix: *const CGAffineTransform,
390 options: CTFontOptions,
391 ) -> Option<NonNull<CTFont>>;
392 }
393 let ret =
394 unsafe { CTFontCreateWithFontDescriptorAndOptions(descriptor, size, matrix, options) };
395 let ret =
396 ret.expect("function was marked as returning non-null, but actually returned NULL");
397 unsafe { CFRetained::from_raw(ret) }
398 }
399}
400
401#[repr(transparent)]
408#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
409pub struct CTFontUIFontType(pub u32);
410impl CTFontUIFontType {
411 #[doc(alias = "kCTFontUIFontNone")]
412 pub const None: Self = Self(4294967295);
413 #[doc(alias = "kCTFontUIFontUser")]
414 pub const User: Self = Self(0);
415 #[doc(alias = "kCTFontUIFontUserFixedPitch")]
416 pub const UserFixedPitch: Self = Self(1);
417 #[doc(alias = "kCTFontUIFontSystem")]
418 pub const System: Self = Self(2);
419 #[doc(alias = "kCTFontUIFontEmphasizedSystem")]
420 pub const EmphasizedSystem: Self = Self(3);
421 #[doc(alias = "kCTFontUIFontSmallSystem")]
422 pub const SmallSystem: Self = Self(4);
423 #[doc(alias = "kCTFontUIFontSmallEmphasizedSystem")]
424 pub const SmallEmphasizedSystem: Self = Self(5);
425 #[doc(alias = "kCTFontUIFontMiniSystem")]
426 pub const MiniSystem: Self = Self(6);
427 #[doc(alias = "kCTFontUIFontMiniEmphasizedSystem")]
428 pub const MiniEmphasizedSystem: Self = Self(7);
429 #[doc(alias = "kCTFontUIFontViews")]
430 pub const Views: Self = Self(8);
431 #[doc(alias = "kCTFontUIFontApplication")]
432 pub const Application: Self = Self(9);
433 #[doc(alias = "kCTFontUIFontLabel")]
434 pub const Label: Self = Self(10);
435 #[doc(alias = "kCTFontUIFontMenuTitle")]
436 pub const MenuTitle: Self = Self(11);
437 #[doc(alias = "kCTFontUIFontMenuItem")]
438 pub const MenuItem: Self = Self(12);
439 #[doc(alias = "kCTFontUIFontMenuItemMark")]
440 pub const MenuItemMark: Self = Self(13);
441 #[doc(alias = "kCTFontUIFontMenuItemCmdKey")]
442 pub const MenuItemCmdKey: Self = Self(14);
443 #[doc(alias = "kCTFontUIFontWindowTitle")]
444 pub const WindowTitle: Self = Self(15);
445 #[doc(alias = "kCTFontUIFontPushButton")]
446 pub const PushButton: Self = Self(16);
447 #[doc(alias = "kCTFontUIFontUtilityWindowTitle")]
448 pub const UtilityWindowTitle: Self = Self(17);
449 #[doc(alias = "kCTFontUIFontAlertHeader")]
450 pub const AlertHeader: Self = Self(18);
451 #[doc(alias = "kCTFontUIFontSystemDetail")]
452 pub const SystemDetail: Self = Self(19);
453 #[doc(alias = "kCTFontUIFontEmphasizedSystemDetail")]
454 pub const EmphasizedSystemDetail: Self = Self(20);
455 #[doc(alias = "kCTFontUIFontToolbar")]
456 pub const Toolbar: Self = Self(21);
457 #[doc(alias = "kCTFontUIFontSmallToolbar")]
458 pub const SmallToolbar: Self = Self(22);
459 #[doc(alias = "kCTFontUIFontMessage")]
460 pub const Message: Self = Self(23);
461 #[doc(alias = "kCTFontUIFontPalette")]
462 pub const Palette: Self = Self(24);
463 #[doc(alias = "kCTFontUIFontToolTip")]
464 pub const ToolTip: Self = Self(25);
465 #[doc(alias = "kCTFontUIFontControlContent")]
466 pub const ControlContent: Self = Self(26);
467 #[deprecated = "Deprecated"]
468 pub const kCTFontNoFontType: Self = Self(CTFontUIFontType::None.0);
469 #[deprecated = "Deprecated"]
470 pub const kCTFontUserFontType: Self = Self(CTFontUIFontType::User.0);
471 #[deprecated = "Deprecated"]
472 pub const kCTFontUserFixedPitchFontType: Self = Self(CTFontUIFontType::UserFixedPitch.0);
473 #[deprecated = "Deprecated"]
474 pub const kCTFontSystemFontType: Self = Self(CTFontUIFontType::System.0);
475 #[deprecated = "Deprecated"]
476 pub const kCTFontEmphasizedSystemFontType: Self = Self(CTFontUIFontType::EmphasizedSystem.0);
477 #[deprecated = "Deprecated"]
478 pub const kCTFontSmallSystemFontType: Self = Self(CTFontUIFontType::SmallSystem.0);
479 #[deprecated = "Deprecated"]
480 pub const kCTFontSmallEmphasizedSystemFontType: Self =
481 Self(CTFontUIFontType::SmallEmphasizedSystem.0);
482 #[deprecated = "Deprecated"]
483 pub const kCTFontMiniSystemFontType: Self = Self(CTFontUIFontType::MiniSystem.0);
484 #[deprecated = "Deprecated"]
485 pub const kCTFontMiniEmphasizedSystemFontType: Self =
486 Self(CTFontUIFontType::MiniEmphasizedSystem.0);
487 #[deprecated = "Deprecated"]
488 pub const kCTFontViewsFontType: Self = Self(CTFontUIFontType::Views.0);
489 #[deprecated = "Deprecated"]
490 pub const kCTFontApplicationFontType: Self = Self(CTFontUIFontType::Application.0);
491 #[deprecated = "Deprecated"]
492 pub const kCTFontLabelFontType: Self = Self(CTFontUIFontType::Label.0);
493 #[deprecated = "Deprecated"]
494 pub const kCTFontMenuTitleFontType: Self = Self(CTFontUIFontType::MenuTitle.0);
495 #[deprecated = "Deprecated"]
496 pub const kCTFontMenuItemFontType: Self = Self(CTFontUIFontType::MenuItem.0);
497 #[deprecated = "Deprecated"]
498 pub const kCTFontMenuItemMarkFontType: Self = Self(CTFontUIFontType::MenuItemMark.0);
499 #[deprecated = "Deprecated"]
500 pub const kCTFontMenuItemCmdKeyFontType: Self = Self(CTFontUIFontType::MenuItemCmdKey.0);
501 #[deprecated = "Deprecated"]
502 pub const kCTFontWindowTitleFontType: Self = Self(CTFontUIFontType::WindowTitle.0);
503 #[deprecated = "Deprecated"]
504 pub const kCTFontPushButtonFontType: Self = Self(CTFontUIFontType::PushButton.0);
505 #[deprecated = "Deprecated"]
506 pub const kCTFontUtilityWindowTitleFontType: Self =
507 Self(CTFontUIFontType::UtilityWindowTitle.0);
508 #[deprecated = "Deprecated"]
509 pub const kCTFontAlertHeaderFontType: Self = Self(CTFontUIFontType::AlertHeader.0);
510 #[deprecated = "Deprecated"]
511 pub const kCTFontSystemDetailFontType: Self = Self(CTFontUIFontType::SystemDetail.0);
512 #[deprecated = "Deprecated"]
513 pub const kCTFontEmphasizedSystemDetailFontType: Self =
514 Self(CTFontUIFontType::EmphasizedSystemDetail.0);
515 #[deprecated = "Deprecated"]
516 pub const kCTFontToolbarFontType: Self = Self(CTFontUIFontType::Toolbar.0);
517 #[deprecated = "Deprecated"]
518 pub const kCTFontSmallToolbarFontType: Self = Self(CTFontUIFontType::SmallToolbar.0);
519 #[deprecated = "Deprecated"]
520 pub const kCTFontMessageFontType: Self = Self(CTFontUIFontType::Message.0);
521 #[deprecated = "Deprecated"]
522 pub const kCTFontPaletteFontType: Self = Self(CTFontUIFontType::Palette.0);
523 #[deprecated = "Deprecated"]
524 pub const kCTFontToolTipFontType: Self = Self(CTFontUIFontType::ToolTip.0);
525 #[deprecated = "Deprecated"]
526 pub const kCTFontControlContentFontType: Self = Self(CTFontUIFontType::ControlContent.0);
527}
528
529#[cfg(feature = "objc2")]
530unsafe impl Encode for CTFontUIFontType {
531 const ENCODING: Encoding = u32::ENCODING;
532}
533
534#[cfg(feature = "objc2")]
535unsafe impl RefEncode for CTFontUIFontType {
536 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
537}
538
539impl CTFont {
540 #[doc(alias = "CTFontCreateUIFontForLanguage")]
554 #[inline]
555 pub unsafe fn new_ui_font_for_language(
556 ui_type: CTFontUIFontType,
557 size: CGFloat,
558 language: Option<&CFString>,
559 ) -> Option<CFRetained<CTFont>> {
560 extern "C-unwind" {
561 fn CTFontCreateUIFontForLanguage(
562 ui_type: CTFontUIFontType,
563 size: CGFloat,
564 language: Option<&CFString>,
565 ) -> Option<NonNull<CTFont>>;
566 }
567 let ret = unsafe { CTFontCreateUIFontForLanguage(ui_type, size, language) };
568 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
569 }
570
571 #[doc(alias = "CTFontCreateCopyWithAttributes")]
591 #[cfg(feature = "CTFontDescriptor")]
592 #[inline]
593 pub unsafe fn copy_with_attributes(
594 self: &CTFont,
595 size: CGFloat,
596 matrix: *const CGAffineTransform,
597 attributes: Option<&CTFontDescriptor>,
598 ) -> CFRetained<CTFont> {
599 extern "C-unwind" {
600 fn CTFontCreateCopyWithAttributes(
601 font: &CTFont,
602 size: CGFloat,
603 matrix: *const CGAffineTransform,
604 attributes: Option<&CTFontDescriptor>,
605 ) -> Option<NonNull<CTFont>>;
606 }
607 let ret = unsafe { CTFontCreateCopyWithAttributes(self, size, matrix, attributes) };
608 let ret =
609 ret.expect("function was marked as returning non-null, but actually returned NULL");
610 unsafe { CFRetained::from_raw(ret) }
611 }
612
613 #[doc(alias = "CTFontCreateCopyWithSymbolicTraits")]
633 #[cfg(feature = "CTFontTraits")]
634 #[inline]
635 pub unsafe fn copy_with_symbolic_traits(
636 self: &CTFont,
637 size: CGFloat,
638 matrix: *const CGAffineTransform,
639 sym_trait_value: CTFontSymbolicTraits,
640 sym_trait_mask: CTFontSymbolicTraits,
641 ) -> Option<CFRetained<CTFont>> {
642 extern "C-unwind" {
643 fn CTFontCreateCopyWithSymbolicTraits(
644 font: &CTFont,
645 size: CGFloat,
646 matrix: *const CGAffineTransform,
647 sym_trait_value: CTFontSymbolicTraits,
648 sym_trait_mask: CTFontSymbolicTraits,
649 ) -> Option<NonNull<CTFont>>;
650 }
651 let ret = unsafe {
652 CTFontCreateCopyWithSymbolicTraits(self, size, matrix, sym_trait_value, sym_trait_mask)
653 };
654 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
655 }
656
657 #[doc(alias = "CTFontCreateCopyWithFamily")]
674 #[inline]
675 pub unsafe fn copy_with_family(
676 self: &CTFont,
677 size: CGFloat,
678 matrix: *const CGAffineTransform,
679 family: &CFString,
680 ) -> Option<CFRetained<CTFont>> {
681 extern "C-unwind" {
682 fn CTFontCreateCopyWithFamily(
683 font: &CTFont,
684 size: CGFloat,
685 matrix: *const CGAffineTransform,
686 family: &CFString,
687 ) -> Option<NonNull<CTFont>>;
688 }
689 let ret = unsafe { CTFontCreateCopyWithFamily(self, size, matrix, family) };
690 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
691 }
692
693 #[doc(alias = "CTFontCreateForString")]
717 #[inline]
718 pub unsafe fn for_string(
719 self: &CTFont,
720 string: &CFString,
721 range: CFRange,
722 ) -> CFRetained<CTFont> {
723 extern "C-unwind" {
724 fn CTFontCreateForString(
725 current_font: &CTFont,
726 string: &CFString,
727 range: CFRange,
728 ) -> Option<NonNull<CTFont>>;
729 }
730 let ret = unsafe { CTFontCreateForString(self, string, range) };
731 let ret =
732 ret.expect("function was marked as returning non-null, but actually returned NULL");
733 unsafe { CFRetained::from_raw(ret) }
734 }
735
736 #[doc(alias = "CTFontCreateForStringWithLanguage")]
763 #[inline]
764 pub unsafe fn for_string_with_language(
765 self: &CTFont,
766 string: &CFString,
767 range: CFRange,
768 language: Option<&CFString>,
769 ) -> CFRetained<CTFont> {
770 extern "C-unwind" {
771 fn CTFontCreateForStringWithLanguage(
772 current_font: &CTFont,
773 string: &CFString,
774 range: CFRange,
775 language: Option<&CFString>,
776 ) -> Option<NonNull<CTFont>>;
777 }
778 let ret = unsafe { CTFontCreateForStringWithLanguage(self, string, range, language) };
779 let ret =
780 ret.expect("function was marked as returning non-null, but actually returned NULL");
781 unsafe { CFRetained::from_raw(ret) }
782 }
783
784 #[doc(alias = "CTFontCopyFontDescriptor")]
792 #[cfg(feature = "CTFontDescriptor")]
793 #[inline]
794 pub unsafe fn font_descriptor(self: &CTFont) -> CFRetained<CTFontDescriptor> {
795 extern "C-unwind" {
796 fn CTFontCopyFontDescriptor(font: &CTFont) -> Option<NonNull<CTFontDescriptor>>;
797 }
798 let ret = unsafe { CTFontCopyFontDescriptor(self) };
799 let ret =
800 ret.expect("function was marked as returning non-null, but actually returned NULL");
801 unsafe { CFRetained::from_raw(ret) }
802 }
803
804 #[doc(alias = "CTFontCopyAttribute")]
815 #[inline]
816 pub unsafe fn attribute(self: &CTFont, attribute: &CFString) -> Option<CFRetained<CFType>> {
817 extern "C-unwind" {
818 fn CTFontCopyAttribute(font: &CTFont, attribute: &CFString) -> Option<NonNull<CFType>>;
819 }
820 let ret = unsafe { CTFontCopyAttribute(self, attribute) };
821 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
822 }
823
824 #[doc(alias = "CTFontGetSize")]
832 #[inline]
833 pub unsafe fn size(self: &CTFont) -> CGFloat {
834 extern "C-unwind" {
835 fn CTFontGetSize(font: &CTFont) -> CGFloat;
836 }
837 unsafe { CTFontGetSize(self) }
838 }
839
840 #[doc(alias = "CTFontGetMatrix")]
848 #[inline]
849 pub unsafe fn matrix(self: &CTFont) -> CGAffineTransform {
850 extern "C-unwind" {
851 fn CTFontGetMatrix(font: &CTFont) -> CGAffineTransform;
852 }
853 unsafe { CTFontGetMatrix(self) }
854 }
855
856 #[doc(alias = "CTFontGetSymbolicTraits")]
864 #[cfg(feature = "CTFontTraits")]
865 #[inline]
866 pub unsafe fn symbolic_traits(self: &CTFont) -> CTFontSymbolicTraits {
867 extern "C-unwind" {
868 fn CTFontGetSymbolicTraits(font: &CTFont) -> CTFontSymbolicTraits;
869 }
870 unsafe { CTFontGetSymbolicTraits(self) }
871 }
872
873 #[doc(alias = "CTFontCopyTraits")]
881 #[inline]
882 pub unsafe fn traits(self: &CTFont) -> CFRetained<CFDictionary> {
883 extern "C-unwind" {
884 fn CTFontCopyTraits(font: &CTFont) -> Option<NonNull<CFDictionary>>;
885 }
886 let ret = unsafe { CTFontCopyTraits(self) };
887 let ret =
888 ret.expect("function was marked as returning non-null, but actually returned NULL");
889 unsafe { CFRetained::from_raw(ret) }
890 }
891
892 #[doc(alias = "CTFontCopyDefaultCascadeListForLanguages")]
903 #[inline]
904 pub unsafe fn default_cascade_list_for_languages(
905 self: &CTFont,
906 language_pref_list: Option<&CFArray>,
907 ) -> Option<CFRetained<CFArray>> {
908 extern "C-unwind" {
909 fn CTFontCopyDefaultCascadeListForLanguages(
910 font: &CTFont,
911 language_pref_list: Option<&CFArray>,
912 ) -> Option<NonNull<CFArray>>;
913 }
914 let ret = unsafe { CTFontCopyDefaultCascadeListForLanguages(self, language_pref_list) };
915 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
916 }
917
918 #[doc(alias = "CTFontCopyPostScriptName")]
926 #[inline]
927 pub unsafe fn post_script_name(self: &CTFont) -> CFRetained<CFString> {
928 extern "C-unwind" {
929 fn CTFontCopyPostScriptName(font: &CTFont) -> Option<NonNull<CFString>>;
930 }
931 let ret = unsafe { CTFontCopyPostScriptName(self) };
932 let ret =
933 ret.expect("function was marked as returning non-null, but actually returned NULL");
934 unsafe { CFRetained::from_raw(ret) }
935 }
936
937 #[doc(alias = "CTFontCopyFamilyName")]
945 #[inline]
946 pub unsafe fn family_name(self: &CTFont) -> CFRetained<CFString> {
947 extern "C-unwind" {
948 fn CTFontCopyFamilyName(font: &CTFont) -> Option<NonNull<CFString>>;
949 }
950 let ret = unsafe { CTFontCopyFamilyName(self) };
951 let ret =
952 ret.expect("function was marked as returning non-null, but actually returned NULL");
953 unsafe { CFRetained::from_raw(ret) }
954 }
955
956 #[doc(alias = "CTFontCopyFullName")]
964 #[inline]
965 pub unsafe fn full_name(self: &CTFont) -> CFRetained<CFString> {
966 extern "C-unwind" {
967 fn CTFontCopyFullName(font: &CTFont) -> Option<NonNull<CFString>>;
968 }
969 let ret = unsafe { CTFontCopyFullName(self) };
970 let ret =
971 ret.expect("function was marked as returning non-null, but actually returned NULL");
972 unsafe { CFRetained::from_raw(ret) }
973 }
974
975 #[doc(alias = "CTFontCopyDisplayName")]
983 #[inline]
984 pub unsafe fn display_name(self: &CTFont) -> CFRetained<CFString> {
985 extern "C-unwind" {
986 fn CTFontCopyDisplayName(font: &CTFont) -> Option<NonNull<CFString>>;
987 }
988 let ret = unsafe { CTFontCopyDisplayName(self) };
989 let ret =
990 ret.expect("function was marked as returning non-null, but actually returned NULL");
991 unsafe { CFRetained::from_raw(ret) }
992 }
993
994 #[doc(alias = "CTFontCopyName")]
1005 #[inline]
1006 pub unsafe fn name(self: &CTFont, name_key: &CFString) -> Option<CFRetained<CFString>> {
1007 extern "C-unwind" {
1008 fn CTFontCopyName(font: &CTFont, name_key: &CFString) -> Option<NonNull<CFString>>;
1009 }
1010 let ret = unsafe { CTFontCopyName(self, name_key) };
1011 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1012 }
1013
1014 #[doc(alias = "CTFontCopyLocalizedName")]
1029 #[inline]
1030 pub unsafe fn localized_name(
1031 self: &CTFont,
1032 name_key: &CFString,
1033 actual_language: *mut *const CFString,
1034 ) -> Option<CFRetained<CFString>> {
1035 extern "C-unwind" {
1036 fn CTFontCopyLocalizedName(
1037 font: &CTFont,
1038 name_key: &CFString,
1039 actual_language: *mut *const CFString,
1040 ) -> Option<NonNull<CFString>>;
1041 }
1042 let ret = unsafe { CTFontCopyLocalizedName(self, name_key, actual_language) };
1043 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1044 }
1045
1046 #[doc(alias = "CTFontCopyCharacterSet")]
1054 #[inline]
1055 pub unsafe fn character_set(self: &CTFont) -> CFRetained<CFCharacterSet> {
1056 extern "C-unwind" {
1057 fn CTFontCopyCharacterSet(font: &CTFont) -> Option<NonNull<CFCharacterSet>>;
1058 }
1059 let ret = unsafe { CTFontCopyCharacterSet(self) };
1060 let ret =
1061 ret.expect("function was marked as returning non-null, but actually returned NULL");
1062 unsafe { CFRetained::from_raw(ret) }
1063 }
1064
1065 #[doc(alias = "CTFontGetStringEncoding")]
1073 #[inline]
1074 pub unsafe fn string_encoding(self: &CTFont) -> CFStringEncoding {
1075 extern "C-unwind" {
1076 fn CTFontGetStringEncoding(font: &CTFont) -> CFStringEncoding;
1077 }
1078 unsafe { CTFontGetStringEncoding(self) }
1079 }
1080
1081 #[doc(alias = "CTFontCopySupportedLanguages")]
1089 #[inline]
1090 pub unsafe fn supported_languages(self: &CTFont) -> CFRetained<CFArray> {
1091 extern "C-unwind" {
1092 fn CTFontCopySupportedLanguages(font: &CTFont) -> Option<NonNull<CFArray>>;
1093 }
1094 let ret = unsafe { CTFontCopySupportedLanguages(self) };
1095 let ret =
1096 ret.expect("function was marked as returning non-null, but actually returned NULL");
1097 unsafe { CFRetained::from_raw(ret) }
1098 }
1099
1100 #[doc(alias = "CTFontGetGlyphsForCharacters")]
1123 #[cfg(feature = "objc2-core-graphics")]
1124 #[inline]
1125 pub unsafe fn glyphs_for_characters(
1126 self: &CTFont,
1127 characters: NonNull<UniChar>,
1128 glyphs: NonNull<CGGlyph>,
1129 count: CFIndex,
1130 ) -> bool {
1131 extern "C-unwind" {
1132 fn CTFontGetGlyphsForCharacters(
1133 font: &CTFont,
1134 characters: NonNull<UniChar>,
1135 glyphs: NonNull<CGGlyph>,
1136 count: CFIndex,
1137 ) -> bool;
1138 }
1139 unsafe { CTFontGetGlyphsForCharacters(self, characters, glyphs, count) }
1140 }
1141
1142 #[doc(alias = "CTFontGetAscent")]
1150 #[inline]
1151 pub unsafe fn ascent(self: &CTFont) -> CGFloat {
1152 extern "C-unwind" {
1153 fn CTFontGetAscent(font: &CTFont) -> CGFloat;
1154 }
1155 unsafe { CTFontGetAscent(self) }
1156 }
1157
1158 #[doc(alias = "CTFontGetDescent")]
1166 #[inline]
1167 pub unsafe fn descent(self: &CTFont) -> CGFloat {
1168 extern "C-unwind" {
1169 fn CTFontGetDescent(font: &CTFont) -> CGFloat;
1170 }
1171 unsafe { CTFontGetDescent(self) }
1172 }
1173
1174 #[doc(alias = "CTFontGetLeading")]
1182 #[inline]
1183 pub unsafe fn leading(self: &CTFont) -> CGFloat {
1184 extern "C-unwind" {
1185 fn CTFontGetLeading(font: &CTFont) -> CGFloat;
1186 }
1187 unsafe { CTFontGetLeading(self) }
1188 }
1189
1190 #[doc(alias = "CTFontGetUnitsPerEm")]
1198 #[inline]
1199 pub unsafe fn units_per_em(self: &CTFont) -> c_uint {
1200 extern "C-unwind" {
1201 fn CTFontGetUnitsPerEm(font: &CTFont) -> c_uint;
1202 }
1203 unsafe { CTFontGetUnitsPerEm(self) }
1204 }
1205
1206 #[doc(alias = "CTFontGetGlyphCount")]
1214 #[inline]
1215 pub unsafe fn glyph_count(self: &CTFont) -> CFIndex {
1216 extern "C-unwind" {
1217 fn CTFontGetGlyphCount(font: &CTFont) -> CFIndex;
1218 }
1219 unsafe { CTFontGetGlyphCount(self) }
1220 }
1221
1222 #[doc(alias = "CTFontGetBoundingBox")]
1230 #[inline]
1231 pub unsafe fn bounding_box(self: &CTFont) -> CGRect {
1232 extern "C-unwind" {
1233 fn CTFontGetBoundingBox(font: &CTFont) -> CGRect;
1234 }
1235 unsafe { CTFontGetBoundingBox(self) }
1236 }
1237
1238 #[doc(alias = "CTFontGetUnderlinePosition")]
1246 #[inline]
1247 pub unsafe fn underline_position(self: &CTFont) -> CGFloat {
1248 extern "C-unwind" {
1249 fn CTFontGetUnderlinePosition(font: &CTFont) -> CGFloat;
1250 }
1251 unsafe { CTFontGetUnderlinePosition(self) }
1252 }
1253
1254 #[doc(alias = "CTFontGetUnderlineThickness")]
1262 #[inline]
1263 pub unsafe fn underline_thickness(self: &CTFont) -> CGFloat {
1264 extern "C-unwind" {
1265 fn CTFontGetUnderlineThickness(font: &CTFont) -> CGFloat;
1266 }
1267 unsafe { CTFontGetUnderlineThickness(self) }
1268 }
1269
1270 #[doc(alias = "CTFontGetSlantAngle")]
1278 #[inline]
1279 pub unsafe fn slant_angle(self: &CTFont) -> CGFloat {
1280 extern "C-unwind" {
1281 fn CTFontGetSlantAngle(font: &CTFont) -> CGFloat;
1282 }
1283 unsafe { CTFontGetSlantAngle(self) }
1284 }
1285
1286 #[doc(alias = "CTFontGetCapHeight")]
1294 #[inline]
1295 pub unsafe fn cap_height(self: &CTFont) -> CGFloat {
1296 extern "C-unwind" {
1297 fn CTFontGetCapHeight(font: &CTFont) -> CGFloat;
1298 }
1299 unsafe { CTFontGetCapHeight(self) }
1300 }
1301
1302 #[doc(alias = "CTFontGetXHeight")]
1310 #[inline]
1311 pub unsafe fn x_height(self: &CTFont) -> CGFloat {
1312 extern "C-unwind" {
1313 fn CTFontGetXHeight(font: &CTFont) -> CGFloat;
1314 }
1315 unsafe { CTFontGetXHeight(self) }
1316 }
1317
1318 #[doc(alias = "CTFontGetGlyphWithName")]
1329 #[cfg(feature = "objc2-core-graphics")]
1330 #[inline]
1331 pub unsafe fn glyph_with_name(self: &CTFont, glyph_name: &CFString) -> CGGlyph {
1332 extern "C-unwind" {
1333 fn CTFontGetGlyphWithName(font: &CTFont, glyph_name: &CFString) -> CGGlyph;
1334 }
1335 unsafe { CTFontGetGlyphWithName(self, glyph_name) }
1336 }
1337
1338 #[doc(alias = "CTFontCopyNameForGlyph")]
1352 #[cfg(feature = "objc2-core-graphics")]
1353 #[inline]
1354 pub unsafe fn name_for_glyph(self: &CTFont, glyph: CGGlyph) -> Option<CFRetained<CFString>> {
1355 extern "C-unwind" {
1356 fn CTFontCopyNameForGlyph(font: &CTFont, glyph: CGGlyph) -> Option<NonNull<CFString>>;
1357 }
1358 let ret = unsafe { CTFontCopyNameForGlyph(self, glyph) };
1359 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1360 }
1361
1362 #[doc(alias = "CTFontGetBoundingRectsForGlyphs")]
1382 #[cfg(all(feature = "CTFontDescriptor", feature = "objc2-core-graphics"))]
1383 #[inline]
1384 pub unsafe fn bounding_rects_for_glyphs(
1385 self: &CTFont,
1386 orientation: CTFontOrientation,
1387 glyphs: NonNull<CGGlyph>,
1388 bounding_rects: *mut CGRect,
1389 count: CFIndex,
1390 ) -> CGRect {
1391 extern "C-unwind" {
1392 fn CTFontGetBoundingRectsForGlyphs(
1393 font: &CTFont,
1394 orientation: CTFontOrientation,
1395 glyphs: NonNull<CGGlyph>,
1396 bounding_rects: *mut CGRect,
1397 count: CFIndex,
1398 ) -> CGRect;
1399 }
1400 unsafe { CTFontGetBoundingRectsForGlyphs(self, orientation, glyphs, bounding_rects, count) }
1401 }
1402
1403 #[doc(alias = "CTFontGetOpticalBoundsForGlyphs")]
1426 #[cfg(feature = "objc2-core-graphics")]
1427 #[inline]
1428 pub unsafe fn optical_bounds_for_glyphs(
1429 self: &CTFont,
1430 glyphs: NonNull<CGGlyph>,
1431 bounding_rects: *mut CGRect,
1432 count: CFIndex,
1433 options: CFOptionFlags,
1434 ) -> CGRect {
1435 extern "C-unwind" {
1436 fn CTFontGetOpticalBoundsForGlyphs(
1437 font: &CTFont,
1438 glyphs: NonNull<CGGlyph>,
1439 bounding_rects: *mut CGRect,
1440 count: CFIndex,
1441 options: CFOptionFlags,
1442 ) -> CGRect;
1443 }
1444 unsafe { CTFontGetOpticalBoundsForGlyphs(self, glyphs, bounding_rects, count, options) }
1445 }
1446
1447 #[doc(alias = "CTFontGetAdvancesForGlyphs")]
1467 #[cfg(all(feature = "CTFontDescriptor", feature = "objc2-core-graphics"))]
1468 #[inline]
1469 pub unsafe fn advances_for_glyphs(
1470 self: &CTFont,
1471 orientation: CTFontOrientation,
1472 glyphs: NonNull<CGGlyph>,
1473 advances: *mut CGSize,
1474 count: CFIndex,
1475 ) -> c_double {
1476 extern "C-unwind" {
1477 fn CTFontGetAdvancesForGlyphs(
1478 font: &CTFont,
1479 orientation: CTFontOrientation,
1480 glyphs: NonNull<CGGlyph>,
1481 advances: *mut CGSize,
1482 count: CFIndex,
1483 ) -> c_double;
1484 }
1485 unsafe { CTFontGetAdvancesForGlyphs(self, orientation, glyphs, advances, count) }
1486 }
1487
1488 #[doc(alias = "CTFontGetVerticalTranslationsForGlyphs")]
1502 #[cfg(feature = "objc2-core-graphics")]
1503 #[inline]
1504 pub unsafe fn vertical_translations_for_glyphs(
1505 self: &CTFont,
1506 glyphs: NonNull<CGGlyph>,
1507 translations: NonNull<CGSize>,
1508 count: CFIndex,
1509 ) {
1510 extern "C-unwind" {
1511 fn CTFontGetVerticalTranslationsForGlyphs(
1512 font: &CTFont,
1513 glyphs: NonNull<CGGlyph>,
1514 translations: NonNull<CGSize>,
1515 count: CFIndex,
1516 );
1517 }
1518 unsafe { CTFontGetVerticalTranslationsForGlyphs(self, glyphs, translations, count) }
1519 }
1520
1521 #[doc(alias = "CTFontCreatePathForGlyph")]
1538 #[cfg(feature = "objc2-core-graphics")]
1539 #[inline]
1540 pub unsafe fn path_for_glyph(
1541 self: &CTFont,
1542 glyph: CGGlyph,
1543 matrix: *const CGAffineTransform,
1544 ) -> Option<CFRetained<CGPath>> {
1545 extern "C-unwind" {
1546 fn CTFontCreatePathForGlyph(
1547 font: &CTFont,
1548 glyph: CGGlyph,
1549 matrix: *const CGAffineTransform,
1550 ) -> Option<NonNull<CGPath>>;
1551 }
1552 let ret = unsafe { CTFontCreatePathForGlyph(self, glyph, matrix) };
1553 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1554 }
1555}
1556
1557extern "C" {
1558 pub static kCTFontVariationAxisIdentifierKey: &'static CFString;
1566}
1567
1568extern "C" {
1569 pub static kCTFontVariationAxisMinimumValueKey: &'static CFString;
1577}
1578
1579extern "C" {
1580 pub static kCTFontVariationAxisMaximumValueKey: &'static CFString;
1588}
1589
1590extern "C" {
1591 pub static kCTFontVariationAxisDefaultValueKey: &'static CFString;
1599}
1600
1601extern "C" {
1602 pub static kCTFontVariationAxisNameKey: &'static CFString;
1610}
1611
1612extern "C" {
1613 pub static kCTFontVariationAxisHiddenKey: &'static CFString;
1621}
1622
1623impl CTFont {
1624 #[doc(alias = "CTFontCopyVariationAxes")]
1634 #[inline]
1635 pub unsafe fn variation_axes(self: &CTFont) -> Option<CFRetained<CFArray>> {
1636 extern "C-unwind" {
1637 fn CTFontCopyVariationAxes(font: &CTFont) -> Option<NonNull<CFArray>>;
1638 }
1639 let ret = unsafe { CTFontCopyVariationAxes(self) };
1640 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1641 }
1642
1643 #[doc(alias = "CTFontCopyVariation")]
1658 #[inline]
1659 pub unsafe fn variation(self: &CTFont) -> Option<CFRetained<CFDictionary>> {
1660 extern "C-unwind" {
1661 fn CTFontCopyVariation(font: &CTFont) -> Option<NonNull<CFDictionary>>;
1662 }
1663 let ret = unsafe { CTFontCopyVariation(self) };
1664 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1665 }
1666}
1667
1668extern "C" {
1669 pub static kCTFontOpenTypeFeatureTag: &'static CFString;
1677}
1678
1679extern "C" {
1680 pub static kCTFontOpenTypeFeatureValue: &'static CFString;
1688}
1689
1690extern "C" {
1691 pub static kCTFontFeatureTypeIdentifierKey: &'static CFString;
1699}
1700
1701extern "C" {
1702 pub static kCTFontFeatureTypeNameKey: &'static CFString;
1710}
1711
1712extern "C" {
1713 pub static kCTFontFeatureTypeExclusiveKey: &'static CFString;
1721}
1722
1723extern "C" {
1724 pub static kCTFontFeatureTypeSelectorsKey: &'static CFString;
1732}
1733
1734extern "C" {
1735 pub static kCTFontFeatureSelectorIdentifierKey: &'static CFString;
1743}
1744
1745extern "C" {
1746 pub static kCTFontFeatureSelectorNameKey: &'static CFString;
1754}
1755
1756extern "C" {
1757 pub static kCTFontFeatureSelectorDefaultKey: &'static CFString;
1765}
1766
1767extern "C" {
1768 pub static kCTFontFeatureSelectorSettingKey: &'static CFString;
1776}
1777
1778extern "C" {
1779 pub static kCTFontFeatureSampleTextKey: &'static CFString;
1787}
1788
1789extern "C" {
1790 pub static kCTFontFeatureTooltipTextKey: &'static CFString;
1798}
1799
1800impl CTFont {
1801 #[doc(alias = "CTFontCopyFeatures")]
1809 #[inline]
1810 pub unsafe fn features(self: &CTFont) -> Option<CFRetained<CFArray>> {
1811 extern "C-unwind" {
1812 fn CTFontCopyFeatures(font: &CTFont) -> Option<NonNull<CFArray>>;
1813 }
1814 let ret = unsafe { CTFontCopyFeatures(self) };
1815 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1816 }
1817
1818 #[doc(alias = "CTFontCopyFeatureSettings")]
1829 #[inline]
1830 pub unsafe fn feature_settings(self: &CTFont) -> Option<CFRetained<CFArray>> {
1831 extern "C-unwind" {
1832 fn CTFontCopyFeatureSettings(font: &CTFont) -> Option<NonNull<CFArray>>;
1833 }
1834 let ret = unsafe { CTFontCopyFeatureSettings(self) };
1835 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1836 }
1837
1838 #[doc(alias = "CTFontCopyGraphicsFont")]
1849 #[cfg(all(feature = "CTFontDescriptor", feature = "objc2-core-graphics"))]
1850 #[inline]
1851 pub unsafe fn graphics_font(
1852 self: &CTFont,
1853 attributes: *mut *const CTFontDescriptor,
1854 ) -> CFRetained<CGFont> {
1855 extern "C-unwind" {
1856 fn CTFontCopyGraphicsFont(
1857 font: &CTFont,
1858 attributes: *mut *const CTFontDescriptor,
1859 ) -> Option<NonNull<CGFont>>;
1860 }
1861 let ret = unsafe { CTFontCopyGraphicsFont(self, attributes) };
1862 let ret =
1863 ret.expect("function was marked as returning non-null, but actually returned NULL");
1864 unsafe { CFRetained::from_raw(ret) }
1865 }
1866
1867 #[doc(alias = "CTFontCreateWithGraphicsFont")]
1884 #[cfg(all(feature = "CTFontDescriptor", feature = "objc2-core-graphics"))]
1885 #[inline]
1886 pub unsafe fn with_graphics_font(
1887 graphics_font: &CGFont,
1888 size: CGFloat,
1889 matrix: *const CGAffineTransform,
1890 attributes: Option<&CTFontDescriptor>,
1891 ) -> CFRetained<CTFont> {
1892 extern "C-unwind" {
1893 fn CTFontCreateWithGraphicsFont(
1894 graphics_font: &CGFont,
1895 size: CGFloat,
1896 matrix: *const CGAffineTransform,
1897 attributes: Option<&CTFontDescriptor>,
1898 ) -> Option<NonNull<CTFont>>;
1899 }
1900 let ret = unsafe { CTFontCreateWithGraphicsFont(graphics_font, size, matrix, attributes) };
1901 let ret =
1902 ret.expect("function was marked as returning non-null, but actually returned NULL");
1903 unsafe { CFRetained::from_raw(ret) }
1904 }
1905}
1906
1907pub type ATSFontRef = u32;
1909
1910impl CTFont {
1911 #[doc(alias = "CTFontCreateWithQuickdrawInstance")]
1931 #[deprecated = "Quickdraw font references are deprecated"]
1932 #[inline]
1933 pub unsafe fn with_quickdraw_instance(
1934 name: ConstStr255Param,
1935 identifier: i16,
1936 style: u8,
1937 size: CGFloat,
1938 ) -> CFRetained<CTFont> {
1939 extern "C-unwind" {
1940 fn CTFontCreateWithQuickdrawInstance(
1941 name: ConstStr255Param,
1942 identifier: i16,
1943 style: u8,
1944 size: CGFloat,
1945 ) -> Option<NonNull<CTFont>>;
1946 }
1947 let ret = unsafe { CTFontCreateWithQuickdrawInstance(name, identifier, style, size) };
1948 let ret =
1949 ret.expect("function was marked as returning non-null, but actually returned NULL");
1950 unsafe { CFRetained::from_raw(ret) }
1951 }
1952}
1953
1954pub const kCTFontTableBASE: c_uint = 0x42415345;
1956pub const kCTFontTableCBDT: c_uint = 0x43424454;
1958pub const kCTFontTableCBLC: c_uint = 0x43424c43;
1960pub const kCTFontTableCFF: c_uint = 0x43464620;
1962pub const kCTFontTableCFF2: c_uint = 0x43464632;
1964pub const kCTFontTableCOLR: c_uint = 0x434f4c52;
1966pub const kCTFontTableCPAL: c_uint = 0x4350414c;
1968pub const kCTFontTableDSIG: c_uint = 0x44534947;
1970pub const kCTFontTableEBDT: c_uint = 0x45424454;
1972pub const kCTFontTableEBLC: c_uint = 0x45424c43;
1974pub const kCTFontTableEBSC: c_uint = 0x45425343;
1976pub const kCTFontTableGDEF: c_uint = 0x47444546;
1978pub const kCTFontTableGPOS: c_uint = 0x47504f53;
1980pub const kCTFontTableGSUB: c_uint = 0x47535542;
1982pub const kCTFontTableHVAR: c_uint = 0x48564152;
1984pub const kCTFontTableJSTF: c_uint = 0x4a535446;
1986pub const kCTFontTableLTSH: c_uint = 0x4c545348;
1988pub const kCTFontTableMATH: c_uint = 0x4d415448;
1990pub const kCTFontTableMERG: c_uint = 0x4d455247;
1992pub const kCTFontTableMVAR: c_uint = 0x4d564152;
1994pub const kCTFontTableOS2: c_uint = 0x4f532f32;
1996pub const kCTFontTablePCLT: c_uint = 0x50434c54;
1998pub const kCTFontTableSTAT: c_uint = 0x53544154;
2000pub const kCTFontTableSVG: c_uint = 0x53564720;
2002pub const kCTFontTableVDMX: c_uint = 0x56444d58;
2004pub const kCTFontTableVORG: c_uint = 0x564f5247;
2006pub const kCTFontTableVVAR: c_uint = 0x56564152;
2008pub const kCTFontTableZapf: c_uint = 0x5a617066;
2010pub const kCTFontTableAcnt: c_uint = 0x61636e74;
2012pub const kCTFontTableAnkr: c_uint = 0x616e6b72;
2014pub const kCTFontTableAvar: c_uint = 0x61766172;
2016pub const kCTFontTableBdat: c_uint = 0x62646174;
2018pub const kCTFontTableBhed: c_uint = 0x62686564;
2020pub const kCTFontTableBloc: c_uint = 0x626c6f63;
2022pub const kCTFontTableBsln: c_uint = 0x62736c6e;
2024pub const kCTFontTableCidg: c_uint = 0x63696467;
2026pub const kCTFontTableCmap: c_uint = 0x636d6170;
2028pub const kCTFontTableCvar: c_uint = 0x63766172;
2030pub const kCTFontTableCvt: c_uint = 0x63767420;
2032pub const kCTFontTableFdsc: c_uint = 0x66647363;
2034pub const kCTFontTableFeat: c_uint = 0x66656174;
2036pub const kCTFontTableFmtx: c_uint = 0x666d7478;
2038pub const kCTFontTableFond: c_uint = 0x666f6e64;
2040pub const kCTFontTableFpgm: c_uint = 0x6670676d;
2042pub const kCTFontTableFvar: c_uint = 0x66766172;
2044pub const kCTFontTableGasp: c_uint = 0x67617370;
2046pub const kCTFontTableGlyf: c_uint = 0x676c7966;
2048pub const kCTFontTableGvar: c_uint = 0x67766172;
2050pub const kCTFontTableHdmx: c_uint = 0x68646d78;
2052pub const kCTFontTableHead: c_uint = 0x68656164;
2054pub const kCTFontTableHhea: c_uint = 0x68686561;
2056pub const kCTFontTableHmtx: c_uint = 0x686d7478;
2058pub const kCTFontTableHsty: c_uint = 0x68737479;
2060pub const kCTFontTableJust: c_uint = 0x6a757374;
2062pub const kCTFontTableKern: c_uint = 0x6b65726e;
2064pub const kCTFontTableKerx: c_uint = 0x6b657278;
2066pub const kCTFontTableLcar: c_uint = 0x6c636172;
2068pub const kCTFontTableLoca: c_uint = 0x6c6f6361;
2070pub const kCTFontTableLtag: c_uint = 0x6c746167;
2072pub const kCTFontTableMaxp: c_uint = 0x6d617870;
2074pub const kCTFontTableMeta: c_uint = 0x6d657461;
2076pub const kCTFontTableMort: c_uint = 0x6d6f7274;
2078pub const kCTFontTableMorx: c_uint = 0x6d6f7278;
2080pub const kCTFontTableName: c_uint = 0x6e616d65;
2082pub const kCTFontTableOpbd: c_uint = 0x6f706264;
2084pub const kCTFontTablePost: c_uint = 0x706f7374;
2086pub const kCTFontTablePrep: c_uint = 0x70726570;
2088pub const kCTFontTableProp: c_uint = 0x70726f70;
2090pub const kCTFontTableSbit: c_uint = 0x73626974;
2092pub const kCTFontTableSbix: c_uint = 0x73626978;
2094pub const kCTFontTableTrak: c_uint = 0x7472616b;
2096pub const kCTFontTableVhea: c_uint = 0x76686561;
2098pub const kCTFontTableVmtx: c_uint = 0x766d7478;
2100pub const kCTFontTableXref: c_uint = 0x78726566;
2102
2103pub type CTFontTableTag = FourCharCode;
2105
2106#[repr(transparent)]
2109#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2110pub struct CTFontTableOptions(pub u32);
2111bitflags::bitflags! {
2112 impl CTFontTableOptions: u32 {
2113 #[doc(alias = "kCTFontTableOptionNoOptions")]
2114 const NoOptions = 0;
2115 #[doc(alias = "kCTFontTableOptionExcludeSynthetic")]
2116#[deprecated = "Unsupported"]
2117 const ExcludeSynthetic = 1<<0;
2118 }
2119}
2120
2121#[cfg(feature = "objc2")]
2122unsafe impl Encode for CTFontTableOptions {
2123 const ENCODING: Encoding = u32::ENCODING;
2124}
2125
2126#[cfg(feature = "objc2")]
2127unsafe impl RefEncode for CTFontTableOptions {
2128 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2129}
2130
2131impl CTFont {
2132 #[doc(alias = "CTFontCopyAvailableTables")]
2146 #[inline]
2147 pub unsafe fn available_tables(
2148 self: &CTFont,
2149 options: CTFontTableOptions,
2150 ) -> Option<CFRetained<CFArray>> {
2151 extern "C-unwind" {
2152 fn CTFontCopyAvailableTables(
2153 font: &CTFont,
2154 options: CTFontTableOptions,
2155 ) -> Option<NonNull<CFArray>>;
2156 }
2157 let ret = unsafe { CTFontCopyAvailableTables(self, options) };
2158 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2159 }
2160
2161 #[doc(alias = "CTFontHasTable")]
2174 #[inline]
2175 pub unsafe fn has_table(self: &CTFont, tag: CTFontTableTag) -> bool {
2176 extern "C-unwind" {
2177 fn CTFontHasTable(font: &CTFont, tag: CTFontTableTag) -> bool;
2178 }
2179 unsafe { CTFontHasTable(self, tag) }
2180 }
2181
2182 #[doc(alias = "CTFontCopyTable")]
2196 #[inline]
2197 pub unsafe fn table(
2198 self: &CTFont,
2199 table: CTFontTableTag,
2200 options: CTFontTableOptions,
2201 ) -> Option<CFRetained<CFData>> {
2202 extern "C-unwind" {
2203 fn CTFontCopyTable(
2204 font: &CTFont,
2205 table: CTFontTableTag,
2206 options: CTFontTableOptions,
2207 ) -> Option<NonNull<CFData>>;
2208 }
2209 let ret = unsafe { CTFontCopyTable(self, table, options) };
2210 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2211 }
2212
2213 #[doc(alias = "CTFontDrawGlyphs")]
2233 #[cfg(feature = "objc2-core-graphics")]
2234 #[inline]
2235 pub unsafe fn draw_glyphs(
2236 self: &CTFont,
2237 glyphs: NonNull<CGGlyph>,
2238 positions: NonNull<CGPoint>,
2239 count: usize,
2240 context: &CGContext,
2241 ) {
2242 extern "C-unwind" {
2243 fn CTFontDrawGlyphs(
2244 font: &CTFont,
2245 glyphs: NonNull<CGGlyph>,
2246 positions: NonNull<CGPoint>,
2247 count: usize,
2248 context: &CGContext,
2249 );
2250 }
2251 unsafe { CTFontDrawGlyphs(self, glyphs, positions, count, context) }
2252 }
2253
2254 #[doc(alias = "CTFontGetLigatureCaretPositions")]
2278 #[cfg(feature = "objc2-core-graphics")]
2279 #[inline]
2280 pub unsafe fn ligature_caret_positions(
2281 self: &CTFont,
2282 glyph: CGGlyph,
2283 positions: *mut CGFloat,
2284 max_positions: CFIndex,
2285 ) -> CFIndex {
2286 extern "C-unwind" {
2287 fn CTFontGetLigatureCaretPositions(
2288 font: &CTFont,
2289 glyph: CGGlyph,
2290 positions: *mut CGFloat,
2291 max_positions: CFIndex,
2292 ) -> CFIndex;
2293 }
2294 unsafe { CTFontGetLigatureCaretPositions(self, glyph, positions, max_positions) }
2295 }
2296}
2297
2298extern "C" {
2299 pub static kCTBaselineClassRoman: &'static CFString;
2309}
2310
2311extern "C" {
2312 pub static kCTBaselineClassIdeographicCentered: &'static CFString;
2322}
2323
2324extern "C" {
2325 pub static kCTBaselineClassIdeographicLow: &'static CFString;
2335}
2336
2337extern "C" {
2338 pub static kCTBaselineClassIdeographicHigh: &'static CFString;
2348}
2349
2350extern "C" {
2351 pub static kCTBaselineClassHanging: &'static CFString;
2361}
2362
2363extern "C" {
2364 pub static kCTBaselineClassMath: &'static CFString;
2374}
2375
2376extern "C" {
2377 pub static kCTBaselineReferenceFont: &'static CFString;
2387}
2388
2389extern "C" {
2390 pub static kCTBaselineOriginalFont: &'static CFString;
2400}
2401
2402impl CTFont {
2403 #[doc(alias = "CTFontGetTypographicBoundsForAdaptiveImageProvider")]
2404 #[cfg(all(feature = "CTRunDelegate", feature = "objc2"))]
2405 #[inline]
2406 pub unsafe fn typographic_bounds_for_adaptive_image_provider(
2407 self: &CTFont,
2408 provider: Option<&ProtocolObject<dyn CTAdaptiveImageProviding>>,
2409 ) -> CGRect {
2410 extern "C-unwind" {
2411 fn CTFontGetTypographicBoundsForAdaptiveImageProvider(
2412 font: &CTFont,
2413 provider: Option<&ProtocolObject<dyn CTAdaptiveImageProviding>>,
2414 ) -> CGRect;
2415 }
2416 unsafe { CTFontGetTypographicBoundsForAdaptiveImageProvider(self, provider) }
2417 }
2418
2419 #[doc(alias = "CTFontDrawImageFromAdaptiveImageProviderAtPoint")]
2420 #[cfg(all(
2421 feature = "CTRunDelegate",
2422 feature = "objc2",
2423 feature = "objc2-core-graphics"
2424 ))]
2425 #[inline]
2426 pub unsafe fn draw_image_from_adaptive_image_provider_at_point(
2427 self: &CTFont,
2428 provider: &ProtocolObject<dyn CTAdaptiveImageProviding>,
2429 point: CGPoint,
2430 context: &CGContext,
2431 ) {
2432 extern "C-unwind" {
2433 fn CTFontDrawImageFromAdaptiveImageProviderAtPoint(
2434 font: &CTFont,
2435 provider: &ProtocolObject<dyn CTAdaptiveImageProviding>,
2436 point: CGPoint,
2437 context: &CGContext,
2438 );
2439 }
2440 unsafe { CTFontDrawImageFromAdaptiveImageProviderAtPoint(self, provider, point, context) }
2441 }
2442}
2443
2444#[deprecated = "renamed to `CTFont::with_name`"]
2445#[inline]
2446pub unsafe extern "C-unwind" fn CTFontCreateWithName(
2447 name: &CFString,
2448 size: CGFloat,
2449 matrix: *const CGAffineTransform,
2450) -> CFRetained<CTFont> {
2451 extern "C-unwind" {
2452 fn CTFontCreateWithName(
2453 name: &CFString,
2454 size: CGFloat,
2455 matrix: *const CGAffineTransform,
2456 ) -> Option<NonNull<CTFont>>;
2457 }
2458 let ret = unsafe { CTFontCreateWithName(name, size, matrix) };
2459 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
2460 unsafe { CFRetained::from_raw(ret) }
2461}
2462
2463#[cfg(feature = "CTFontDescriptor")]
2464#[deprecated = "renamed to `CTFont::with_font_descriptor`"]
2465#[inline]
2466pub unsafe extern "C-unwind" fn CTFontCreateWithFontDescriptor(
2467 descriptor: &CTFontDescriptor,
2468 size: CGFloat,
2469 matrix: *const CGAffineTransform,
2470) -> CFRetained<CTFont> {
2471 extern "C-unwind" {
2472 fn CTFontCreateWithFontDescriptor(
2473 descriptor: &CTFontDescriptor,
2474 size: CGFloat,
2475 matrix: *const CGAffineTransform,
2476 ) -> Option<NonNull<CTFont>>;
2477 }
2478 let ret = unsafe { CTFontCreateWithFontDescriptor(descriptor, size, matrix) };
2479 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
2480 unsafe { CFRetained::from_raw(ret) }
2481}
2482
2483#[deprecated = "renamed to `CTFont::with_name_and_options`"]
2484#[inline]
2485pub unsafe extern "C-unwind" fn CTFontCreateWithNameAndOptions(
2486 name: &CFString,
2487 size: CGFloat,
2488 matrix: *const CGAffineTransform,
2489 options: CTFontOptions,
2490) -> CFRetained<CTFont> {
2491 extern "C-unwind" {
2492 fn CTFontCreateWithNameAndOptions(
2493 name: &CFString,
2494 size: CGFloat,
2495 matrix: *const CGAffineTransform,
2496 options: CTFontOptions,
2497 ) -> Option<NonNull<CTFont>>;
2498 }
2499 let ret = unsafe { CTFontCreateWithNameAndOptions(name, size, matrix, options) };
2500 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
2501 unsafe { CFRetained::from_raw(ret) }
2502}
2503
2504#[cfg(feature = "CTFontDescriptor")]
2505#[deprecated = "renamed to `CTFont::with_font_descriptor_and_options`"]
2506#[inline]
2507pub unsafe extern "C-unwind" fn CTFontCreateWithFontDescriptorAndOptions(
2508 descriptor: &CTFontDescriptor,
2509 size: CGFloat,
2510 matrix: *const CGAffineTransform,
2511 options: CTFontOptions,
2512) -> CFRetained<CTFont> {
2513 extern "C-unwind" {
2514 fn CTFontCreateWithFontDescriptorAndOptions(
2515 descriptor: &CTFontDescriptor,
2516 size: CGFloat,
2517 matrix: *const CGAffineTransform,
2518 options: CTFontOptions,
2519 ) -> Option<NonNull<CTFont>>;
2520 }
2521 let ret =
2522 unsafe { CTFontCreateWithFontDescriptorAndOptions(descriptor, size, matrix, options) };
2523 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
2524 unsafe { CFRetained::from_raw(ret) }
2525}
2526
2527#[deprecated = "renamed to `CTFont::new_ui_font_for_language`"]
2528#[inline]
2529pub unsafe extern "C-unwind" fn CTFontCreateUIFontForLanguage(
2530 ui_type: CTFontUIFontType,
2531 size: CGFloat,
2532 language: Option<&CFString>,
2533) -> Option<CFRetained<CTFont>> {
2534 extern "C-unwind" {
2535 fn CTFontCreateUIFontForLanguage(
2536 ui_type: CTFontUIFontType,
2537 size: CGFloat,
2538 language: Option<&CFString>,
2539 ) -> Option<NonNull<CTFont>>;
2540 }
2541 let ret = unsafe { CTFontCreateUIFontForLanguage(ui_type, size, language) };
2542 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2543}
2544
2545#[cfg(feature = "CTFontDescriptor")]
2546#[deprecated = "renamed to `CTFont::copy_with_attributes`"]
2547#[inline]
2548pub unsafe extern "C-unwind" fn CTFontCreateCopyWithAttributes(
2549 font: &CTFont,
2550 size: CGFloat,
2551 matrix: *const CGAffineTransform,
2552 attributes: Option<&CTFontDescriptor>,
2553) -> CFRetained<CTFont> {
2554 extern "C-unwind" {
2555 fn CTFontCreateCopyWithAttributes(
2556 font: &CTFont,
2557 size: CGFloat,
2558 matrix: *const CGAffineTransform,
2559 attributes: Option<&CTFontDescriptor>,
2560 ) -> Option<NonNull<CTFont>>;
2561 }
2562 let ret = unsafe { CTFontCreateCopyWithAttributes(font, size, matrix, attributes) };
2563 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
2564 unsafe { CFRetained::from_raw(ret) }
2565}
2566
2567#[cfg(feature = "CTFontTraits")]
2568#[deprecated = "renamed to `CTFont::copy_with_symbolic_traits`"]
2569#[inline]
2570pub unsafe extern "C-unwind" fn CTFontCreateCopyWithSymbolicTraits(
2571 font: &CTFont,
2572 size: CGFloat,
2573 matrix: *const CGAffineTransform,
2574 sym_trait_value: CTFontSymbolicTraits,
2575 sym_trait_mask: CTFontSymbolicTraits,
2576) -> Option<CFRetained<CTFont>> {
2577 extern "C-unwind" {
2578 fn CTFontCreateCopyWithSymbolicTraits(
2579 font: &CTFont,
2580 size: CGFloat,
2581 matrix: *const CGAffineTransform,
2582 sym_trait_value: CTFontSymbolicTraits,
2583 sym_trait_mask: CTFontSymbolicTraits,
2584 ) -> Option<NonNull<CTFont>>;
2585 }
2586 let ret = unsafe {
2587 CTFontCreateCopyWithSymbolicTraits(font, size, matrix, sym_trait_value, sym_trait_mask)
2588 };
2589 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2590}
2591
2592#[deprecated = "renamed to `CTFont::copy_with_family`"]
2593#[inline]
2594pub unsafe extern "C-unwind" fn CTFontCreateCopyWithFamily(
2595 font: &CTFont,
2596 size: CGFloat,
2597 matrix: *const CGAffineTransform,
2598 family: &CFString,
2599) -> Option<CFRetained<CTFont>> {
2600 extern "C-unwind" {
2601 fn CTFontCreateCopyWithFamily(
2602 font: &CTFont,
2603 size: CGFloat,
2604 matrix: *const CGAffineTransform,
2605 family: &CFString,
2606 ) -> Option<NonNull<CTFont>>;
2607 }
2608 let ret = unsafe { CTFontCreateCopyWithFamily(font, size, matrix, family) };
2609 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2610}
2611
2612#[deprecated = "renamed to `CTFont::for_string`"]
2613#[inline]
2614pub unsafe extern "C-unwind" fn CTFontCreateForString(
2615 current_font: &CTFont,
2616 string: &CFString,
2617 range: CFRange,
2618) -> CFRetained<CTFont> {
2619 extern "C-unwind" {
2620 fn CTFontCreateForString(
2621 current_font: &CTFont,
2622 string: &CFString,
2623 range: CFRange,
2624 ) -> Option<NonNull<CTFont>>;
2625 }
2626 let ret = unsafe { CTFontCreateForString(current_font, string, range) };
2627 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
2628 unsafe { CFRetained::from_raw(ret) }
2629}
2630
2631#[deprecated = "renamed to `CTFont::for_string_with_language`"]
2632#[inline]
2633pub unsafe extern "C-unwind" fn CTFontCreateForStringWithLanguage(
2634 current_font: &CTFont,
2635 string: &CFString,
2636 range: CFRange,
2637 language: Option<&CFString>,
2638) -> CFRetained<CTFont> {
2639 extern "C-unwind" {
2640 fn CTFontCreateForStringWithLanguage(
2641 current_font: &CTFont,
2642 string: &CFString,
2643 range: CFRange,
2644 language: Option<&CFString>,
2645 ) -> Option<NonNull<CTFont>>;
2646 }
2647 let ret = unsafe { CTFontCreateForStringWithLanguage(current_font, string, range, language) };
2648 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
2649 unsafe { CFRetained::from_raw(ret) }
2650}
2651
2652#[cfg(feature = "CTFontDescriptor")]
2653#[deprecated = "renamed to `CTFont::font_descriptor`"]
2654#[inline]
2655pub unsafe extern "C-unwind" fn CTFontCopyFontDescriptor(
2656 font: &CTFont,
2657) -> CFRetained<CTFontDescriptor> {
2658 extern "C-unwind" {
2659 fn CTFontCopyFontDescriptor(font: &CTFont) -> Option<NonNull<CTFontDescriptor>>;
2660 }
2661 let ret = unsafe { CTFontCopyFontDescriptor(font) };
2662 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
2663 unsafe { CFRetained::from_raw(ret) }
2664}
2665
2666#[deprecated = "renamed to `CTFont::attribute`"]
2667#[inline]
2668pub unsafe extern "C-unwind" fn CTFontCopyAttribute(
2669 font: &CTFont,
2670 attribute: &CFString,
2671) -> Option<CFRetained<CFType>> {
2672 extern "C-unwind" {
2673 fn CTFontCopyAttribute(font: &CTFont, attribute: &CFString) -> Option<NonNull<CFType>>;
2674 }
2675 let ret = unsafe { CTFontCopyAttribute(font, attribute) };
2676 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2677}
2678
2679extern "C-unwind" {
2680 #[deprecated = "renamed to `CTFont::size`"]
2681 pub fn CTFontGetSize(font: &CTFont) -> CGFloat;
2682}
2683
2684extern "C-unwind" {
2685 #[deprecated = "renamed to `CTFont::matrix`"]
2686 pub fn CTFontGetMatrix(font: &CTFont) -> CGAffineTransform;
2687}
2688
2689extern "C-unwind" {
2690 #[cfg(feature = "CTFontTraits")]
2691 #[deprecated = "renamed to `CTFont::symbolic_traits`"]
2692 pub fn CTFontGetSymbolicTraits(font: &CTFont) -> CTFontSymbolicTraits;
2693}
2694
2695#[deprecated = "renamed to `CTFont::traits`"]
2696#[inline]
2697pub unsafe extern "C-unwind" fn CTFontCopyTraits(font: &CTFont) -> CFRetained<CFDictionary> {
2698 extern "C-unwind" {
2699 fn CTFontCopyTraits(font: &CTFont) -> Option<NonNull<CFDictionary>>;
2700 }
2701 let ret = unsafe { CTFontCopyTraits(font) };
2702 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
2703 unsafe { CFRetained::from_raw(ret) }
2704}
2705
2706#[deprecated = "renamed to `CTFont::default_cascade_list_for_languages`"]
2707#[inline]
2708pub unsafe extern "C-unwind" fn CTFontCopyDefaultCascadeListForLanguages(
2709 font: &CTFont,
2710 language_pref_list: Option<&CFArray>,
2711) -> Option<CFRetained<CFArray>> {
2712 extern "C-unwind" {
2713 fn CTFontCopyDefaultCascadeListForLanguages(
2714 font: &CTFont,
2715 language_pref_list: Option<&CFArray>,
2716 ) -> Option<NonNull<CFArray>>;
2717 }
2718 let ret = unsafe { CTFontCopyDefaultCascadeListForLanguages(font, language_pref_list) };
2719 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2720}
2721
2722#[deprecated = "renamed to `CTFont::post_script_name`"]
2723#[inline]
2724pub unsafe extern "C-unwind" fn CTFontCopyPostScriptName(font: &CTFont) -> CFRetained<CFString> {
2725 extern "C-unwind" {
2726 fn CTFontCopyPostScriptName(font: &CTFont) -> Option<NonNull<CFString>>;
2727 }
2728 let ret = unsafe { CTFontCopyPostScriptName(font) };
2729 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
2730 unsafe { CFRetained::from_raw(ret) }
2731}
2732
2733#[deprecated = "renamed to `CTFont::family_name`"]
2734#[inline]
2735pub unsafe extern "C-unwind" fn CTFontCopyFamilyName(font: &CTFont) -> CFRetained<CFString> {
2736 extern "C-unwind" {
2737 fn CTFontCopyFamilyName(font: &CTFont) -> Option<NonNull<CFString>>;
2738 }
2739 let ret = unsafe { CTFontCopyFamilyName(font) };
2740 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
2741 unsafe { CFRetained::from_raw(ret) }
2742}
2743
2744#[deprecated = "renamed to `CTFont::full_name`"]
2745#[inline]
2746pub unsafe extern "C-unwind" fn CTFontCopyFullName(font: &CTFont) -> CFRetained<CFString> {
2747 extern "C-unwind" {
2748 fn CTFontCopyFullName(font: &CTFont) -> Option<NonNull<CFString>>;
2749 }
2750 let ret = unsafe { CTFontCopyFullName(font) };
2751 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
2752 unsafe { CFRetained::from_raw(ret) }
2753}
2754
2755#[deprecated = "renamed to `CTFont::display_name`"]
2756#[inline]
2757pub unsafe extern "C-unwind" fn CTFontCopyDisplayName(font: &CTFont) -> CFRetained<CFString> {
2758 extern "C-unwind" {
2759 fn CTFontCopyDisplayName(font: &CTFont) -> Option<NonNull<CFString>>;
2760 }
2761 let ret = unsafe { CTFontCopyDisplayName(font) };
2762 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
2763 unsafe { CFRetained::from_raw(ret) }
2764}
2765
2766#[deprecated = "renamed to `CTFont::name`"]
2767#[inline]
2768pub unsafe extern "C-unwind" fn CTFontCopyName(
2769 font: &CTFont,
2770 name_key: &CFString,
2771) -> Option<CFRetained<CFString>> {
2772 extern "C-unwind" {
2773 fn CTFontCopyName(font: &CTFont, name_key: &CFString) -> Option<NonNull<CFString>>;
2774 }
2775 let ret = unsafe { CTFontCopyName(font, name_key) };
2776 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2777}
2778
2779#[deprecated = "renamed to `CTFont::localized_name`"]
2780#[inline]
2781pub unsafe extern "C-unwind" fn CTFontCopyLocalizedName(
2782 font: &CTFont,
2783 name_key: &CFString,
2784 actual_language: *mut *const CFString,
2785) -> Option<CFRetained<CFString>> {
2786 extern "C-unwind" {
2787 fn CTFontCopyLocalizedName(
2788 font: &CTFont,
2789 name_key: &CFString,
2790 actual_language: *mut *const CFString,
2791 ) -> Option<NonNull<CFString>>;
2792 }
2793 let ret = unsafe { CTFontCopyLocalizedName(font, name_key, actual_language) };
2794 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2795}
2796
2797#[deprecated = "renamed to `CTFont::character_set`"]
2798#[inline]
2799pub unsafe extern "C-unwind" fn CTFontCopyCharacterSet(
2800 font: &CTFont,
2801) -> CFRetained<CFCharacterSet> {
2802 extern "C-unwind" {
2803 fn CTFontCopyCharacterSet(font: &CTFont) -> Option<NonNull<CFCharacterSet>>;
2804 }
2805 let ret = unsafe { CTFontCopyCharacterSet(font) };
2806 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
2807 unsafe { CFRetained::from_raw(ret) }
2808}
2809
2810extern "C-unwind" {
2811 #[deprecated = "renamed to `CTFont::string_encoding`"]
2812 pub fn CTFontGetStringEncoding(font: &CTFont) -> CFStringEncoding;
2813}
2814
2815#[deprecated = "renamed to `CTFont::supported_languages`"]
2816#[inline]
2817pub unsafe extern "C-unwind" fn CTFontCopySupportedLanguages(font: &CTFont) -> CFRetained<CFArray> {
2818 extern "C-unwind" {
2819 fn CTFontCopySupportedLanguages(font: &CTFont) -> Option<NonNull<CFArray>>;
2820 }
2821 let ret = unsafe { CTFontCopySupportedLanguages(font) };
2822 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
2823 unsafe { CFRetained::from_raw(ret) }
2824}
2825
2826extern "C-unwind" {
2827 #[cfg(feature = "objc2-core-graphics")]
2828 #[deprecated = "renamed to `CTFont::glyphs_for_characters`"]
2829 pub fn CTFontGetGlyphsForCharacters(
2830 font: &CTFont,
2831 characters: NonNull<UniChar>,
2832 glyphs: NonNull<CGGlyph>,
2833 count: CFIndex,
2834 ) -> bool;
2835}
2836
2837extern "C-unwind" {
2838 #[deprecated = "renamed to `CTFont::ascent`"]
2839 pub fn CTFontGetAscent(font: &CTFont) -> CGFloat;
2840}
2841
2842extern "C-unwind" {
2843 #[deprecated = "renamed to `CTFont::descent`"]
2844 pub fn CTFontGetDescent(font: &CTFont) -> CGFloat;
2845}
2846
2847extern "C-unwind" {
2848 #[deprecated = "renamed to `CTFont::leading`"]
2849 pub fn CTFontGetLeading(font: &CTFont) -> CGFloat;
2850}
2851
2852extern "C-unwind" {
2853 #[deprecated = "renamed to `CTFont::units_per_em`"]
2854 pub fn CTFontGetUnitsPerEm(font: &CTFont) -> c_uint;
2855}
2856
2857extern "C-unwind" {
2858 #[deprecated = "renamed to `CTFont::glyph_count`"]
2859 pub fn CTFontGetGlyphCount(font: &CTFont) -> CFIndex;
2860}
2861
2862extern "C-unwind" {
2863 #[deprecated = "renamed to `CTFont::bounding_box`"]
2864 pub fn CTFontGetBoundingBox(font: &CTFont) -> CGRect;
2865}
2866
2867extern "C-unwind" {
2868 #[deprecated = "renamed to `CTFont::underline_position`"]
2869 pub fn CTFontGetUnderlinePosition(font: &CTFont) -> CGFloat;
2870}
2871
2872extern "C-unwind" {
2873 #[deprecated = "renamed to `CTFont::underline_thickness`"]
2874 pub fn CTFontGetUnderlineThickness(font: &CTFont) -> CGFloat;
2875}
2876
2877extern "C-unwind" {
2878 #[deprecated = "renamed to `CTFont::slant_angle`"]
2879 pub fn CTFontGetSlantAngle(font: &CTFont) -> CGFloat;
2880}
2881
2882extern "C-unwind" {
2883 #[deprecated = "renamed to `CTFont::cap_height`"]
2884 pub fn CTFontGetCapHeight(font: &CTFont) -> CGFloat;
2885}
2886
2887extern "C-unwind" {
2888 #[deprecated = "renamed to `CTFont::x_height`"]
2889 pub fn CTFontGetXHeight(font: &CTFont) -> CGFloat;
2890}
2891
2892extern "C-unwind" {
2893 #[cfg(feature = "objc2-core-graphics")]
2894 #[deprecated = "renamed to `CTFont::glyph_with_name`"]
2895 pub fn CTFontGetGlyphWithName(font: &CTFont, glyph_name: &CFString) -> CGGlyph;
2896}
2897
2898#[cfg(feature = "objc2-core-graphics")]
2899#[deprecated = "renamed to `CTFont::name_for_glyph`"]
2900#[inline]
2901pub unsafe extern "C-unwind" fn CTFontCopyNameForGlyph(
2902 font: &CTFont,
2903 glyph: CGGlyph,
2904) -> Option<CFRetained<CFString>> {
2905 extern "C-unwind" {
2906 fn CTFontCopyNameForGlyph(font: &CTFont, glyph: CGGlyph) -> Option<NonNull<CFString>>;
2907 }
2908 let ret = unsafe { CTFontCopyNameForGlyph(font, glyph) };
2909 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2910}
2911
2912extern "C-unwind" {
2913 #[cfg(all(feature = "CTFontDescriptor", feature = "objc2-core-graphics"))]
2914 #[deprecated = "renamed to `CTFont::bounding_rects_for_glyphs`"]
2915 pub fn CTFontGetBoundingRectsForGlyphs(
2916 font: &CTFont,
2917 orientation: CTFontOrientation,
2918 glyphs: NonNull<CGGlyph>,
2919 bounding_rects: *mut CGRect,
2920 count: CFIndex,
2921 ) -> CGRect;
2922}
2923
2924extern "C-unwind" {
2925 #[cfg(feature = "objc2-core-graphics")]
2926 #[deprecated = "renamed to `CTFont::optical_bounds_for_glyphs`"]
2927 pub fn CTFontGetOpticalBoundsForGlyphs(
2928 font: &CTFont,
2929 glyphs: NonNull<CGGlyph>,
2930 bounding_rects: *mut CGRect,
2931 count: CFIndex,
2932 options: CFOptionFlags,
2933 ) -> CGRect;
2934}
2935
2936extern "C-unwind" {
2937 #[cfg(all(feature = "CTFontDescriptor", feature = "objc2-core-graphics"))]
2938 #[deprecated = "renamed to `CTFont::advances_for_glyphs`"]
2939 pub fn CTFontGetAdvancesForGlyphs(
2940 font: &CTFont,
2941 orientation: CTFontOrientation,
2942 glyphs: NonNull<CGGlyph>,
2943 advances: *mut CGSize,
2944 count: CFIndex,
2945 ) -> c_double;
2946}
2947
2948extern "C-unwind" {
2949 #[cfg(feature = "objc2-core-graphics")]
2950 #[deprecated = "renamed to `CTFont::vertical_translations_for_glyphs`"]
2951 pub fn CTFontGetVerticalTranslationsForGlyphs(
2952 font: &CTFont,
2953 glyphs: NonNull<CGGlyph>,
2954 translations: NonNull<CGSize>,
2955 count: CFIndex,
2956 );
2957}
2958
2959#[cfg(feature = "objc2-core-graphics")]
2960#[deprecated = "renamed to `CTFont::path_for_glyph`"]
2961#[inline]
2962pub unsafe extern "C-unwind" fn CTFontCreatePathForGlyph(
2963 font: &CTFont,
2964 glyph: CGGlyph,
2965 matrix: *const CGAffineTransform,
2966) -> Option<CFRetained<CGPath>> {
2967 extern "C-unwind" {
2968 fn CTFontCreatePathForGlyph(
2969 font: &CTFont,
2970 glyph: CGGlyph,
2971 matrix: *const CGAffineTransform,
2972 ) -> Option<NonNull<CGPath>>;
2973 }
2974 let ret = unsafe { CTFontCreatePathForGlyph(font, glyph, matrix) };
2975 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2976}
2977
2978#[deprecated = "renamed to `CTFont::variation_axes`"]
2979#[inline]
2980pub unsafe extern "C-unwind" fn CTFontCopyVariationAxes(
2981 font: &CTFont,
2982) -> Option<CFRetained<CFArray>> {
2983 extern "C-unwind" {
2984 fn CTFontCopyVariationAxes(font: &CTFont) -> Option<NonNull<CFArray>>;
2985 }
2986 let ret = unsafe { CTFontCopyVariationAxes(font) };
2987 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2988}
2989
2990#[deprecated = "renamed to `CTFont::variation`"]
2991#[inline]
2992pub unsafe extern "C-unwind" fn CTFontCopyVariation(
2993 font: &CTFont,
2994) -> Option<CFRetained<CFDictionary>> {
2995 extern "C-unwind" {
2996 fn CTFontCopyVariation(font: &CTFont) -> Option<NonNull<CFDictionary>>;
2997 }
2998 let ret = unsafe { CTFontCopyVariation(font) };
2999 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
3000}
3001
3002#[deprecated = "renamed to `CTFont::features`"]
3003#[inline]
3004pub unsafe extern "C-unwind" fn CTFontCopyFeatures(font: &CTFont) -> Option<CFRetained<CFArray>> {
3005 extern "C-unwind" {
3006 fn CTFontCopyFeatures(font: &CTFont) -> Option<NonNull<CFArray>>;
3007 }
3008 let ret = unsafe { CTFontCopyFeatures(font) };
3009 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
3010}
3011
3012#[deprecated = "renamed to `CTFont::feature_settings`"]
3013#[inline]
3014pub unsafe extern "C-unwind" fn CTFontCopyFeatureSettings(
3015 font: &CTFont,
3016) -> Option<CFRetained<CFArray>> {
3017 extern "C-unwind" {
3018 fn CTFontCopyFeatureSettings(font: &CTFont) -> Option<NonNull<CFArray>>;
3019 }
3020 let ret = unsafe { CTFontCopyFeatureSettings(font) };
3021 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
3022}
3023
3024#[cfg(all(feature = "CTFontDescriptor", feature = "objc2-core-graphics"))]
3025#[deprecated = "renamed to `CTFont::graphics_font`"]
3026#[inline]
3027pub unsafe extern "C-unwind" fn CTFontCopyGraphicsFont(
3028 font: &CTFont,
3029 attributes: *mut *const CTFontDescriptor,
3030) -> CFRetained<CGFont> {
3031 extern "C-unwind" {
3032 fn CTFontCopyGraphicsFont(
3033 font: &CTFont,
3034 attributes: *mut *const CTFontDescriptor,
3035 ) -> Option<NonNull<CGFont>>;
3036 }
3037 let ret = unsafe { CTFontCopyGraphicsFont(font, attributes) };
3038 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
3039 unsafe { CFRetained::from_raw(ret) }
3040}
3041
3042#[cfg(all(feature = "CTFontDescriptor", feature = "objc2-core-graphics"))]
3043#[deprecated = "renamed to `CTFont::with_graphics_font`"]
3044#[inline]
3045pub unsafe extern "C-unwind" fn CTFontCreateWithGraphicsFont(
3046 graphics_font: &CGFont,
3047 size: CGFloat,
3048 matrix: *const CGAffineTransform,
3049 attributes: Option<&CTFontDescriptor>,
3050) -> CFRetained<CTFont> {
3051 extern "C-unwind" {
3052 fn CTFontCreateWithGraphicsFont(
3053 graphics_font: &CGFont,
3054 size: CGFloat,
3055 matrix: *const CGAffineTransform,
3056 attributes: Option<&CTFontDescriptor>,
3057 ) -> Option<NonNull<CTFont>>;
3058 }
3059 let ret = unsafe { CTFontCreateWithGraphicsFont(graphics_font, size, matrix, attributes) };
3060 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
3061 unsafe { CFRetained::from_raw(ret) }
3062}
3063
3064#[deprecated = "renamed to `CTFont::with_quickdraw_instance`"]
3065#[inline]
3066pub unsafe extern "C-unwind" fn CTFontCreateWithQuickdrawInstance(
3067 name: ConstStr255Param,
3068 identifier: i16,
3069 style: u8,
3070 size: CGFloat,
3071) -> CFRetained<CTFont> {
3072 extern "C-unwind" {
3073 fn CTFontCreateWithQuickdrawInstance(
3074 name: ConstStr255Param,
3075 identifier: i16,
3076 style: u8,
3077 size: CGFloat,
3078 ) -> Option<NonNull<CTFont>>;
3079 }
3080 let ret = unsafe { CTFontCreateWithQuickdrawInstance(name, identifier, style, size) };
3081 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
3082 unsafe { CFRetained::from_raw(ret) }
3083}
3084
3085#[deprecated = "renamed to `CTFont::available_tables`"]
3086#[inline]
3087pub unsafe extern "C-unwind" fn CTFontCopyAvailableTables(
3088 font: &CTFont,
3089 options: CTFontTableOptions,
3090) -> Option<CFRetained<CFArray>> {
3091 extern "C-unwind" {
3092 fn CTFontCopyAvailableTables(
3093 font: &CTFont,
3094 options: CTFontTableOptions,
3095 ) -> Option<NonNull<CFArray>>;
3096 }
3097 let ret = unsafe { CTFontCopyAvailableTables(font, options) };
3098 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
3099}
3100
3101extern "C-unwind" {
3102 #[deprecated = "renamed to `CTFont::has_table`"]
3103 pub fn CTFontHasTable(font: &CTFont, tag: CTFontTableTag) -> bool;
3104}
3105
3106#[deprecated = "renamed to `CTFont::table`"]
3107#[inline]
3108pub unsafe extern "C-unwind" fn CTFontCopyTable(
3109 font: &CTFont,
3110 table: CTFontTableTag,
3111 options: CTFontTableOptions,
3112) -> Option<CFRetained<CFData>> {
3113 extern "C-unwind" {
3114 fn CTFontCopyTable(
3115 font: &CTFont,
3116 table: CTFontTableTag,
3117 options: CTFontTableOptions,
3118 ) -> Option<NonNull<CFData>>;
3119 }
3120 let ret = unsafe { CTFontCopyTable(font, table, options) };
3121 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
3122}
3123
3124extern "C-unwind" {
3125 #[cfg(feature = "objc2-core-graphics")]
3126 #[deprecated = "renamed to `CTFont::draw_glyphs`"]
3127 pub fn CTFontDrawGlyphs(
3128 font: &CTFont,
3129 glyphs: NonNull<CGGlyph>,
3130 positions: NonNull<CGPoint>,
3131 count: usize,
3132 context: &CGContext,
3133 );
3134}
3135
3136extern "C-unwind" {
3137 #[cfg(feature = "objc2-core-graphics")]
3138 #[deprecated = "renamed to `CTFont::ligature_caret_positions`"]
3139 pub fn CTFontGetLigatureCaretPositions(
3140 font: &CTFont,
3141 glyph: CGGlyph,
3142 positions: *mut CGFloat,
3143 max_positions: CFIndex,
3144 ) -> CFIndex;
3145}
3146
3147extern "C-unwind" {
3148 #[cfg(all(feature = "CTRunDelegate", feature = "objc2"))]
3149 #[deprecated = "renamed to `CTFont::typographic_bounds_for_adaptive_image_provider`"]
3150 pub fn CTFontGetTypographicBoundsForAdaptiveImageProvider(
3151 font: &CTFont,
3152 provider: Option<&ProtocolObject<dyn CTAdaptiveImageProviding>>,
3153 ) -> CGRect;
3154}
3155
3156extern "C-unwind" {
3157 #[cfg(all(
3158 feature = "CTRunDelegate",
3159 feature = "objc2",
3160 feature = "objc2-core-graphics"
3161 ))]
3162 #[deprecated = "renamed to `CTFont::draw_image_from_adaptive_image_provider_at_point`"]
3163 pub fn CTFontDrawImageFromAdaptiveImageProviderAtPoint(
3164 font: &CTFont,
3165 provider: &ProtocolObject<dyn CTAdaptiveImageProviding>,
3166 point: CGPoint,
3167 context: &CGContext,
3168 );
3169}