objc2_ui_kit/generated/
UIFont.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5#[cfg(feature = "objc2-core-foundation")]
6use objc2_core_foundation::*;
7use objc2_foundation::*;
8
9use crate::*;
10
11extern_class!(
12    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uifont?language=objc)
13    #[unsafe(super(NSObject))]
14    #[derive(Debug, PartialEq, Eq, Hash)]
15    pub struct UIFont;
16);
17
18unsafe impl Send for UIFont {}
19
20unsafe impl Sync for UIFont {}
21
22unsafe impl NSCoding for UIFont {}
23
24unsafe impl NSCopying for UIFont {}
25
26unsafe impl CopyingHelper for UIFont {
27    type Result = Self;
28}
29
30unsafe impl NSObjectProtocol for UIFont {}
31
32unsafe impl NSSecureCoding for UIFont {}
33
34impl UIFont {
35    extern_methods!(
36        #[cfg(feature = "UIFontDescriptor")]
37        #[unsafe(method(preferredFontForTextStyle:))]
38        #[unsafe(method_family = none)]
39        pub unsafe fn preferredFontForTextStyle(style: &UIFontTextStyle) -> Retained<UIFont>;
40
41        #[cfg(all(feature = "UIFontDescriptor", feature = "UITraitCollection"))]
42        #[unsafe(method(preferredFontForTextStyle:compatibleWithTraitCollection:))]
43        #[unsafe(method_family = none)]
44        pub unsafe fn preferredFontForTextStyle_compatibleWithTraitCollection(
45            style: &UIFontTextStyle,
46            trait_collection: Option<&UITraitCollection>,
47        ) -> Retained<UIFont>;
48
49        #[cfg(feature = "objc2-core-foundation")]
50        #[unsafe(method(fontWithName:size:))]
51        #[unsafe(method_family = none)]
52        pub unsafe fn fontWithName_size(
53            font_name: &NSString,
54            font_size: CGFloat,
55        ) -> Option<Retained<UIFont>>;
56
57        #[unsafe(method(familyNames))]
58        #[unsafe(method_family = none)]
59        pub unsafe fn familyNames() -> Retained<NSArray<NSString>>;
60
61        #[unsafe(method(fontNamesForFamilyName:))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn fontNamesForFamilyName(family_name: &NSString)
64            -> Retained<NSArray<NSString>>;
65
66        #[cfg(feature = "objc2-core-foundation")]
67        #[unsafe(method(systemFontOfSize:))]
68        #[unsafe(method_family = none)]
69        pub unsafe fn systemFontOfSize(font_size: CGFloat) -> Retained<UIFont>;
70
71        #[cfg(feature = "objc2-core-foundation")]
72        #[unsafe(method(boldSystemFontOfSize:))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn boldSystemFontOfSize(font_size: CGFloat) -> Retained<UIFont>;
75
76        #[cfg(feature = "objc2-core-foundation")]
77        #[unsafe(method(italicSystemFontOfSize:))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn italicSystemFontOfSize(font_size: CGFloat) -> Retained<UIFont>;
80
81        #[cfg(all(feature = "UIFontDescriptor", feature = "objc2-core-foundation"))]
82        #[unsafe(method(systemFontOfSize:weight:))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn systemFontOfSize_weight(
85            font_size: CGFloat,
86            weight: UIFontWeight,
87        ) -> Retained<UIFont>;
88
89        #[cfg(all(feature = "UIFontDescriptor", feature = "objc2-core-foundation"))]
90        #[unsafe(method(monospacedDigitSystemFontOfSize:weight:))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn monospacedDigitSystemFontOfSize_weight(
93            font_size: CGFloat,
94            weight: UIFontWeight,
95        ) -> Retained<UIFont>;
96
97        #[cfg(all(feature = "UIFontDescriptor", feature = "objc2-core-foundation"))]
98        #[unsafe(method(systemFontOfSize:weight:width:))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn systemFontOfSize_weight_width(
101            font_size: CGFloat,
102            weight: UIFontWeight,
103            width: UIFontWidth,
104        ) -> Retained<UIFont>;
105
106        #[cfg(all(feature = "UIFontDescriptor", feature = "objc2-core-foundation"))]
107        #[unsafe(method(monospacedSystemFontOfSize:weight:))]
108        #[unsafe(method_family = none)]
109        pub unsafe fn monospacedSystemFontOfSize_weight(
110            font_size: CGFloat,
111            weight: UIFontWeight,
112        ) -> Retained<UIFont>;
113
114        #[unsafe(method(familyName))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn familyName(&self) -> Retained<NSString>;
117
118        #[unsafe(method(fontName))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn fontName(&self) -> Retained<NSString>;
121
122        #[cfg(feature = "objc2-core-foundation")]
123        #[unsafe(method(pointSize))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn pointSize(&self) -> CGFloat;
126
127        #[cfg(feature = "objc2-core-foundation")]
128        #[unsafe(method(ascender))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn ascender(&self) -> CGFloat;
131
132        #[cfg(feature = "objc2-core-foundation")]
133        #[unsafe(method(descender))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn descender(&self) -> CGFloat;
136
137        #[cfg(feature = "objc2-core-foundation")]
138        #[unsafe(method(capHeight))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn capHeight(&self) -> CGFloat;
141
142        #[cfg(feature = "objc2-core-foundation")]
143        #[unsafe(method(xHeight))]
144        #[unsafe(method_family = none)]
145        pub unsafe fn xHeight(&self) -> CGFloat;
146
147        #[cfg(feature = "objc2-core-foundation")]
148        #[unsafe(method(lineHeight))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn lineHeight(&self) -> CGFloat;
151
152        #[cfg(feature = "objc2-core-foundation")]
153        #[unsafe(method(leading))]
154        #[unsafe(method_family = none)]
155        pub unsafe fn leading(&self) -> CGFloat;
156
157        #[cfg(feature = "objc2-core-foundation")]
158        #[unsafe(method(fontWithSize:))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn fontWithSize(&self, font_size: CGFloat) -> Retained<UIFont>;
161
162        #[cfg(all(feature = "UIFontDescriptor", feature = "objc2-core-foundation"))]
163        #[unsafe(method(fontWithDescriptor:size:))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn fontWithDescriptor_size(
166            descriptor: &UIFontDescriptor,
167            point_size: CGFloat,
168        ) -> Retained<UIFont>;
169
170        #[cfg(feature = "UIFontDescriptor")]
171        #[unsafe(method(fontDescriptor))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn fontDescriptor(&self) -> Retained<UIFontDescriptor>;
174    );
175}
176
177/// Methods declared on superclass `NSObject`.
178impl UIFont {
179    extern_methods!(
180        #[unsafe(method(init))]
181        #[unsafe(method_family = init)]
182        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
183
184        #[unsafe(method(new))]
185        #[unsafe(method_family = new)]
186        pub unsafe fn new() -> Retained<Self>;
187    );
188}