objc2_ui_kit/generated/
UIFontDescriptor.rs1use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5#[cfg(feature = "objc2-core-foundation")]
6use objc2_core_foundation::*;
7use objc2_foundation::*;
8
9use crate::*;
10
11#[repr(transparent)]
14#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
15pub struct UIFontDescriptorSymbolicTraits(pub u32);
16bitflags::bitflags! {
17 impl UIFontDescriptorSymbolicTraits: u32 {
18 #[doc(alias = "UIFontDescriptorTraitItalic")]
19 const TraitItalic = 1<<0;
20 #[doc(alias = "UIFontDescriptorTraitBold")]
21 const TraitBold = 1<<1;
22 #[doc(alias = "UIFontDescriptorTraitExpanded")]
23 const TraitExpanded = 1<<5;
24 #[doc(alias = "UIFontDescriptorTraitCondensed")]
25 const TraitCondensed = 1<<6;
26 #[doc(alias = "UIFontDescriptorTraitMonoSpace")]
27 const TraitMonoSpace = 1<<10;
28 #[doc(alias = "UIFontDescriptorTraitVertical")]
29 const TraitVertical = 1<<11;
30 #[doc(alias = "UIFontDescriptorTraitUIOptimized")]
31 const TraitUIOptimized = 1<<12;
32 #[doc(alias = "UIFontDescriptorTraitTightLeading")]
33 const TraitTightLeading = 1<<15;
34 #[doc(alias = "UIFontDescriptorTraitLooseLeading")]
35 const TraitLooseLeading = 1<<16;
36 #[doc(alias = "UIFontDescriptorClassMask")]
37 const ClassMask = 0xF0000000;
38 #[doc(alias = "UIFontDescriptorClassUnknown")]
39 const ClassUnknown = 0<<28;
40 #[doc(alias = "UIFontDescriptorClassOldStyleSerifs")]
41 const ClassOldStyleSerifs = 1<<28;
42 #[doc(alias = "UIFontDescriptorClassTransitionalSerifs")]
43 const ClassTransitionalSerifs = 2<<28;
44 #[doc(alias = "UIFontDescriptorClassModernSerifs")]
45 const ClassModernSerifs = 3<<28;
46 #[doc(alias = "UIFontDescriptorClassClarendonSerifs")]
47 const ClassClarendonSerifs = 4<<28;
48 #[doc(alias = "UIFontDescriptorClassSlabSerifs")]
49 const ClassSlabSerifs = 5<<28;
50 #[doc(alias = "UIFontDescriptorClassFreeformSerifs")]
51 const ClassFreeformSerifs = 7<<28;
52 #[doc(alias = "UIFontDescriptorClassSansSerif")]
53 const ClassSansSerif = 8<<28;
54 #[doc(alias = "UIFontDescriptorClassOrnamentals")]
55 const ClassOrnamentals = 9<<28;
56 #[doc(alias = "UIFontDescriptorClassScripts")]
57 const ClassScripts = 10<<28;
58 #[doc(alias = "UIFontDescriptorClassSymbolic")]
59 const ClassSymbolic = 12<<28;
60 }
61}
62
63unsafe impl Encode for UIFontDescriptorSymbolicTraits {
64 const ENCODING: Encoding = u32::ENCODING;
65}
66
67unsafe impl RefEncode for UIFontDescriptorSymbolicTraits {
68 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
69}
70
71pub type UIFontDescriptorClass = NSUInteger;
73
74pub type UIFontTextStyle = NSString;
77
78pub type UIFontDescriptorAttributeName = NSString;
81
82pub type UIFontDescriptorTraitKey = NSString;
85
86pub type UIFontDescriptorFeatureKey = NSString;
89
90#[cfg(feature = "objc2-core-foundation")]
93pub type UIFontWeight = CGFloat;
94
95#[cfg(feature = "objc2-core-foundation")]
98pub type UIFontWidth = CGFloat;
99
100pub type UIFontDescriptorSystemDesign = NSString;
103
104extern "C" {
105 pub static UIFontDescriptorSystemDesignDefault: &'static UIFontDescriptorSystemDesign;
107}
108
109extern "C" {
110 pub static UIFontDescriptorSystemDesignRounded: &'static UIFontDescriptorSystemDesign;
112}
113
114extern "C" {
115 pub static UIFontDescriptorSystemDesignSerif: &'static UIFontDescriptorSystemDesign;
117}
118
119extern "C" {
120 pub static UIFontDescriptorSystemDesignMonospaced: &'static UIFontDescriptorSystemDesign;
122}
123
124extern_class!(
125 #[unsafe(super(NSObject))]
127 #[derive(Debug, PartialEq, Eq, Hash)]
128 pub struct UIFontDescriptor;
129);
130
131unsafe impl Send for UIFontDescriptor {}
132
133unsafe impl Sync for UIFontDescriptor {}
134
135unsafe impl NSCoding for UIFontDescriptor {}
136
137unsafe impl NSCopying for UIFontDescriptor {}
138
139unsafe impl CopyingHelper for UIFontDescriptor {
140 type Result = Self;
141}
142
143unsafe impl NSObjectProtocol for UIFontDescriptor {}
144
145unsafe impl NSSecureCoding for UIFontDescriptor {}
146
147impl UIFontDescriptor {
148 extern_methods!(
149 #[unsafe(method(init))]
150 #[unsafe(method_family = init)]
151 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
152
153 #[unsafe(method(initWithCoder:))]
154 #[unsafe(method_family = init)]
155 pub unsafe fn initWithCoder(
156 this: Allocated<Self>,
157 coder: &NSCoder,
158 ) -> Option<Retained<Self>>;
159
160 #[unsafe(method(postscriptName))]
161 #[unsafe(method_family = none)]
162 pub unsafe fn postscriptName(&self) -> Retained<NSString>;
163
164 #[cfg(feature = "objc2-core-foundation")]
165 #[unsafe(method(pointSize))]
166 #[unsafe(method_family = none)]
167 pub unsafe fn pointSize(&self) -> CGFloat;
168
169 #[cfg(feature = "objc2-core-foundation")]
170 #[unsafe(method(matrix))]
171 #[unsafe(method_family = none)]
172 pub unsafe fn matrix(&self) -> CGAffineTransform;
173
174 #[unsafe(method(symbolicTraits))]
175 #[unsafe(method_family = none)]
176 pub unsafe fn symbolicTraits(&self) -> UIFontDescriptorSymbolicTraits;
177
178 #[unsafe(method(objectForKey:))]
179 #[unsafe(method_family = none)]
180 pub unsafe fn objectForKey(
181 &self,
182 an_attribute: &UIFontDescriptorAttributeName,
183 ) -> Option<Retained<AnyObject>>;
184
185 #[unsafe(method(fontAttributes))]
186 #[unsafe(method_family = none)]
187 pub unsafe fn fontAttributes(
188 &self,
189 ) -> Retained<NSDictionary<UIFontDescriptorAttributeName, AnyObject>>;
190
191 #[unsafe(method(matchingFontDescriptorsWithMandatoryKeys:))]
192 #[unsafe(method_family = none)]
193 pub unsafe fn matchingFontDescriptorsWithMandatoryKeys(
194 &self,
195 mandatory_keys: Option<&NSSet<UIFontDescriptorAttributeName>>,
196 ) -> Retained<NSArray<UIFontDescriptor>>;
197
198 #[unsafe(method(fontDescriptorWithFontAttributes:))]
199 #[unsafe(method_family = none)]
200 pub unsafe fn fontDescriptorWithFontAttributes(
201 attributes: &NSDictionary<UIFontDescriptorAttributeName, AnyObject>,
202 ) -> Retained<UIFontDescriptor>;
203
204 #[cfg(feature = "objc2-core-foundation")]
205 #[unsafe(method(fontDescriptorWithName:size:))]
206 #[unsafe(method_family = none)]
207 pub unsafe fn fontDescriptorWithName_size(
208 font_name: &NSString,
209 size: CGFloat,
210 ) -> Retained<UIFontDescriptor>;
211
212 #[cfg(feature = "objc2-core-foundation")]
213 #[unsafe(method(fontDescriptorWithName:matrix:))]
214 #[unsafe(method_family = none)]
215 pub unsafe fn fontDescriptorWithName_matrix(
216 font_name: &NSString,
217 matrix: CGAffineTransform,
218 ) -> Retained<UIFontDescriptor>;
219
220 #[unsafe(method(preferredFontDescriptorWithTextStyle:))]
221 #[unsafe(method_family = none)]
222 pub unsafe fn preferredFontDescriptorWithTextStyle(
223 style: &UIFontTextStyle,
224 ) -> Retained<UIFontDescriptor>;
225
226 #[cfg(feature = "UITraitCollection")]
227 #[unsafe(method(preferredFontDescriptorWithTextStyle:compatibleWithTraitCollection:))]
228 #[unsafe(method_family = none)]
229 pub unsafe fn preferredFontDescriptorWithTextStyle_compatibleWithTraitCollection(
230 style: &UIFontTextStyle,
231 trait_collection: Option<&UITraitCollection>,
232 ) -> Retained<UIFontDescriptor>;
233
234 #[unsafe(method(initWithFontAttributes:))]
235 #[unsafe(method_family = init)]
236 pub unsafe fn initWithFontAttributes(
237 this: Allocated<Self>,
238 attributes: &NSDictionary<UIFontDescriptorAttributeName, AnyObject>,
239 ) -> Retained<Self>;
240
241 #[unsafe(method(fontDescriptorByAddingAttributes:))]
242 #[unsafe(method_family = none)]
243 pub unsafe fn fontDescriptorByAddingAttributes(
244 &self,
245 attributes: &NSDictionary<UIFontDescriptorAttributeName, AnyObject>,
246 ) -> Retained<UIFontDescriptor>;
247
248 #[cfg(feature = "objc2-core-foundation")]
249 #[unsafe(method(fontDescriptorWithSize:))]
250 #[unsafe(method_family = none)]
251 pub unsafe fn fontDescriptorWithSize(
252 &self,
253 new_point_size: CGFloat,
254 ) -> Retained<UIFontDescriptor>;
255
256 #[cfg(feature = "objc2-core-foundation")]
257 #[unsafe(method(fontDescriptorWithMatrix:))]
258 #[unsafe(method_family = none)]
259 pub unsafe fn fontDescriptorWithMatrix(
260 &self,
261 matrix: CGAffineTransform,
262 ) -> Retained<UIFontDescriptor>;
263
264 #[unsafe(method(fontDescriptorWithFace:))]
265 #[unsafe(method_family = none)]
266 pub unsafe fn fontDescriptorWithFace(
267 &self,
268 new_face: &NSString,
269 ) -> Retained<UIFontDescriptor>;
270
271 #[unsafe(method(fontDescriptorWithFamily:))]
272 #[unsafe(method_family = none)]
273 pub unsafe fn fontDescriptorWithFamily(
274 &self,
275 new_family: &NSString,
276 ) -> Retained<UIFontDescriptor>;
277
278 #[unsafe(method(fontDescriptorWithSymbolicTraits:))]
279 #[unsafe(method_family = none)]
280 pub unsafe fn fontDescriptorWithSymbolicTraits(
281 &self,
282 symbolic_traits: UIFontDescriptorSymbolicTraits,
283 ) -> Option<Retained<UIFontDescriptor>>;
284
285 #[unsafe(method(fontDescriptorWithDesign:))]
286 #[unsafe(method_family = none)]
287 pub unsafe fn fontDescriptorWithDesign(
288 &self,
289 design: &UIFontDescriptorSystemDesign,
290 ) -> Option<Retained<UIFontDescriptor>>;
291 );
292}
293
294impl UIFontDescriptor {
296 extern_methods!(
297 #[unsafe(method(new))]
298 #[unsafe(method_family = new)]
299 pub unsafe fn new() -> Retained<Self>;
300 );
301}
302
303extern "C" {
304 pub static UIFontDescriptorFamilyAttribute: &'static UIFontDescriptorAttributeName;
306}
307
308extern "C" {
309 pub static UIFontDescriptorNameAttribute: &'static UIFontDescriptorAttributeName;
311}
312
313extern "C" {
314 pub static UIFontDescriptorFaceAttribute: &'static UIFontDescriptorAttributeName;
316}
317
318extern "C" {
319 pub static UIFontDescriptorSizeAttribute: &'static UIFontDescriptorAttributeName;
321}
322
323extern "C" {
324 pub static UIFontDescriptorVisibleNameAttribute: &'static UIFontDescriptorAttributeName;
326}
327
328extern "C" {
329 pub static UIFontDescriptorMatrixAttribute: &'static UIFontDescriptorAttributeName;
331}
332
333extern "C" {
334 pub static UIFontDescriptorCharacterSetAttribute: &'static UIFontDescriptorAttributeName;
336}
337
338extern "C" {
339 pub static UIFontDescriptorCascadeListAttribute: &'static UIFontDescriptorAttributeName;
341}
342
343extern "C" {
344 pub static UIFontDescriptorTraitsAttribute: &'static UIFontDescriptorAttributeName;
346}
347
348extern "C" {
349 pub static UIFontDescriptorFixedAdvanceAttribute: &'static UIFontDescriptorAttributeName;
351}
352
353extern "C" {
354 pub static UIFontDescriptorFeatureSettingsAttribute: &'static UIFontDescriptorAttributeName;
356}
357
358extern "C" {
359 pub static UIFontDescriptorTextStyleAttribute: &'static UIFontDescriptorAttributeName;
361}
362
363extern "C" {
364 pub static UIFontSymbolicTrait: &'static UIFontDescriptorTraitKey;
366}
367
368extern "C" {
369 pub static UIFontWeightTrait: &'static UIFontDescriptorTraitKey;
371}
372
373extern "C" {
374 pub static UIFontWidthTrait: &'static UIFontDescriptorTraitKey;
376}
377
378extern "C" {
379 pub static UIFontSlantTrait: &'static UIFontDescriptorTraitKey;
381}
382
383extern "C" {
384 #[cfg(feature = "objc2-core-foundation")]
386 pub static UIFontWeightUltraLight: UIFontWeight;
387}
388
389extern "C" {
390 #[cfg(feature = "objc2-core-foundation")]
392 pub static UIFontWeightThin: UIFontWeight;
393}
394
395extern "C" {
396 #[cfg(feature = "objc2-core-foundation")]
398 pub static UIFontWeightLight: UIFontWeight;
399}
400
401extern "C" {
402 #[cfg(feature = "objc2-core-foundation")]
404 pub static UIFontWeightRegular: UIFontWeight;
405}
406
407extern "C" {
408 #[cfg(feature = "objc2-core-foundation")]
410 pub static UIFontWeightMedium: UIFontWeight;
411}
412
413extern "C" {
414 #[cfg(feature = "objc2-core-foundation")]
416 pub static UIFontWeightSemibold: UIFontWeight;
417}
418
419extern "C" {
420 #[cfg(feature = "objc2-core-foundation")]
422 pub static UIFontWeightBold: UIFontWeight;
423}
424
425extern "C" {
426 #[cfg(feature = "objc2-core-foundation")]
428 pub static UIFontWeightHeavy: UIFontWeight;
429}
430
431extern "C" {
432 #[cfg(feature = "objc2-core-foundation")]
434 pub static UIFontWeightBlack: UIFontWeight;
435}
436
437extern "C" {
438 #[cfg(feature = "objc2-core-foundation")]
440 pub static UIFontWidthCondensed: UIFontWidth;
441}
442
443extern "C" {
444 #[cfg(feature = "objc2-core-foundation")]
446 pub static UIFontWidthStandard: UIFontWidth;
447}
448
449extern "C" {
450 #[cfg(feature = "objc2-core-foundation")]
452 pub static UIFontWidthExpanded: UIFontWidth;
453}
454
455extern "C" {
456 #[cfg(feature = "objc2-core-foundation")]
458 pub static UIFontWidthCompressed: UIFontWidth;
459}
460
461extern "C" {
462 pub static UIFontFeatureTypeIdentifierKey: &'static UIFontDescriptorFeatureKey;
464}
465
466extern "C" {
467 pub static UIFontFeatureSelectorIdentifierKey: &'static UIFontDescriptorFeatureKey;
469}
470
471extern "C" {
472 pub static UIFontTextStyleLargeTitle: &'static UIFontTextStyle;
474}
475
476extern "C" {
477 pub static UIFontTextStyleExtraLargeTitle: &'static UIFontTextStyle;
479}
480
481extern "C" {
482 pub static UIFontTextStyleExtraLargeTitle2: &'static UIFontTextStyle;
484}
485
486extern "C" {
487 pub static UIFontTextStyleTitle1: &'static UIFontTextStyle;
489}
490
491extern "C" {
492 pub static UIFontTextStyleTitle2: &'static UIFontTextStyle;
494}
495
496extern "C" {
497 pub static UIFontTextStyleTitle3: &'static UIFontTextStyle;
499}
500
501extern "C" {
502 pub static UIFontTextStyleHeadline: &'static UIFontTextStyle;
504}
505
506extern "C" {
507 pub static UIFontTextStyleSubheadline: &'static UIFontTextStyle;
509}
510
511extern "C" {
512 pub static UIFontTextStyleBody: &'static UIFontTextStyle;
514}
515
516extern "C" {
517 pub static UIFontTextStyleCallout: &'static UIFontTextStyle;
519}
520
521extern "C" {
522 pub static UIFontTextStyleFootnote: &'static UIFontTextStyle;
524}
525
526extern "C" {
527 pub static UIFontTextStyleCaption1: &'static UIFontTextStyle;
529}
530
531extern "C" {
532 pub static UIFontTextStyleCaption2: &'static UIFontTextStyle;
534}