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")]
21extern_conformance!(
22    unsafe impl NSObjectProtocol for NSATSTypesetter {}
23);
24
25#[cfg(feature = "NSTypesetter")]
26impl NSATSTypesetter {
27    extern_methods!(
28        #[unsafe(method(sharedTypesetter))]
29        #[unsafe(method_family = none)]
30        pub fn sharedTypesetter() -> Retained<NSATSTypesetter>;
31    );
32}
33
34/// Methods declared on superclass `NSObject`.
35#[cfg(feature = "NSTypesetter")]
36impl NSATSTypesetter {
37    extern_methods!(
38        #[unsafe(method(init))]
39        #[unsafe(method_family = init)]
40        pub fn init(this: Allocated<Self>) -> Retained<Self>;
41
42        #[unsafe(method(new))]
43        #[unsafe(method_family = new)]
44        pub fn new() -> Retained<Self>;
45    );
46}
47
48#[cfg(feature = "NSTypesetter")]
49impl DefaultRetained for NSATSTypesetter {
50    #[inline]
51    fn default_retained() -> Retained<Self> {
52        Self::new()
53    }
54}
55
56/// NSPantherCompatibility.
57#[cfg(feature = "NSTypesetter")]
58impl NSATSTypesetter {
59    extern_methods!(
60        /// # Safety
61        ///
62        /// `remaining_rect` must be a valid pointer.
63        #[deprecated]
64        #[unsafe(method(lineFragmentRectForProposedRect:remainingRect:))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn lineFragmentRectForProposedRect_remainingRect(
67            &self,
68            proposed_rect: NSRect,
69            remaining_rect: NSRectPointer,
70        ) -> NSRect;
71    );
72}
73
74/// NSPrimitiveInterface.
75#[cfg(feature = "NSTypesetter")]
76impl NSATSTypesetter {
77    extern_methods!(
78        #[unsafe(method(usesFontLeading))]
79        #[unsafe(method_family = none)]
80        pub fn usesFontLeading(&self) -> bool;
81
82        /// Setter for [`usesFontLeading`][Self::usesFontLeading].
83        #[unsafe(method(setUsesFontLeading:))]
84        #[unsafe(method_family = none)]
85        pub fn setUsesFontLeading(&self, uses_font_leading: bool);
86
87        #[cfg(feature = "NSLayoutManager")]
88        #[unsafe(method(typesetterBehavior))]
89        #[unsafe(method_family = none)]
90        pub fn typesetterBehavior(&self) -> NSTypesetterBehavior;
91
92        #[cfg(feature = "NSLayoutManager")]
93        /// Setter for [`typesetterBehavior`][Self::typesetterBehavior].
94        #[unsafe(method(setTypesetterBehavior:))]
95        #[unsafe(method_family = none)]
96        pub fn setTypesetterBehavior(&self, typesetter_behavior: NSTypesetterBehavior);
97
98        #[unsafe(method(hyphenationFactor))]
99        #[unsafe(method_family = none)]
100        pub fn hyphenationFactor(&self) -> c_float;
101
102        /// Setter for [`hyphenationFactor`][Self::hyphenationFactor].
103        #[unsafe(method(setHyphenationFactor:))]
104        #[unsafe(method_family = none)]
105        pub fn setHyphenationFactor(&self, hyphenation_factor: c_float);
106
107        #[cfg(feature = "objc2-core-foundation")]
108        #[unsafe(method(lineFragmentPadding))]
109        #[unsafe(method_family = none)]
110        pub fn lineFragmentPadding(&self) -> CGFloat;
111
112        #[cfg(feature = "objc2-core-foundation")]
113        /// Setter for [`lineFragmentPadding`][Self::lineFragmentPadding].
114        #[unsafe(method(setLineFragmentPadding:))]
115        #[unsafe(method_family = none)]
116        pub fn setLineFragmentPadding(&self, line_fragment_padding: CGFloat);
117
118        #[cfg(feature = "NSFont")]
119        #[unsafe(method(substituteFontForFont:))]
120        #[unsafe(method_family = none)]
121        pub fn substituteFontForFont(&self, original_font: &NSFont) -> Retained<NSFont>;
122
123        #[cfg(all(
124            feature = "NSParagraphStyle",
125            feature = "NSText",
126            feature = "objc2-core-foundation"
127        ))]
128        #[unsafe(method(textTabForGlyphLocation:writingDirection:maxLocation:))]
129        #[unsafe(method_family = none)]
130        pub fn textTabForGlyphLocation_writingDirection_maxLocation(
131            &self,
132            glyph_location: CGFloat,
133            direction: NSWritingDirection,
134            max_location: CGFloat,
135        ) -> Option<Retained<NSTextTab>>;
136
137        #[unsafe(method(bidiProcessingEnabled))]
138        #[unsafe(method_family = none)]
139        pub fn bidiProcessingEnabled(&self) -> bool;
140
141        /// Setter for [`bidiProcessingEnabled`][Self::bidiProcessingEnabled].
142        #[unsafe(method(setBidiProcessingEnabled:))]
143        #[unsafe(method_family = none)]
144        pub fn setBidiProcessingEnabled(&self, bidi_processing_enabled: bool);
145
146        /// # Safety
147        ///
148        /// This is not retained internally, you must ensure the object is still alive.
149        #[unsafe(method(attributedString))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn attributedString(&self) -> Option<Retained<NSAttributedString>>;
152
153        /// Setter for [`attributedString`][Self::attributedString].
154        ///
155        /// # Safety
156        ///
157        /// This is unretained, you must ensure the object is kept alive while in use.
158        #[unsafe(method(setAttributedString:))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn setAttributedString(&self, attributed_string: Option<&NSAttributedString>);
161
162        #[unsafe(method(setParagraphGlyphRange:separatorGlyphRange:))]
163        #[unsafe(method_family = none)]
164        pub fn setParagraphGlyphRange_separatorGlyphRange(
165            &self,
166            paragraph_range: NSRange,
167            paragraph_separator_range: NSRange,
168        );
169
170        #[unsafe(method(paragraphGlyphRange))]
171        #[unsafe(method_family = none)]
172        pub fn paragraphGlyphRange(&self) -> NSRange;
173
174        #[unsafe(method(paragraphSeparatorGlyphRange))]
175        #[unsafe(method_family = none)]
176        pub fn paragraphSeparatorGlyphRange(&self) -> NSRange;
177
178        /// # Safety
179        ///
180        /// `line_fragment_origin` must be a valid pointer.
181        #[unsafe(method(layoutParagraphAtPoint:))]
182        #[unsafe(method_family = none)]
183        pub unsafe fn layoutParagraphAtPoint(
184            &self,
185            line_fragment_origin: NonNull<NSPoint>,
186        ) -> NSUInteger;
187
188        #[cfg(feature = "objc2-core-foundation")]
189        #[unsafe(method(lineSpacingAfterGlyphAtIndex:withProposedLineFragmentRect:))]
190        #[unsafe(method_family = none)]
191        pub fn lineSpacingAfterGlyphAtIndex_withProposedLineFragmentRect(
192            &self,
193            glyph_index: NSUInteger,
194            rect: NSRect,
195        ) -> CGFloat;
196
197        #[cfg(feature = "objc2-core-foundation")]
198        #[unsafe(method(paragraphSpacingBeforeGlyphAtIndex:withProposedLineFragmentRect:))]
199        #[unsafe(method_family = none)]
200        pub fn paragraphSpacingBeforeGlyphAtIndex_withProposedLineFragmentRect(
201            &self,
202            glyph_index: NSUInteger,
203            rect: NSRect,
204        ) -> CGFloat;
205
206        #[cfg(feature = "objc2-core-foundation")]
207        #[unsafe(method(paragraphSpacingAfterGlyphAtIndex:withProposedLineFragmentRect:))]
208        #[unsafe(method_family = none)]
209        pub fn paragraphSpacingAfterGlyphAtIndex_withProposedLineFragmentRect(
210            &self,
211            glyph_index: NSUInteger,
212            rect: NSRect,
213        ) -> CGFloat;
214
215        #[cfg(feature = "NSLayoutManager")]
216        /// # Safety
217        ///
218        /// This is not retained internally, you must ensure the object is still alive.
219        #[unsafe(method(layoutManager))]
220        #[unsafe(method_family = none)]
221        pub unsafe fn layoutManager(&self) -> Option<Retained<NSLayoutManager>>;
222
223        #[cfg(feature = "NSTextContainer")]
224        /// # Safety
225        ///
226        /// This is not retained internally, you must ensure the object is still alive.
227        #[unsafe(method(currentTextContainer))]
228        #[unsafe(method_family = none)]
229        pub unsafe fn currentTextContainer(&self) -> Option<Retained<NSTextContainer>>;
230
231        #[unsafe(method(setHardInvalidation:forGlyphRange:))]
232        #[unsafe(method_family = none)]
233        pub fn setHardInvalidation_forGlyphRange(&self, flag: bool, glyph_range: NSRange);
234
235        /// # Safety
236        ///
237        /// - `line_fragment_rect` must be a valid pointer.
238        /// - `line_fragment_used_rect` must be a valid pointer.
239        #[unsafe(method(getLineFragmentRect:usedRect:forParagraphSeparatorGlyphRange:atProposedOrigin:))]
240        #[unsafe(method_family = none)]
241        pub unsafe fn getLineFragmentRect_usedRect_forParagraphSeparatorGlyphRange_atProposedOrigin(
242            &self,
243            line_fragment_rect: NonNull<NSRect>,
244            line_fragment_used_rect: NonNull<NSRect>,
245            paragraph_separator_glyph_range: NSRange,
246            line_origin: NSPoint,
247        );
248    );
249}
250
251/// NSLayoutPhaseInterface.
252#[cfg(feature = "NSTypesetter")]
253impl NSATSTypesetter {
254    extern_methods!(
255        #[cfg(feature = "objc2-core-foundation")]
256        /// # Safety
257        ///
258        /// - `line_rect` must be a valid pointer.
259        /// - `used_rect` must be a valid pointer.
260        /// - `baseline_offset` must be a valid pointer.
261        #[unsafe(method(willSetLineFragmentRect:forGlyphRange:usedRect:baselineOffset:))]
262        #[unsafe(method_family = none)]
263        pub unsafe fn willSetLineFragmentRect_forGlyphRange_usedRect_baselineOffset(
264            &self,
265            line_rect: NonNull<NSRect>,
266            glyph_range: NSRange,
267            used_rect: NonNull<NSRect>,
268            baseline_offset: NonNull<CGFloat>,
269        );
270
271        #[unsafe(method(shouldBreakLineByWordBeforeCharacterAtIndex:))]
272        #[unsafe(method_family = none)]
273        pub fn shouldBreakLineByWordBeforeCharacterAtIndex(&self, char_index: NSUInteger) -> bool;
274
275        #[unsafe(method(shouldBreakLineByHyphenatingBeforeCharacterAtIndex:))]
276        #[unsafe(method_family = none)]
277        pub fn shouldBreakLineByHyphenatingBeforeCharacterAtIndex(
278            &self,
279            char_index: NSUInteger,
280        ) -> bool;
281
282        #[unsafe(method(hyphenationFactorForGlyphAtIndex:))]
283        #[unsafe(method_family = none)]
284        pub fn hyphenationFactorForGlyphAtIndex(&self, glyph_index: NSUInteger) -> c_float;
285
286        #[unsafe(method(hyphenCharacterForGlyphAtIndex:))]
287        #[unsafe(method_family = none)]
288        pub fn hyphenCharacterForGlyphAtIndex(&self, glyph_index: NSUInteger) -> UTF32Char;
289
290        #[cfg(feature = "NSTextContainer")]
291        #[unsafe(method(boundingBoxForControlGlyphAtIndex:forTextContainer:proposedLineFragment:glyphPosition:characterIndex:))]
292        #[unsafe(method_family = none)]
293        pub fn boundingBoxForControlGlyphAtIndex_forTextContainer_proposedLineFragment_glyphPosition_characterIndex(
294            &self,
295            glyph_index: NSUInteger,
296            text_container: &NSTextContainer,
297            proposed_rect: NSRect,
298            glyph_position: NSPoint,
299            char_index: NSUInteger,
300        ) -> NSRect;
301    );
302}
303
304/// NSGlyphStorageInterface.
305#[cfg(feature = "NSTypesetter")]
306impl NSATSTypesetter {
307    extern_methods!(
308        #[cfg(all(feature = "NSFont", feature = "NSLayoutManager"))]
309        /// # Safety
310        ///
311        /// - `glyph_buffer` must be a valid pointer.
312        /// - `char_index_buffer` must be a valid pointer.
313        /// - `inscribe_buffer` must be a valid pointer.
314        /// - `elastic_buffer` must be a valid pointer.
315        #[deprecated]
316        #[unsafe(method(getGlyphsInRange:glyphs:characterIndexes:glyphInscriptions:elasticBits:))]
317        #[unsafe(method_family = none)]
318        pub unsafe fn getGlyphsInRange_glyphs_characterIndexes_glyphInscriptions_elasticBits(
319            &self,
320            glyphs_range: NSRange,
321            glyph_buffer: *mut NSGlyph,
322            char_index_buffer: *mut NSUInteger,
323            inscribe_buffer: *mut NSGlyphInscription,
324            elastic_buffer: *mut Bool,
325        ) -> NSUInteger;
326    );
327}