use crate::common::*;
use crate::AppKit::*;
use crate::CoreData::*;
use crate::Foundation::*;
extern_static!(NSFontIdentityMatrix: NonNull<CGFloat>);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "AppKit_NSFont")]
pub struct NSFont;
#[cfg(feature = "AppKit_NSFont")]
unsafe impl ClassType for NSFont {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "AppKit_NSFont")]
unsafe impl NSCoding for NSFont {}
#[cfg(feature = "AppKit_NSFont")]
unsafe impl NSCopying for NSFont {}
#[cfg(feature = "AppKit_NSFont")]
unsafe impl NSObjectProtocol for NSFont {}
#[cfg(feature = "AppKit_NSFont")]
unsafe impl NSSecureCoding for NSFont {}
extern_methods!(
#[cfg(feature = "AppKit_NSFont")]
unsafe impl NSFont {
#[cfg(feature = "Foundation_NSString")]
#[method_id(@__retain_semantics Other fontWithName:size:)]
pub unsafe fn fontWithName_size(
font_name: &NSString,
font_size: CGFloat,
) -> Option<Id<NSFont>>;
#[cfg(feature = "Foundation_NSString")]
#[method_id(@__retain_semantics Other fontWithName:matrix:)]
pub unsafe fn fontWithName_matrix(
font_name: &NSString,
font_matrix: NonNull<CGFloat>,
) -> Option<Id<NSFont>>;
#[cfg(feature = "AppKit_NSFontDescriptor")]
#[method_id(@__retain_semantics Other fontWithDescriptor:size:)]
pub unsafe fn fontWithDescriptor_size(
font_descriptor: &NSFontDescriptor,
font_size: CGFloat,
) -> Option<Id<NSFont>>;
#[cfg(all(
feature = "AppKit_NSFontDescriptor",
feature = "Foundation_NSAffineTransform"
))]
#[method_id(@__retain_semantics Other fontWithDescriptor:textTransform:)]
pub unsafe fn fontWithDescriptor_textTransform(
font_descriptor: &NSFontDescriptor,
text_transform: Option<&NSAffineTransform>,
) -> Option<Id<NSFont>>;
#[method_id(@__retain_semantics Other userFontOfSize:)]
pub unsafe fn userFontOfSize(font_size: CGFloat) -> Option<Id<NSFont>>;
#[method_id(@__retain_semantics Other userFixedPitchFontOfSize:)]
pub unsafe fn userFixedPitchFontOfSize(font_size: CGFloat) -> Option<Id<NSFont>>;
#[method(setUserFont:)]
pub unsafe fn setUserFont(font: Option<&NSFont>);
#[method(setUserFixedPitchFont:)]
pub unsafe fn setUserFixedPitchFont(font: Option<&NSFont>);
#[method_id(@__retain_semantics Other systemFontOfSize:)]
pub unsafe fn systemFontOfSize(font_size: CGFloat) -> Id<NSFont>;
#[method_id(@__retain_semantics Other boldSystemFontOfSize:)]
pub unsafe fn boldSystemFontOfSize(font_size: CGFloat) -> Id<NSFont>;
#[method_id(@__retain_semantics Other labelFontOfSize:)]
pub unsafe fn labelFontOfSize(font_size: CGFloat) -> Id<NSFont>;
#[method_id(@__retain_semantics Other titleBarFontOfSize:)]
pub unsafe fn titleBarFontOfSize(font_size: CGFloat) -> Id<NSFont>;
#[method_id(@__retain_semantics Other menuFontOfSize:)]
pub unsafe fn menuFontOfSize(font_size: CGFloat) -> Id<NSFont>;
#[method_id(@__retain_semantics Other menuBarFontOfSize:)]
pub unsafe fn menuBarFontOfSize(font_size: CGFloat) -> Id<NSFont>;
#[method_id(@__retain_semantics Other messageFontOfSize:)]
pub unsafe fn messageFontOfSize(font_size: CGFloat) -> Id<NSFont>;
#[method_id(@__retain_semantics Other paletteFontOfSize:)]
pub unsafe fn paletteFontOfSize(font_size: CGFloat) -> Id<NSFont>;
#[method_id(@__retain_semantics Other toolTipsFontOfSize:)]
pub unsafe fn toolTipsFontOfSize(font_size: CGFloat) -> Id<NSFont>;
#[method_id(@__retain_semantics Other controlContentFontOfSize:)]
pub unsafe fn controlContentFontOfSize(font_size: CGFloat) -> Id<NSFont>;
#[method_id(@__retain_semantics Other systemFontOfSize:weight:)]
pub unsafe fn systemFontOfSize_weight(
font_size: CGFloat,
weight: NSFontWeight,
) -> Id<NSFont>;
#[method_id(@__retain_semantics Other monospacedDigitSystemFontOfSize:weight:)]
pub unsafe fn monospacedDigitSystemFontOfSize_weight(
font_size: CGFloat,
weight: NSFontWeight,
) -> Id<NSFont>;
#[method_id(@__retain_semantics Other systemFontOfSize:weight:width:)]
pub unsafe fn systemFontOfSize_weight_width(
font_size: CGFloat,
weight: NSFontWeight,
width: NSFontWidth,
) -> Id<NSFont>;
#[method_id(@__retain_semantics Other monospacedSystemFontOfSize:weight:)]
pub unsafe fn monospacedSystemFontOfSize_weight(
font_size: CGFloat,
weight: NSFontWeight,
) -> Id<NSFont>;
#[method_id(@__retain_semantics Other fontWithSize:)]
pub unsafe fn fontWithSize(&self, font_size: CGFloat) -> Id<NSFont>;
#[method(systemFontSize)]
pub unsafe fn systemFontSize() -> CGFloat;
#[method(smallSystemFontSize)]
pub unsafe fn smallSystemFontSize() -> CGFloat;
#[method(labelFontSize)]
pub unsafe fn labelFontSize() -> CGFloat;
#[method(systemFontSizeForControlSize:)]
pub unsafe fn systemFontSizeForControlSize(control_size: NSControlSize) -> CGFloat;
#[cfg(feature = "Foundation_NSString")]
#[method_id(@__retain_semantics Other fontName)]
pub unsafe fn fontName(&self) -> Id<NSString>;
#[method(pointSize)]
pub unsafe fn pointSize(&self) -> CGFloat;
#[method(matrix)]
pub unsafe fn matrix(&self) -> NonNull<CGFloat>;
#[cfg(feature = "Foundation_NSString")]
#[method_id(@__retain_semantics Other familyName)]
pub unsafe fn familyName(&self) -> Option<Id<NSString>>;
#[cfg(feature = "Foundation_NSString")]
#[method_id(@__retain_semantics Other displayName)]
pub unsafe fn displayName(&self) -> Option<Id<NSString>>;
#[cfg(feature = "AppKit_NSFontDescriptor")]
#[method_id(@__retain_semantics Other fontDescriptor)]
pub unsafe fn fontDescriptor(&self) -> Id<NSFontDescriptor>;
#[cfg(feature = "Foundation_NSAffineTransform")]
#[method_id(@__retain_semantics Other textTransform)]
pub unsafe fn textTransform(&self) -> Id<NSAffineTransform>;
#[method(numberOfGlyphs)]
pub unsafe fn numberOfGlyphs(&self) -> NSUInteger;
#[method(mostCompatibleStringEncoding)]
pub unsafe fn mostCompatibleStringEncoding(&self) -> NSStringEncoding;
#[cfg(feature = "Foundation_NSCharacterSet")]
#[method_id(@__retain_semantics Other coveredCharacterSet)]
pub unsafe fn coveredCharacterSet(&self) -> Id<NSCharacterSet>;
#[method(boundingRectForFont)]
pub unsafe fn boundingRectForFont(&self) -> NSRect;
#[method(maximumAdvancement)]
pub unsafe fn maximumAdvancement(&self) -> NSSize;
#[method(ascender)]
pub unsafe fn ascender(&self) -> CGFloat;
#[method(descender)]
pub unsafe fn descender(&self) -> CGFloat;
#[method(leading)]
pub unsafe fn leading(&self) -> CGFloat;
#[method(underlinePosition)]
pub unsafe fn underlinePosition(&self) -> CGFloat;
#[method(underlineThickness)]
pub unsafe fn underlineThickness(&self) -> CGFloat;
#[method(italicAngle)]
pub unsafe fn italicAngle(&self) -> CGFloat;
#[method(capHeight)]
pub unsafe fn capHeight(&self) -> CGFloat;
#[method(xHeight)]
pub unsafe fn xHeight(&self) -> CGFloat;
#[method(isFixedPitch)]
pub unsafe fn isFixedPitch(&self) -> bool;
#[method(set)]
pub unsafe fn set(&self);
#[cfg(feature = "AppKit_NSGraphicsContext")]
#[method(setInContext:)]
pub unsafe fn setInContext(&self, graphics_context: &NSGraphicsContext);
#[method_id(@__retain_semantics Other verticalFont)]
pub unsafe fn verticalFont(&self) -> Id<NSFont>;
#[method(isVertical)]
pub unsafe fn isVertical(&self) -> bool;
}
);
extern_methods!(
#[cfg(feature = "AppKit_NSFont")]
unsafe impl NSFont {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Id<Self>;
}
);
extern_static!(NSAntialiasThresholdChangedNotification: &'static NSNotificationName);
extern_static!(NSFontSetChangedNotification: &'static NSNotificationName);
pub type NSGlyph = c_uint;
extern_enum!(
#[underlying(c_uint)]
pub enum __anonymous__ {
NSControlGlyph = 0x00FFFFFF,
NSNullGlyph = 0x0,
}
);
ns_enum!(
#[underlying(NSUInteger)]
pub enum NSFontRenderingMode {
NSFontDefaultRenderingMode = 0,
NSFontAntialiasedRenderingMode = 1,
NSFontIntegerAdvancementsRenderingMode = 2,
NSFontAntialiasedIntegerAdvancementsRenderingMode = 3,
}
);
ns_enum!(
#[underlying(NSUInteger)]
#[deprecated]
pub enum NSMultibyteGlyphPacking {
#[deprecated]
NSNativeShortGlyphPacking = 5,
}
);
extern_fn!(
#[deprecated]
pub unsafe fn NSConvertGlyphsToPackedGlyphs(
gl_buf: NonNull<NSGlyph>,
count: NSInteger,
packing: NSMultibyteGlyphPacking,
packed_glyphs: NonNull<c_char>,
) -> NSInteger;
);
extern_methods!(
#[cfg(feature = "AppKit_NSFont")]
unsafe impl NSFont {
#[cfg(feature = "Foundation_NSString")]
#[method(glyphWithName:)]
pub unsafe fn glyphWithName(&self, name: &NSString) -> NSGlyph;
#[method(boundingRectForGlyph:)]
pub unsafe fn boundingRectForGlyph(&self, glyph: NSGlyph) -> NSRect;
#[method(advancementForGlyph:)]
pub unsafe fn advancementForGlyph(&self, glyph: NSGlyph) -> NSSize;
#[method(getBoundingRects:forGlyphs:count:)]
pub unsafe fn getBoundingRects_forGlyphs_count(
&self,
bounds: NSRectArray,
glyphs: NonNull<NSGlyph>,
glyph_count: NSUInteger,
);
#[method(getAdvancements:forGlyphs:count:)]
pub unsafe fn getAdvancements_forGlyphs_count(
&self,
advancements: NSSizeArray,
glyphs: NonNull<NSGlyph>,
glyph_count: NSUInteger,
);
#[method(getAdvancements:forPackedGlyphs:length:)]
pub unsafe fn getAdvancements_forPackedGlyphs_length(
&self,
advancements: NSSizeArray,
packed_glyphs: NonNull<c_void>,
length: NSUInteger,
);
#[method_id(@__retain_semantics Other printerFont)]
pub unsafe fn printerFont(&self) -> Id<NSFont>;
#[method_id(@__retain_semantics Other screenFont)]
pub unsafe fn screenFont(&self) -> Id<NSFont>;
#[method_id(@__retain_semantics Other screenFontWithRenderingMode:)]
pub unsafe fn screenFontWithRenderingMode(
&self,
rendering_mode: NSFontRenderingMode,
) -> Id<NSFont>;
#[method(renderingMode)]
pub unsafe fn renderingMode(&self) -> NSFontRenderingMode;
}
);
extern_methods!(
#[cfg(feature = "AppKit_NSFont")]
unsafe impl NSFont {
#[cfg(feature = "Foundation_NSDictionary")]
#[method_id(@__retain_semantics Other preferredFontForTextStyle:options:)]
pub unsafe fn preferredFontForTextStyle_options(
style: &NSFontTextStyle,
options: &NSDictionary<NSFontTextStyleOptionKey, AnyObject>,
) -> Id<NSFont>;
}
);