objc2_app_kit/generated/
NSATSTypesetter.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12extern_class!(
13    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsatstypesetter?language=objc)
14    #[unsafe(super(NSTypesetter, NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    #[cfg(feature = "NSTypesetter")]
17    pub struct NSATSTypesetter;
18);
19
20#[cfg(feature = "NSTypesetter")]
21unsafe impl NSObjectProtocol for NSATSTypesetter {}
22
23#[cfg(feature = "NSTypesetter")]
24impl NSATSTypesetter {
25    extern_methods!(
26        #[unsafe(method(sharedTypesetter))]
27        #[unsafe(method_family = none)]
28        pub unsafe fn sharedTypesetter() -> Retained<NSATSTypesetter>;
29    );
30}
31
32/// Methods declared on superclass `NSObject`.
33#[cfg(feature = "NSTypesetter")]
34impl NSATSTypesetter {
35    extern_methods!(
36        #[unsafe(method(init))]
37        #[unsafe(method_family = init)]
38        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
39
40        #[unsafe(method(new))]
41        #[unsafe(method_family = new)]
42        pub unsafe fn new() -> Retained<Self>;
43    );
44}
45
46/// NSPantherCompatibility.
47#[cfg(feature = "NSTypesetter")]
48impl NSATSTypesetter {
49    extern_methods!(
50        #[deprecated]
51        #[unsafe(method(lineFragmentRectForProposedRect:remainingRect:))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn lineFragmentRectForProposedRect_remainingRect(
54            &self,
55            proposed_rect: NSRect,
56            remaining_rect: NSRectPointer,
57        ) -> NSRect;
58    );
59}
60
61/// NSPrimitiveInterface.
62#[cfg(feature = "NSTypesetter")]
63impl NSATSTypesetter {
64    extern_methods!(
65        #[unsafe(method(usesFontLeading))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn usesFontLeading(&self) -> bool;
68
69        /// Setter for [`usesFontLeading`][Self::usesFontLeading].
70        #[unsafe(method(setUsesFontLeading:))]
71        #[unsafe(method_family = none)]
72        pub unsafe fn setUsesFontLeading(&self, uses_font_leading: bool);
73
74        #[cfg(feature = "NSLayoutManager")]
75        #[unsafe(method(typesetterBehavior))]
76        #[unsafe(method_family = none)]
77        pub unsafe fn typesetterBehavior(&self) -> NSTypesetterBehavior;
78
79        #[cfg(feature = "NSLayoutManager")]
80        /// Setter for [`typesetterBehavior`][Self::typesetterBehavior].
81        #[unsafe(method(setTypesetterBehavior:))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn setTypesetterBehavior(&self, typesetter_behavior: NSTypesetterBehavior);
84
85        #[unsafe(method(hyphenationFactor))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn hyphenationFactor(&self) -> c_float;
88
89        /// Setter for [`hyphenationFactor`][Self::hyphenationFactor].
90        #[unsafe(method(setHyphenationFactor:))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn setHyphenationFactor(&self, hyphenation_factor: c_float);
93
94        #[cfg(feature = "objc2-core-foundation")]
95        #[unsafe(method(lineFragmentPadding))]
96        #[unsafe(method_family = none)]
97        pub unsafe fn lineFragmentPadding(&self) -> CGFloat;
98
99        #[cfg(feature = "objc2-core-foundation")]
100        /// Setter for [`lineFragmentPadding`][Self::lineFragmentPadding].
101        #[unsafe(method(setLineFragmentPadding:))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn setLineFragmentPadding(&self, line_fragment_padding: CGFloat);
104
105        #[cfg(feature = "NSFont")]
106        #[unsafe(method(substituteFontForFont:))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn substituteFontForFont(&self, original_font: &NSFont) -> Retained<NSFont>;
109
110        #[cfg(all(
111            feature = "NSParagraphStyle",
112            feature = "NSText",
113            feature = "objc2-core-foundation"
114        ))]
115        #[unsafe(method(textTabForGlyphLocation:writingDirection:maxLocation:))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn textTabForGlyphLocation_writingDirection_maxLocation(
118            &self,
119            glyph_location: CGFloat,
120            direction: NSWritingDirection,
121            max_location: CGFloat,
122        ) -> Option<Retained<NSTextTab>>;
123
124        #[unsafe(method(bidiProcessingEnabled))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn bidiProcessingEnabled(&self) -> bool;
127
128        /// Setter for [`bidiProcessingEnabled`][Self::bidiProcessingEnabled].
129        #[unsafe(method(setBidiProcessingEnabled:))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn setBidiProcessingEnabled(&self, bidi_processing_enabled: bool);
132
133        #[unsafe(method(attributedString))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn attributedString(&self) -> Option<Retained<NSAttributedString>>;
136
137        /// Setter for [`attributedString`][Self::attributedString].
138        #[unsafe(method(setAttributedString:))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn setAttributedString(&self, attributed_string: Option<&NSAttributedString>);
141
142        #[unsafe(method(setParagraphGlyphRange:separatorGlyphRange:))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn setParagraphGlyphRange_separatorGlyphRange(
145            &self,
146            paragraph_range: NSRange,
147            paragraph_separator_range: NSRange,
148        );
149
150        #[unsafe(method(paragraphGlyphRange))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn paragraphGlyphRange(&self) -> NSRange;
153
154        #[unsafe(method(paragraphSeparatorGlyphRange))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn paragraphSeparatorGlyphRange(&self) -> NSRange;
157
158        #[unsafe(method(layoutParagraphAtPoint:))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn layoutParagraphAtPoint(
161            &self,
162            line_fragment_origin: NonNull<NSPoint>,
163        ) -> NSUInteger;
164
165        #[cfg(feature = "objc2-core-foundation")]
166        #[unsafe(method(lineSpacingAfterGlyphAtIndex:withProposedLineFragmentRect:))]
167        #[unsafe(method_family = none)]
168        pub unsafe fn lineSpacingAfterGlyphAtIndex_withProposedLineFragmentRect(
169            &self,
170            glyph_index: NSUInteger,
171            rect: NSRect,
172        ) -> CGFloat;
173
174        #[cfg(feature = "objc2-core-foundation")]
175        #[unsafe(method(paragraphSpacingBeforeGlyphAtIndex:withProposedLineFragmentRect:))]
176        #[unsafe(method_family = none)]
177        pub unsafe fn paragraphSpacingBeforeGlyphAtIndex_withProposedLineFragmentRect(
178            &self,
179            glyph_index: NSUInteger,
180            rect: NSRect,
181        ) -> CGFloat;
182
183        #[cfg(feature = "objc2-core-foundation")]
184        #[unsafe(method(paragraphSpacingAfterGlyphAtIndex:withProposedLineFragmentRect:))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn paragraphSpacingAfterGlyphAtIndex_withProposedLineFragmentRect(
187            &self,
188            glyph_index: NSUInteger,
189            rect: NSRect,
190        ) -> CGFloat;
191
192        #[cfg(feature = "NSLayoutManager")]
193        #[unsafe(method(layoutManager))]
194        #[unsafe(method_family = none)]
195        pub unsafe fn layoutManager(&self) -> Option<Retained<NSLayoutManager>>;
196
197        #[cfg(feature = "NSTextContainer")]
198        #[unsafe(method(currentTextContainer))]
199        #[unsafe(method_family = none)]
200        pub unsafe fn currentTextContainer(&self) -> Option<Retained<NSTextContainer>>;
201
202        #[unsafe(method(setHardInvalidation:forGlyphRange:))]
203        #[unsafe(method_family = none)]
204        pub unsafe fn setHardInvalidation_forGlyphRange(&self, flag: bool, glyph_range: NSRange);
205
206        #[unsafe(method(getLineFragmentRect:usedRect:forParagraphSeparatorGlyphRange:atProposedOrigin:))]
207        #[unsafe(method_family = none)]
208        pub unsafe fn getLineFragmentRect_usedRect_forParagraphSeparatorGlyphRange_atProposedOrigin(
209            &self,
210            line_fragment_rect: NonNull<NSRect>,
211            line_fragment_used_rect: NonNull<NSRect>,
212            paragraph_separator_glyph_range: NSRange,
213            line_origin: NSPoint,
214        );
215    );
216}
217
218/// NSLayoutPhaseInterface.
219#[cfg(feature = "NSTypesetter")]
220impl NSATSTypesetter {
221    extern_methods!(
222        #[cfg(feature = "objc2-core-foundation")]
223        #[unsafe(method(willSetLineFragmentRect:forGlyphRange:usedRect:baselineOffset:))]
224        #[unsafe(method_family = none)]
225        pub unsafe fn willSetLineFragmentRect_forGlyphRange_usedRect_baselineOffset(
226            &self,
227            line_rect: NonNull<NSRect>,
228            glyph_range: NSRange,
229            used_rect: NonNull<NSRect>,
230            baseline_offset: NonNull<CGFloat>,
231        );
232
233        #[unsafe(method(shouldBreakLineByWordBeforeCharacterAtIndex:))]
234        #[unsafe(method_family = none)]
235        pub unsafe fn shouldBreakLineByWordBeforeCharacterAtIndex(
236            &self,
237            char_index: NSUInteger,
238        ) -> bool;
239
240        #[unsafe(method(shouldBreakLineByHyphenatingBeforeCharacterAtIndex:))]
241        #[unsafe(method_family = none)]
242        pub unsafe fn shouldBreakLineByHyphenatingBeforeCharacterAtIndex(
243            &self,
244            char_index: NSUInteger,
245        ) -> bool;
246
247        #[unsafe(method(hyphenationFactorForGlyphAtIndex:))]
248        #[unsafe(method_family = none)]
249        pub unsafe fn hyphenationFactorForGlyphAtIndex(&self, glyph_index: NSUInteger) -> c_float;
250
251        #[unsafe(method(hyphenCharacterForGlyphAtIndex:))]
252        #[unsafe(method_family = none)]
253        pub unsafe fn hyphenCharacterForGlyphAtIndex(&self, glyph_index: NSUInteger) -> UTF32Char;
254
255        #[cfg(feature = "NSTextContainer")]
256        #[unsafe(method(boundingBoxForControlGlyphAtIndex:forTextContainer:proposedLineFragment:glyphPosition:characterIndex:))]
257        #[unsafe(method_family = none)]
258        pub unsafe fn boundingBoxForControlGlyphAtIndex_forTextContainer_proposedLineFragment_glyphPosition_characterIndex(
259            &self,
260            glyph_index: NSUInteger,
261            text_container: &NSTextContainer,
262            proposed_rect: NSRect,
263            glyph_position: NSPoint,
264            char_index: NSUInteger,
265        ) -> NSRect;
266    );
267}
268
269/// NSGlyphStorageInterface.
270#[cfg(feature = "NSTypesetter")]
271impl NSATSTypesetter {
272    extern_methods!(
273        #[cfg(all(feature = "NSFont", feature = "NSLayoutManager"))]
274        #[deprecated]
275        #[unsafe(method(getGlyphsInRange:glyphs:characterIndexes:glyphInscriptions:elasticBits:))]
276        #[unsafe(method_family = none)]
277        pub unsafe fn getGlyphsInRange_glyphs_characterIndexes_glyphInscriptions_elasticBits(
278            &self,
279            glyphs_range: NSRange,
280            glyph_buffer: *mut NSGlyph,
281            char_index_buffer: *mut NSUInteger,
282            inscribe_buffer: *mut NSGlyphInscription,
283            elastic_buffer: *mut Bool,
284        ) -> NSUInteger;
285    );
286}