use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
#[cfg(feature = "objc2-core-text")]
use objc2_core_text::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIFontDescriptorSymbolicTraits(pub u32);
bitflags::bitflags! {
impl UIFontDescriptorSymbolicTraits: u32 {
#[doc(alias = "UIFontDescriptorTraitItalic")]
const TraitItalic = 1<<0;
#[doc(alias = "UIFontDescriptorTraitBold")]
const TraitBold = 1<<1;
#[doc(alias = "UIFontDescriptorTraitExpanded")]
const TraitExpanded = 1<<5;
#[doc(alias = "UIFontDescriptorTraitCondensed")]
const TraitCondensed = 1<<6;
#[doc(alias = "UIFontDescriptorTraitMonoSpace")]
const TraitMonoSpace = 1<<10;
#[doc(alias = "UIFontDescriptorTraitVertical")]
const TraitVertical = 1<<11;
#[doc(alias = "UIFontDescriptorTraitUIOptimized")]
const TraitUIOptimized = 1<<12;
#[doc(alias = "UIFontDescriptorTraitTightLeading")]
const TraitTightLeading = 1<<15;
#[doc(alias = "UIFontDescriptorTraitLooseLeading")]
const TraitLooseLeading = 1<<16;
#[doc(alias = "UIFontDescriptorClassMask")]
const ClassMask = 0xF0000000;
#[doc(alias = "UIFontDescriptorClassUnknown")]
const ClassUnknown = 0<<28;
#[doc(alias = "UIFontDescriptorClassOldStyleSerifs")]
const ClassOldStyleSerifs = 1<<28;
#[doc(alias = "UIFontDescriptorClassTransitionalSerifs")]
const ClassTransitionalSerifs = 2<<28;
#[doc(alias = "UIFontDescriptorClassModernSerifs")]
const ClassModernSerifs = 3<<28;
#[doc(alias = "UIFontDescriptorClassClarendonSerifs")]
const ClassClarendonSerifs = 4<<28;
#[doc(alias = "UIFontDescriptorClassSlabSerifs")]
const ClassSlabSerifs = 5<<28;
#[doc(alias = "UIFontDescriptorClassFreeformSerifs")]
const ClassFreeformSerifs = 7<<28;
#[doc(alias = "UIFontDescriptorClassSansSerif")]
const ClassSansSerif = 8<<28;
#[doc(alias = "UIFontDescriptorClassOrnamentals")]
const ClassOrnamentals = 9<<28;
#[doc(alias = "UIFontDescriptorClassScripts")]
const ClassScripts = 10<<28;
#[doc(alias = "UIFontDescriptorClassSymbolic")]
const ClassSymbolic = 12<<28;
}
}
unsafe impl Encode for UIFontDescriptorSymbolicTraits {
const ENCODING: Encoding = u32::ENCODING;
}
unsafe impl RefEncode for UIFontDescriptorSymbolicTraits {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
pub type UIFontDescriptorClass = NSUInteger;
pub type UIFontTextStyle = NSString;
pub type UIFontDescriptorAttributeName = NSString;
pub type UIFontDescriptorTraitKey = NSString;
pub type UIFontDescriptorFeatureKey = NSString;
#[cfg(feature = "objc2-core-foundation")]
pub type UIFontWeight = CGFloat;
#[cfg(feature = "objc2-core-foundation")]
pub type UIFontWidth = CGFloat;
pub type UIFontDescriptorSystemDesign = NSString;
extern "C" {
pub static UIFontDescriptorSystemDesignDefault: &'static UIFontDescriptorSystemDesign;
}
extern "C" {
pub static UIFontDescriptorSystemDesignRounded: &'static UIFontDescriptorSystemDesign;
}
extern "C" {
pub static UIFontDescriptorSystemDesignSerif: &'static UIFontDescriptorSystemDesign;
}
extern "C" {
pub static UIFontDescriptorSystemDesignMonospaced: &'static UIFontDescriptorSystemDesign;
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct UIFontDescriptor;
);
unsafe impl Send for UIFontDescriptor {}
unsafe impl Sync for UIFontDescriptor {}
#[cfg(feature = "objc2-core-text")]
impl AsRef<UIFontDescriptor> for CTFontDescriptor {
#[inline]
fn as_ref(&self) -> &UIFontDescriptor {
unsafe { &*((self as *const Self).cast()) }
}
}
#[cfg(feature = "objc2-core-text")]
impl AsRef<CTFontDescriptor> for UIFontDescriptor {
#[inline]
fn as_ref(&self) -> &CTFontDescriptor {
unsafe { &*((self as *const Self).cast()) }
}
}
extern_conformance!(
unsafe impl NSCoding for UIFontDescriptor {}
);
extern_conformance!(
unsafe impl NSCopying for UIFontDescriptor {}
);
unsafe impl CopyingHelper for UIFontDescriptor {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for UIFontDescriptor {}
);
extern_conformance!(
unsafe impl NSSecureCoding for UIFontDescriptor {}
);
impl UIFontDescriptor {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(initWithCoder:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
#[unsafe(method(postscriptName))]
#[unsafe(method_family = none)]
pub unsafe fn postscriptName(&self) -> Retained<NSString>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(pointSize))]
#[unsafe(method_family = none)]
pub unsafe fn pointSize(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(matrix))]
#[unsafe(method_family = none)]
pub unsafe fn matrix(&self) -> CGAffineTransform;
#[unsafe(method(symbolicTraits))]
#[unsafe(method_family = none)]
pub unsafe fn symbolicTraits(&self) -> UIFontDescriptorSymbolicTraits;
#[unsafe(method(objectForKey:))]
#[unsafe(method_family = none)]
pub fn objectForKey(
&self,
an_attribute: &UIFontDescriptorAttributeName,
) -> Option<Retained<AnyObject>>;
#[unsafe(method(fontAttributes))]
#[unsafe(method_family = none)]
pub unsafe fn fontAttributes(
&self,
) -> Retained<NSDictionary<UIFontDescriptorAttributeName, AnyObject>>;
#[unsafe(method(matchingFontDescriptorsWithMandatoryKeys:))]
#[unsafe(method_family = none)]
pub fn matchingFontDescriptorsWithMandatoryKeys(
&self,
mandatory_keys: Option<&NSSet<UIFontDescriptorAttributeName>>,
) -> Retained<NSArray<UIFontDescriptor>>;
#[unsafe(method(fontDescriptorWithFontAttributes:))]
#[unsafe(method_family = none)]
pub unsafe fn fontDescriptorWithFontAttributes(
attributes: &NSDictionary<UIFontDescriptorAttributeName, AnyObject>,
) -> Retained<UIFontDescriptor>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(fontDescriptorWithName:size:))]
#[unsafe(method_family = none)]
pub fn fontDescriptorWithName_size(
font_name: &NSString,
size: CGFloat,
) -> Retained<UIFontDescriptor>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(fontDescriptorWithName:matrix:))]
#[unsafe(method_family = none)]
pub fn fontDescriptorWithName_matrix(
font_name: &NSString,
matrix: CGAffineTransform,
) -> Retained<UIFontDescriptor>;
#[unsafe(method(preferredFontDescriptorWithTextStyle:))]
#[unsafe(method_family = none)]
pub fn preferredFontDescriptorWithTextStyle(
style: &UIFontTextStyle,
) -> Retained<UIFontDescriptor>;
#[cfg(feature = "UITraitCollection")]
#[unsafe(method(preferredFontDescriptorWithTextStyle:compatibleWithTraitCollection:))]
#[unsafe(method_family = none)]
pub fn preferredFontDescriptorWithTextStyle_compatibleWithTraitCollection(
style: &UIFontTextStyle,
trait_collection: Option<&UITraitCollection>,
) -> Retained<UIFontDescriptor>;
#[unsafe(method(initWithFontAttributes:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithFontAttributes(
this: Allocated<Self>,
attributes: &NSDictionary<UIFontDescriptorAttributeName, AnyObject>,
) -> Retained<Self>;
#[unsafe(method(fontDescriptorByAddingAttributes:))]
#[unsafe(method_family = none)]
pub unsafe fn fontDescriptorByAddingAttributes(
&self,
attributes: &NSDictionary<UIFontDescriptorAttributeName, AnyObject>,
) -> Retained<UIFontDescriptor>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(fontDescriptorWithSize:))]
#[unsafe(method_family = none)]
pub fn fontDescriptorWithSize(&self, new_point_size: CGFloat)
-> Retained<UIFontDescriptor>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(fontDescriptorWithMatrix:))]
#[unsafe(method_family = none)]
pub fn fontDescriptorWithMatrix(
&self,
matrix: CGAffineTransform,
) -> Retained<UIFontDescriptor>;
#[unsafe(method(fontDescriptorWithFace:))]
#[unsafe(method_family = none)]
pub fn fontDescriptorWithFace(&self, new_face: &NSString) -> Retained<UIFontDescriptor>;
#[unsafe(method(fontDescriptorWithFamily:))]
#[unsafe(method_family = none)]
pub fn fontDescriptorWithFamily(&self, new_family: &NSString)
-> Retained<UIFontDescriptor>;
#[unsafe(method(fontDescriptorWithSymbolicTraits:))]
#[unsafe(method_family = none)]
pub fn fontDescriptorWithSymbolicTraits(
&self,
symbolic_traits: UIFontDescriptorSymbolicTraits,
) -> Option<Retained<UIFontDescriptor>>;
#[unsafe(method(fontDescriptorWithDesign:))]
#[unsafe(method_family = none)]
pub fn fontDescriptorWithDesign(
&self,
design: &UIFontDescriptorSystemDesign,
) -> Option<Retained<UIFontDescriptor>>;
);
}
impl UIFontDescriptor {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for UIFontDescriptor {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern "C" {
pub static UIFontDescriptorFamilyAttribute: &'static UIFontDescriptorAttributeName;
}
extern "C" {
pub static UIFontDescriptorNameAttribute: &'static UIFontDescriptorAttributeName;
}
extern "C" {
pub static UIFontDescriptorFaceAttribute: &'static UIFontDescriptorAttributeName;
}
extern "C" {
pub static UIFontDescriptorSizeAttribute: &'static UIFontDescriptorAttributeName;
}
extern "C" {
pub static UIFontDescriptorVisibleNameAttribute: &'static UIFontDescriptorAttributeName;
}
extern "C" {
pub static UIFontDescriptorMatrixAttribute: &'static UIFontDescriptorAttributeName;
}
extern "C" {
pub static UIFontDescriptorCharacterSetAttribute: &'static UIFontDescriptorAttributeName;
}
extern "C" {
pub static UIFontDescriptorCascadeListAttribute: &'static UIFontDescriptorAttributeName;
}
extern "C" {
pub static UIFontDescriptorTraitsAttribute: &'static UIFontDescriptorAttributeName;
}
extern "C" {
pub static UIFontDescriptorFixedAdvanceAttribute: &'static UIFontDescriptorAttributeName;
}
extern "C" {
pub static UIFontDescriptorFeatureSettingsAttribute: &'static UIFontDescriptorAttributeName;
}
extern "C" {
pub static UIFontDescriptorTextStyleAttribute: &'static UIFontDescriptorAttributeName;
}
extern "C" {
pub static UIFontSymbolicTrait: &'static UIFontDescriptorTraitKey;
}
extern "C" {
pub static UIFontWeightTrait: &'static UIFontDescriptorTraitKey;
}
extern "C" {
pub static UIFontWidthTrait: &'static UIFontDescriptorTraitKey;
}
extern "C" {
pub static UIFontSlantTrait: &'static UIFontDescriptorTraitKey;
}
extern "C" {
#[cfg(feature = "objc2-core-foundation")]
pub static UIFontWeightUltraLight: UIFontWeight;
}
extern "C" {
#[cfg(feature = "objc2-core-foundation")]
pub static UIFontWeightThin: UIFontWeight;
}
extern "C" {
#[cfg(feature = "objc2-core-foundation")]
pub static UIFontWeightLight: UIFontWeight;
}
extern "C" {
#[cfg(feature = "objc2-core-foundation")]
pub static UIFontWeightRegular: UIFontWeight;
}
extern "C" {
#[cfg(feature = "objc2-core-foundation")]
pub static UIFontWeightMedium: UIFontWeight;
}
extern "C" {
#[cfg(feature = "objc2-core-foundation")]
pub static UIFontWeightSemibold: UIFontWeight;
}
extern "C" {
#[cfg(feature = "objc2-core-foundation")]
pub static UIFontWeightBold: UIFontWeight;
}
extern "C" {
#[cfg(feature = "objc2-core-foundation")]
pub static UIFontWeightHeavy: UIFontWeight;
}
extern "C" {
#[cfg(feature = "objc2-core-foundation")]
pub static UIFontWeightBlack: UIFontWeight;
}
extern "C" {
#[cfg(feature = "objc2-core-foundation")]
pub static UIFontWidthCondensed: UIFontWidth;
}
extern "C" {
#[cfg(feature = "objc2-core-foundation")]
pub static UIFontWidthStandard: UIFontWidth;
}
extern "C" {
#[cfg(feature = "objc2-core-foundation")]
pub static UIFontWidthExpanded: UIFontWidth;
}
extern "C" {
#[cfg(feature = "objc2-core-foundation")]
pub static UIFontWidthCompressed: UIFontWidth;
}
extern "C" {
pub static UIFontFeatureTypeIdentifierKey: &'static UIFontDescriptorFeatureKey;
}
extern "C" {
pub static UIFontFeatureSelectorIdentifierKey: &'static UIFontDescriptorFeatureKey;
}
extern "C" {
pub static UIFontTextStyleLargeTitle: &'static UIFontTextStyle;
}
extern "C" {
pub static UIFontTextStyleExtraLargeTitle: &'static UIFontTextStyle;
}
extern "C" {
pub static UIFontTextStyleExtraLargeTitle2: &'static UIFontTextStyle;
}
extern "C" {
pub static UIFontTextStyleTitle1: &'static UIFontTextStyle;
}
extern "C" {
pub static UIFontTextStyleTitle2: &'static UIFontTextStyle;
}
extern "C" {
pub static UIFontTextStyleTitle3: &'static UIFontTextStyle;
}
extern "C" {
pub static UIFontTextStyleHeadline: &'static UIFontTextStyle;
}
extern "C" {
pub static UIFontTextStyleSubheadline: &'static UIFontTextStyle;
}
extern "C" {
pub static UIFontTextStyleBody: &'static UIFontTextStyle;
}
extern "C" {
pub static UIFontTextStyleCallout: &'static UIFontTextStyle;
}
extern "C" {
pub static UIFontTextStyleFootnote: &'static UIFontTextStyle;
}
extern "C" {
pub static UIFontTextStyleCaption1: &'static UIFontTextStyle;
}
extern "C" {
pub static UIFontTextStyleCaption2: &'static UIFontTextStyle;
}