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
22extern_conformance!(
23    unsafe impl NSCoding for UIFont {}
24);
25
26extern_conformance!(
27    unsafe impl NSCopying for UIFont {}
28);
29
30unsafe impl CopyingHelper for UIFont {
31    type Result = Self;
32}
33
34extern_conformance!(
35    unsafe impl NSObjectProtocol for UIFont {}
36);
37
38extern_conformance!(
39    unsafe impl NSSecureCoding for UIFont {}
40);
41
42impl UIFont {
43    extern_methods!(
44        #[cfg(feature = "UIFontDescriptor")]
45        #[unsafe(method(preferredFontForTextStyle:))]
46        #[unsafe(method_family = none)]
47        pub unsafe fn preferredFontForTextStyle(style: &UIFontTextStyle) -> Retained<UIFont>;
48
49        #[cfg(all(feature = "UIFontDescriptor", feature = "UITraitCollection"))]
50        #[unsafe(method(preferredFontForTextStyle:compatibleWithTraitCollection:))]
51        #[unsafe(method_family = none)]
52        pub unsafe fn preferredFontForTextStyle_compatibleWithTraitCollection(
53            style: &UIFontTextStyle,
54            trait_collection: Option<&UITraitCollection>,
55        ) -> Retained<UIFont>;
56
57        #[cfg(feature = "objc2-core-foundation")]
58        #[unsafe(method(fontWithName:size:))]
59        #[unsafe(method_family = none)]
60        pub unsafe fn fontWithName_size(
61            font_name: &NSString,
62            font_size: CGFloat,
63        ) -> Option<Retained<UIFont>>;
64
65        #[unsafe(method(familyNames))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn familyNames() -> Retained<NSArray<NSString>>;
68
69        #[unsafe(method(fontNamesForFamilyName:))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn fontNamesForFamilyName(family_name: &NSString)
72            -> Retained<NSArray<NSString>>;
73
74        #[cfg(feature = "objc2-core-foundation")]
75        #[unsafe(method(systemFontOfSize:))]
76        #[unsafe(method_family = none)]
77        pub unsafe fn systemFontOfSize(font_size: CGFloat) -> Retained<UIFont>;
78
79        #[cfg(feature = "objc2-core-foundation")]
80        #[unsafe(method(boldSystemFontOfSize:))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn boldSystemFontOfSize(font_size: CGFloat) -> Retained<UIFont>;
83
84        #[cfg(feature = "objc2-core-foundation")]
85        #[unsafe(method(italicSystemFontOfSize:))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn italicSystemFontOfSize(font_size: CGFloat) -> Retained<UIFont>;
88
89        #[cfg(all(feature = "UIFontDescriptor", feature = "objc2-core-foundation"))]
90        #[unsafe(method(systemFontOfSize:weight:))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn systemFontOfSize_weight(
93            font_size: CGFloat,
94            weight: UIFontWeight,
95        ) -> Retained<UIFont>;
96
97        #[cfg(all(feature = "UIFontDescriptor", feature = "objc2-core-foundation"))]
98        #[unsafe(method(monospacedDigitSystemFontOfSize:weight:))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn monospacedDigitSystemFontOfSize_weight(
101            font_size: CGFloat,
102            weight: UIFontWeight,
103        ) -> Retained<UIFont>;
104
105        #[cfg(all(feature = "UIFontDescriptor", feature = "objc2-core-foundation"))]
106        #[unsafe(method(systemFontOfSize:weight:width:))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn systemFontOfSize_weight_width(
109            font_size: CGFloat,
110            weight: UIFontWeight,
111            width: UIFontWidth,
112        ) -> Retained<UIFont>;
113
114        #[cfg(all(feature = "UIFontDescriptor", feature = "objc2-core-foundation"))]
115        #[unsafe(method(monospacedSystemFontOfSize:weight:))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn monospacedSystemFontOfSize_weight(
118            font_size: CGFloat,
119            weight: UIFontWeight,
120        ) -> Retained<UIFont>;
121
122        #[unsafe(method(familyName))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn familyName(&self) -> Retained<NSString>;
125
126        #[unsafe(method(fontName))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn fontName(&self) -> Retained<NSString>;
129
130        #[cfg(feature = "objc2-core-foundation")]
131        #[unsafe(method(pointSize))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn pointSize(&self) -> CGFloat;
134
135        #[cfg(feature = "objc2-core-foundation")]
136        #[unsafe(method(ascender))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn ascender(&self) -> CGFloat;
139
140        #[cfg(feature = "objc2-core-foundation")]
141        #[unsafe(method(descender))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn descender(&self) -> CGFloat;
144
145        #[cfg(feature = "objc2-core-foundation")]
146        #[unsafe(method(capHeight))]
147        #[unsafe(method_family = none)]
148        pub unsafe fn capHeight(&self) -> CGFloat;
149
150        #[cfg(feature = "objc2-core-foundation")]
151        #[unsafe(method(xHeight))]
152        #[unsafe(method_family = none)]
153        pub unsafe fn xHeight(&self) -> CGFloat;
154
155        #[cfg(feature = "objc2-core-foundation")]
156        #[unsafe(method(lineHeight))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn lineHeight(&self) -> CGFloat;
159
160        #[cfg(feature = "objc2-core-foundation")]
161        #[unsafe(method(leading))]
162        #[unsafe(method_family = none)]
163        pub unsafe fn leading(&self) -> CGFloat;
164
165        #[cfg(feature = "objc2-core-foundation")]
166        #[unsafe(method(fontWithSize:))]
167        #[unsafe(method_family = none)]
168        pub unsafe fn fontWithSize(&self, font_size: CGFloat) -> Retained<UIFont>;
169
170        #[cfg(all(feature = "UIFontDescriptor", feature = "objc2-core-foundation"))]
171        #[unsafe(method(fontWithDescriptor:size:))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn fontWithDescriptor_size(
174            descriptor: &UIFontDescriptor,
175            point_size: CGFloat,
176        ) -> Retained<UIFont>;
177
178        #[cfg(feature = "UIFontDescriptor")]
179        #[unsafe(method(fontDescriptor))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn fontDescriptor(&self) -> Retained<UIFontDescriptor>;
182    );
183}
184
185/// Methods declared on superclass `NSObject`.
186impl UIFont {
187    extern_methods!(
188        #[unsafe(method(init))]
189        #[unsafe(method_family = init)]
190        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
191
192        #[unsafe(method(new))]
193        #[unsafe(method_family = new)]
194        pub unsafe fn new() -> Retained<Self>;
195    );
196}