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
135extern_conformance!(
136 unsafe impl NSCoding for UIFontDescriptor {}
137);
138
139extern_conformance!(
140 unsafe impl NSCopying for UIFontDescriptor {}
141);
142
143unsafe impl CopyingHelper for UIFontDescriptor {
144 type Result = Self;
145}
146
147extern_conformance!(
148 unsafe impl NSObjectProtocol for UIFontDescriptor {}
149);
150
151extern_conformance!(
152 unsafe impl NSSecureCoding for UIFontDescriptor {}
153);
154
155impl UIFontDescriptor {
156 extern_methods!(
157 #[unsafe(method(init))]
158 #[unsafe(method_family = init)]
159 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
160
161 #[unsafe(method(initWithCoder:))]
162 #[unsafe(method_family = init)]
163 pub unsafe fn initWithCoder(
164 this: Allocated<Self>,
165 coder: &NSCoder,
166 ) -> Option<Retained<Self>>;
167
168 #[unsafe(method(postscriptName))]
169 #[unsafe(method_family = none)]
170 pub unsafe fn postscriptName(&self) -> Retained<NSString>;
171
172 #[cfg(feature = "objc2-core-foundation")]
173 #[unsafe(method(pointSize))]
174 #[unsafe(method_family = none)]
175 pub unsafe fn pointSize(&self) -> CGFloat;
176
177 #[cfg(feature = "objc2-core-foundation")]
178 #[unsafe(method(matrix))]
179 #[unsafe(method_family = none)]
180 pub unsafe fn matrix(&self) -> CGAffineTransform;
181
182 #[unsafe(method(symbolicTraits))]
183 #[unsafe(method_family = none)]
184 pub unsafe fn symbolicTraits(&self) -> UIFontDescriptorSymbolicTraits;
185
186 #[unsafe(method(objectForKey:))]
187 #[unsafe(method_family = none)]
188 pub unsafe fn objectForKey(
189 &self,
190 an_attribute: &UIFontDescriptorAttributeName,
191 ) -> Option<Retained<AnyObject>>;
192
193 #[unsafe(method(fontAttributes))]
194 #[unsafe(method_family = none)]
195 pub unsafe fn fontAttributes(
196 &self,
197 ) -> Retained<NSDictionary<UIFontDescriptorAttributeName, AnyObject>>;
198
199 #[unsafe(method(matchingFontDescriptorsWithMandatoryKeys:))]
200 #[unsafe(method_family = none)]
201 pub unsafe fn matchingFontDescriptorsWithMandatoryKeys(
202 &self,
203 mandatory_keys: Option<&NSSet<UIFontDescriptorAttributeName>>,
204 ) -> Retained<NSArray<UIFontDescriptor>>;
205
206 #[unsafe(method(fontDescriptorWithFontAttributes:))]
207 #[unsafe(method_family = none)]
208 pub unsafe fn fontDescriptorWithFontAttributes(
209 attributes: &NSDictionary<UIFontDescriptorAttributeName, AnyObject>,
210 ) -> Retained<UIFontDescriptor>;
211
212 #[cfg(feature = "objc2-core-foundation")]
213 #[unsafe(method(fontDescriptorWithName:size:))]
214 #[unsafe(method_family = none)]
215 pub unsafe fn fontDescriptorWithName_size(
216 font_name: &NSString,
217 size: CGFloat,
218 ) -> Retained<UIFontDescriptor>;
219
220 #[cfg(feature = "objc2-core-foundation")]
221 #[unsafe(method(fontDescriptorWithName:matrix:))]
222 #[unsafe(method_family = none)]
223 pub unsafe fn fontDescriptorWithName_matrix(
224 font_name: &NSString,
225 matrix: CGAffineTransform,
226 ) -> Retained<UIFontDescriptor>;
227
228 #[unsafe(method(preferredFontDescriptorWithTextStyle:))]
229 #[unsafe(method_family = none)]
230 pub unsafe fn preferredFontDescriptorWithTextStyle(
231 style: &UIFontTextStyle,
232 ) -> Retained<UIFontDescriptor>;
233
234 #[cfg(feature = "UITraitCollection")]
235 #[unsafe(method(preferredFontDescriptorWithTextStyle:compatibleWithTraitCollection:))]
236 #[unsafe(method_family = none)]
237 pub unsafe fn preferredFontDescriptorWithTextStyle_compatibleWithTraitCollection(
238 style: &UIFontTextStyle,
239 trait_collection: Option<&UITraitCollection>,
240 ) -> Retained<UIFontDescriptor>;
241
242 #[unsafe(method(initWithFontAttributes:))]
243 #[unsafe(method_family = init)]
244 pub unsafe fn initWithFontAttributes(
245 this: Allocated<Self>,
246 attributes: &NSDictionary<UIFontDescriptorAttributeName, AnyObject>,
247 ) -> Retained<Self>;
248
249 #[unsafe(method(fontDescriptorByAddingAttributes:))]
250 #[unsafe(method_family = none)]
251 pub unsafe fn fontDescriptorByAddingAttributes(
252 &self,
253 attributes: &NSDictionary<UIFontDescriptorAttributeName, AnyObject>,
254 ) -> Retained<UIFontDescriptor>;
255
256 #[cfg(feature = "objc2-core-foundation")]
257 #[unsafe(method(fontDescriptorWithSize:))]
258 #[unsafe(method_family = none)]
259 pub unsafe fn fontDescriptorWithSize(
260 &self,
261 new_point_size: CGFloat,
262 ) -> Retained<UIFontDescriptor>;
263
264 #[cfg(feature = "objc2-core-foundation")]
265 #[unsafe(method(fontDescriptorWithMatrix:))]
266 #[unsafe(method_family = none)]
267 pub unsafe fn fontDescriptorWithMatrix(
268 &self,
269 matrix: CGAffineTransform,
270 ) -> Retained<UIFontDescriptor>;
271
272 #[unsafe(method(fontDescriptorWithFace:))]
273 #[unsafe(method_family = none)]
274 pub unsafe fn fontDescriptorWithFace(
275 &self,
276 new_face: &NSString,
277 ) -> Retained<UIFontDescriptor>;
278
279 #[unsafe(method(fontDescriptorWithFamily:))]
280 #[unsafe(method_family = none)]
281 pub unsafe fn fontDescriptorWithFamily(
282 &self,
283 new_family: &NSString,
284 ) -> Retained<UIFontDescriptor>;
285
286 #[unsafe(method(fontDescriptorWithSymbolicTraits:))]
287 #[unsafe(method_family = none)]
288 pub unsafe fn fontDescriptorWithSymbolicTraits(
289 &self,
290 symbolic_traits: UIFontDescriptorSymbolicTraits,
291 ) -> Option<Retained<UIFontDescriptor>>;
292
293 #[unsafe(method(fontDescriptorWithDesign:))]
294 #[unsafe(method_family = none)]
295 pub unsafe fn fontDescriptorWithDesign(
296 &self,
297 design: &UIFontDescriptorSystemDesign,
298 ) -> Option<Retained<UIFontDescriptor>>;
299 );
300}
301
302impl UIFontDescriptor {
304 extern_methods!(
305 #[unsafe(method(new))]
306 #[unsafe(method_family = new)]
307 pub unsafe fn new() -> Retained<Self>;
308 );
309}
310
311extern "C" {
312 pub static UIFontDescriptorFamilyAttribute: &'static UIFontDescriptorAttributeName;
314}
315
316extern "C" {
317 pub static UIFontDescriptorNameAttribute: &'static UIFontDescriptorAttributeName;
319}
320
321extern "C" {
322 pub static UIFontDescriptorFaceAttribute: &'static UIFontDescriptorAttributeName;
324}
325
326extern "C" {
327 pub static UIFontDescriptorSizeAttribute: &'static UIFontDescriptorAttributeName;
329}
330
331extern "C" {
332 pub static UIFontDescriptorVisibleNameAttribute: &'static UIFontDescriptorAttributeName;
334}
335
336extern "C" {
337 pub static UIFontDescriptorMatrixAttribute: &'static UIFontDescriptorAttributeName;
339}
340
341extern "C" {
342 pub static UIFontDescriptorCharacterSetAttribute: &'static UIFontDescriptorAttributeName;
344}
345
346extern "C" {
347 pub static UIFontDescriptorCascadeListAttribute: &'static UIFontDescriptorAttributeName;
349}
350
351extern "C" {
352 pub static UIFontDescriptorTraitsAttribute: &'static UIFontDescriptorAttributeName;
354}
355
356extern "C" {
357 pub static UIFontDescriptorFixedAdvanceAttribute: &'static UIFontDescriptorAttributeName;
359}
360
361extern "C" {
362 pub static UIFontDescriptorFeatureSettingsAttribute: &'static UIFontDescriptorAttributeName;
364}
365
366extern "C" {
367 pub static UIFontDescriptorTextStyleAttribute: &'static UIFontDescriptorAttributeName;
369}
370
371extern "C" {
372 pub static UIFontSymbolicTrait: &'static UIFontDescriptorTraitKey;
374}
375
376extern "C" {
377 pub static UIFontWeightTrait: &'static UIFontDescriptorTraitKey;
379}
380
381extern "C" {
382 pub static UIFontWidthTrait: &'static UIFontDescriptorTraitKey;
384}
385
386extern "C" {
387 pub static UIFontSlantTrait: &'static UIFontDescriptorTraitKey;
389}
390
391extern "C" {
392 #[cfg(feature = "objc2-core-foundation")]
394 pub static UIFontWeightUltraLight: UIFontWeight;
395}
396
397extern "C" {
398 #[cfg(feature = "objc2-core-foundation")]
400 pub static UIFontWeightThin: UIFontWeight;
401}
402
403extern "C" {
404 #[cfg(feature = "objc2-core-foundation")]
406 pub static UIFontWeightLight: UIFontWeight;
407}
408
409extern "C" {
410 #[cfg(feature = "objc2-core-foundation")]
412 pub static UIFontWeightRegular: UIFontWeight;
413}
414
415extern "C" {
416 #[cfg(feature = "objc2-core-foundation")]
418 pub static UIFontWeightMedium: UIFontWeight;
419}
420
421extern "C" {
422 #[cfg(feature = "objc2-core-foundation")]
424 pub static UIFontWeightSemibold: UIFontWeight;
425}
426
427extern "C" {
428 #[cfg(feature = "objc2-core-foundation")]
430 pub static UIFontWeightBold: UIFontWeight;
431}
432
433extern "C" {
434 #[cfg(feature = "objc2-core-foundation")]
436 pub static UIFontWeightHeavy: UIFontWeight;
437}
438
439extern "C" {
440 #[cfg(feature = "objc2-core-foundation")]
442 pub static UIFontWeightBlack: UIFontWeight;
443}
444
445extern "C" {
446 #[cfg(feature = "objc2-core-foundation")]
448 pub static UIFontWidthCondensed: UIFontWidth;
449}
450
451extern "C" {
452 #[cfg(feature = "objc2-core-foundation")]
454 pub static UIFontWidthStandard: UIFontWidth;
455}
456
457extern "C" {
458 #[cfg(feature = "objc2-core-foundation")]
460 pub static UIFontWidthExpanded: UIFontWidth;
461}
462
463extern "C" {
464 #[cfg(feature = "objc2-core-foundation")]
466 pub static UIFontWidthCompressed: UIFontWidth;
467}
468
469extern "C" {
470 pub static UIFontFeatureTypeIdentifierKey: &'static UIFontDescriptorFeatureKey;
472}
473
474extern "C" {
475 pub static UIFontFeatureSelectorIdentifierKey: &'static UIFontDescriptorFeatureKey;
477}
478
479extern "C" {
480 pub static UIFontTextStyleLargeTitle: &'static UIFontTextStyle;
482}
483
484extern "C" {
485 pub static UIFontTextStyleExtraLargeTitle: &'static UIFontTextStyle;
487}
488
489extern "C" {
490 pub static UIFontTextStyleExtraLargeTitle2: &'static UIFontTextStyle;
492}
493
494extern "C" {
495 pub static UIFontTextStyleTitle1: &'static UIFontTextStyle;
497}
498
499extern "C" {
500 pub static UIFontTextStyleTitle2: &'static UIFontTextStyle;
502}
503
504extern "C" {
505 pub static UIFontTextStyleTitle3: &'static UIFontTextStyle;
507}
508
509extern "C" {
510 pub static UIFontTextStyleHeadline: &'static UIFontTextStyle;
512}
513
514extern "C" {
515 pub static UIFontTextStyleSubheadline: &'static UIFontTextStyle;
517}
518
519extern "C" {
520 pub static UIFontTextStyleBody: &'static UIFontTextStyle;
522}
523
524extern "C" {
525 pub static UIFontTextStyleCallout: &'static UIFontTextStyle;
527}
528
529extern "C" {
530 pub static UIFontTextStyleFootnote: &'static UIFontTextStyle;
532}
533
534extern "C" {
535 pub static UIFontTextStyleCaption1: &'static UIFontTextStyle;
537}
538
539extern "C" {
540 pub static UIFontTextStyleCaption2: &'static UIFontTextStyle;
542}