use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[unsafe(super(NSTypesetter, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSTypesetter")]
pub struct NSATSTypesetter;
);
#[cfg(feature = "NSTypesetter")]
extern_conformance!(
unsafe impl NSObjectProtocol for NSATSTypesetter {}
);
#[cfg(feature = "NSTypesetter")]
impl NSATSTypesetter {
extern_methods!(
#[unsafe(method(sharedTypesetter))]
#[unsafe(method_family = none)]
pub fn sharedTypesetter() -> Retained<NSATSTypesetter>;
);
}
#[cfg(feature = "NSTypesetter")]
impl NSATSTypesetter {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
#[cfg(feature = "NSTypesetter")]
impl DefaultRetained for NSATSTypesetter {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
#[cfg(feature = "NSTypesetter")]
impl NSATSTypesetter {
extern_methods!(
#[deprecated]
#[unsafe(method(lineFragmentRectForProposedRect:remainingRect:))]
#[unsafe(method_family = none)]
pub unsafe fn lineFragmentRectForProposedRect_remainingRect(
&self,
proposed_rect: NSRect,
remaining_rect: NSRectPointer,
) -> NSRect;
);
}
#[cfg(feature = "NSTypesetter")]
impl NSATSTypesetter {
extern_methods!(
#[unsafe(method(usesFontLeading))]
#[unsafe(method_family = none)]
pub fn usesFontLeading(&self) -> bool;
#[unsafe(method(setUsesFontLeading:))]
#[unsafe(method_family = none)]
pub fn setUsesFontLeading(&self, uses_font_leading: bool);
#[cfg(feature = "NSLayoutManager")]
#[unsafe(method(typesetterBehavior))]
#[unsafe(method_family = none)]
pub fn typesetterBehavior(&self) -> NSTypesetterBehavior;
#[cfg(feature = "NSLayoutManager")]
#[unsafe(method(setTypesetterBehavior:))]
#[unsafe(method_family = none)]
pub fn setTypesetterBehavior(&self, typesetter_behavior: NSTypesetterBehavior);
#[unsafe(method(hyphenationFactor))]
#[unsafe(method_family = none)]
pub fn hyphenationFactor(&self) -> c_float;
#[unsafe(method(setHyphenationFactor:))]
#[unsafe(method_family = none)]
pub fn setHyphenationFactor(&self, hyphenation_factor: c_float);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(lineFragmentPadding))]
#[unsafe(method_family = none)]
pub fn lineFragmentPadding(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setLineFragmentPadding:))]
#[unsafe(method_family = none)]
pub fn setLineFragmentPadding(&self, line_fragment_padding: CGFloat);
#[cfg(feature = "NSFont")]
#[unsafe(method(substituteFontForFont:))]
#[unsafe(method_family = none)]
pub fn substituteFontForFont(&self, original_font: &NSFont) -> Retained<NSFont>;
#[cfg(all(
feature = "NSParagraphStyle",
feature = "NSText",
feature = "objc2-core-foundation"
))]
#[unsafe(method(textTabForGlyphLocation:writingDirection:maxLocation:))]
#[unsafe(method_family = none)]
pub fn textTabForGlyphLocation_writingDirection_maxLocation(
&self,
glyph_location: CGFloat,
direction: NSWritingDirection,
max_location: CGFloat,
) -> Option<Retained<NSTextTab>>;
#[unsafe(method(bidiProcessingEnabled))]
#[unsafe(method_family = none)]
pub fn bidiProcessingEnabled(&self) -> bool;
#[unsafe(method(setBidiProcessingEnabled:))]
#[unsafe(method_family = none)]
pub fn setBidiProcessingEnabled(&self, bidi_processing_enabled: bool);
#[unsafe(method(attributedString))]
#[unsafe(method_family = none)]
pub unsafe fn attributedString(&self) -> Option<Retained<NSAttributedString>>;
#[unsafe(method(setAttributedString:))]
#[unsafe(method_family = none)]
pub unsafe fn setAttributedString(&self, attributed_string: Option<&NSAttributedString>);
#[unsafe(method(setParagraphGlyphRange:separatorGlyphRange:))]
#[unsafe(method_family = none)]
pub fn setParagraphGlyphRange_separatorGlyphRange(
&self,
paragraph_range: NSRange,
paragraph_separator_range: NSRange,
);
#[unsafe(method(paragraphGlyphRange))]
#[unsafe(method_family = none)]
pub fn paragraphGlyphRange(&self) -> NSRange;
#[unsafe(method(paragraphSeparatorGlyphRange))]
#[unsafe(method_family = none)]
pub fn paragraphSeparatorGlyphRange(&self) -> NSRange;
#[unsafe(method(layoutParagraphAtPoint:))]
#[unsafe(method_family = none)]
pub unsafe fn layoutParagraphAtPoint(
&self,
line_fragment_origin: NonNull<NSPoint>,
) -> NSUInteger;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(lineSpacingAfterGlyphAtIndex:withProposedLineFragmentRect:))]
#[unsafe(method_family = none)]
pub fn lineSpacingAfterGlyphAtIndex_withProposedLineFragmentRect(
&self,
glyph_index: NSUInteger,
rect: NSRect,
) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(paragraphSpacingBeforeGlyphAtIndex:withProposedLineFragmentRect:))]
#[unsafe(method_family = none)]
pub fn paragraphSpacingBeforeGlyphAtIndex_withProposedLineFragmentRect(
&self,
glyph_index: NSUInteger,
rect: NSRect,
) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(paragraphSpacingAfterGlyphAtIndex:withProposedLineFragmentRect:))]
#[unsafe(method_family = none)]
pub fn paragraphSpacingAfterGlyphAtIndex_withProposedLineFragmentRect(
&self,
glyph_index: NSUInteger,
rect: NSRect,
) -> CGFloat;
#[cfg(feature = "NSLayoutManager")]
#[unsafe(method(layoutManager))]
#[unsafe(method_family = none)]
pub unsafe fn layoutManager(&self) -> Option<Retained<NSLayoutManager>>;
#[cfg(feature = "NSTextContainer")]
#[unsafe(method(currentTextContainer))]
#[unsafe(method_family = none)]
pub unsafe fn currentTextContainer(&self) -> Option<Retained<NSTextContainer>>;
#[unsafe(method(setHardInvalidation:forGlyphRange:))]
#[unsafe(method_family = none)]
pub fn setHardInvalidation_forGlyphRange(&self, flag: bool, glyph_range: NSRange);
#[unsafe(method(getLineFragmentRect:usedRect:forParagraphSeparatorGlyphRange:atProposedOrigin:))]
#[unsafe(method_family = none)]
pub unsafe fn getLineFragmentRect_usedRect_forParagraphSeparatorGlyphRange_atProposedOrigin(
&self,
line_fragment_rect: NonNull<NSRect>,
line_fragment_used_rect: NonNull<NSRect>,
paragraph_separator_glyph_range: NSRange,
line_origin: NSPoint,
);
);
}
#[cfg(feature = "NSTypesetter")]
impl NSATSTypesetter {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(willSetLineFragmentRect:forGlyphRange:usedRect:baselineOffset:))]
#[unsafe(method_family = none)]
pub unsafe fn willSetLineFragmentRect_forGlyphRange_usedRect_baselineOffset(
&self,
line_rect: NonNull<NSRect>,
glyph_range: NSRange,
used_rect: NonNull<NSRect>,
baseline_offset: NonNull<CGFloat>,
);
#[unsafe(method(shouldBreakLineByWordBeforeCharacterAtIndex:))]
#[unsafe(method_family = none)]
pub fn shouldBreakLineByWordBeforeCharacterAtIndex(&self, char_index: NSUInteger) -> bool;
#[unsafe(method(shouldBreakLineByHyphenatingBeforeCharacterAtIndex:))]
#[unsafe(method_family = none)]
pub fn shouldBreakLineByHyphenatingBeforeCharacterAtIndex(
&self,
char_index: NSUInteger,
) -> bool;
#[unsafe(method(hyphenationFactorForGlyphAtIndex:))]
#[unsafe(method_family = none)]
pub fn hyphenationFactorForGlyphAtIndex(&self, glyph_index: NSUInteger) -> c_float;
#[unsafe(method(hyphenCharacterForGlyphAtIndex:))]
#[unsafe(method_family = none)]
pub fn hyphenCharacterForGlyphAtIndex(&self, glyph_index: NSUInteger) -> UTF32Char;
#[cfg(feature = "NSTextContainer")]
#[unsafe(method(boundingBoxForControlGlyphAtIndex:forTextContainer:proposedLineFragment:glyphPosition:characterIndex:))]
#[unsafe(method_family = none)]
pub fn boundingBoxForControlGlyphAtIndex_forTextContainer_proposedLineFragment_glyphPosition_characterIndex(
&self,
glyph_index: NSUInteger,
text_container: &NSTextContainer,
proposed_rect: NSRect,
glyph_position: NSPoint,
char_index: NSUInteger,
) -> NSRect;
);
}
#[cfg(feature = "NSTypesetter")]
impl NSATSTypesetter {
extern_methods!(
#[cfg(all(feature = "NSFont", feature = "NSLayoutManager"))]
#[deprecated]
#[unsafe(method(getGlyphsInRange:glyphs:characterIndexes:glyphInscriptions:elasticBits:))]
#[unsafe(method_family = none)]
pub unsafe fn getGlyphsInRange_glyphs_characterIndexes_glyphInscriptions_elasticBits(
&self,
glyphs_range: NSRange,
glyph_buffer: *mut NSGlyph,
char_index_buffer: *mut NSUInteger,
inscribe_buffer: *mut NSGlyphInscription,
elastic_buffer: *mut Bool,
) -> NSUInteger;
);
}