objc2_app_kit/generated/
NSLayoutManager.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::*;
8#[cfg(feature = "objc2-core-graphics")]
9#[cfg(target_vendor = "apple")]
10use objc2_core_graphics::*;
11use objc2_foundation::*;
12
13use crate::*;
14
15/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextlayoutorientation?language=objc)
16// NS_ENUM
17#[repr(transparent)]
18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
19pub struct NSTextLayoutOrientation(pub NSInteger);
20impl NSTextLayoutOrientation {
21    #[doc(alias = "NSTextLayoutOrientationHorizontal")]
22    pub const Horizontal: Self = Self(0);
23    #[doc(alias = "NSTextLayoutOrientationVertical")]
24    pub const Vertical: Self = Self(1);
25}
26
27unsafe impl Encode for NSTextLayoutOrientation {
28    const ENCODING: Encoding = NSInteger::ENCODING;
29}
30
31unsafe impl RefEncode for NSTextLayoutOrientation {
32    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
33}
34
35/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsglyphproperty?language=objc)
36// NS_OPTIONS
37#[repr(transparent)]
38#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
39pub struct NSGlyphProperty(pub NSInteger);
40bitflags::bitflags! {
41    impl NSGlyphProperty: NSInteger {
42        #[doc(alias = "NSGlyphPropertyNull")]
43        const Null = 1<<0;
44        #[doc(alias = "NSGlyphPropertyControlCharacter")]
45        const ControlCharacter = 1<<1;
46        #[doc(alias = "NSGlyphPropertyElastic")]
47        const Elastic = 1<<2;
48        #[doc(alias = "NSGlyphPropertyNonBaseCharacter")]
49        const NonBaseCharacter = 1<<3;
50    }
51}
52
53unsafe impl Encode for NSGlyphProperty {
54    const ENCODING: Encoding = NSInteger::ENCODING;
55}
56
57unsafe impl RefEncode for NSGlyphProperty {
58    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
59}
60
61/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscontrolcharacteraction?language=objc)
62// NS_OPTIONS
63#[repr(transparent)]
64#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
65pub struct NSControlCharacterAction(pub NSInteger);
66bitflags::bitflags! {
67    impl NSControlCharacterAction: NSInteger {
68        #[doc(alias = "NSControlCharacterActionZeroAdvancement")]
69        const ZeroAdvancement = 1<<0;
70        #[doc(alias = "NSControlCharacterActionWhitespace")]
71        const Whitespace = 1<<1;
72        #[doc(alias = "NSControlCharacterActionHorizontalTab")]
73        const HorizontalTab = 1<<2;
74        #[doc(alias = "NSControlCharacterActionLineBreak")]
75        const LineBreak = 1<<3;
76        #[doc(alias = "NSControlCharacterActionParagraphBreak")]
77        const ParagraphBreak = 1<<4;
78        #[doc(alias = "NSControlCharacterActionContainerBreak")]
79        const ContainerBreak = 1<<5;
80    }
81}
82
83unsafe impl Encode for NSControlCharacterAction {
84    const ENCODING: Encoding = NSInteger::ENCODING;
85}
86
87unsafe impl RefEncode for NSControlCharacterAction {
88    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
89}
90
91extern_protocol!(
92    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextlayoutorientationprovider?language=objc)
93    pub unsafe trait NSTextLayoutOrientationProvider {
94        #[unsafe(method(layoutOrientation))]
95        #[unsafe(method_family = none)]
96        fn layoutOrientation(&self) -> NSTextLayoutOrientation;
97    }
98);
99
100/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstypesetterbehavior?language=objc)
101// NS_ENUM
102#[repr(transparent)]
103#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
104pub struct NSTypesetterBehavior(pub NSInteger);
105impl NSTypesetterBehavior {
106    #[doc(alias = "NSTypesetterLatestBehavior")]
107    pub const LatestBehavior: Self = Self(-1);
108    #[doc(alias = "NSTypesetterOriginalBehavior")]
109    pub const OriginalBehavior: Self = Self(0);
110    #[doc(alias = "NSTypesetterBehavior_10_2_WithCompatibility")]
111    pub const Behavior_10_2_WithCompatibility: Self = Self(1);
112    #[doc(alias = "NSTypesetterBehavior_10_2")]
113    pub const Behavior_10_2: Self = Self(2);
114    #[doc(alias = "NSTypesetterBehavior_10_3")]
115    pub const Behavior_10_3: Self = Self(3);
116    #[doc(alias = "NSTypesetterBehavior_10_4")]
117    pub const Behavior_10_4: Self = Self(4);
118}
119
120unsafe impl Encode for NSTypesetterBehavior {
121    const ENCODING: Encoding = NSInteger::ENCODING;
122}
123
124unsafe impl RefEncode for NSTypesetterBehavior {
125    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
126}
127
128extern_class!(
129    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nslayoutmanager?language=objc)
130    #[unsafe(super(NSObject))]
131    #[derive(Debug, PartialEq, Eq, Hash)]
132    pub struct NSLayoutManager;
133);
134
135extern_conformance!(
136    unsafe impl NSCoding for NSLayoutManager {}
137);
138
139extern_conformance!(
140    unsafe impl NSObjectProtocol for NSLayoutManager {}
141);
142
143extern_conformance!(
144    unsafe impl NSSecureCoding for NSLayoutManager {}
145);
146
147impl NSLayoutManager {
148    extern_methods!(
149        /// ************************** Initialization ***************************
150        #[unsafe(method(init))]
151        #[unsafe(method_family = init)]
152        pub fn init(this: Allocated<Self>) -> Retained<Self>;
153
154        /// # Safety
155        ///
156        /// `coder` possibly has further requirements.
157        #[unsafe(method(initWithCoder:))]
158        #[unsafe(method_family = init)]
159        pub unsafe fn initWithCoder(
160            this: Allocated<Self>,
161            coder: &NSCoder,
162        ) -> Option<Retained<Self>>;
163
164        #[cfg(feature = "NSTextStorage")]
165        /// ************************* Text storage **************************
166        ///
167        /// # Safety
168        ///
169        /// This is not retained internally, you must ensure the object is still alive.
170        #[unsafe(method(textStorage))]
171        #[unsafe(method_family = none)]
172        pub unsafe fn textStorage(&self) -> Option<Retained<NSTextStorage>>;
173
174        #[cfg(feature = "NSTextStorage")]
175        /// Setter for [`textStorage`][Self::textStorage].
176        ///
177        /// # Safety
178        ///
179        /// This is unretained, you must ensure the object is kept alive while in use.
180        #[unsafe(method(setTextStorage:))]
181        #[unsafe(method_family = none)]
182        pub unsafe fn setTextStorage(&self, text_storage: Option<&NSTextStorage>);
183
184        #[cfg(feature = "NSTextStorage")]
185        #[unsafe(method(replaceTextStorage:))]
186        #[unsafe(method_family = none)]
187        pub fn replaceTextStorage(&self, new_text_storage: &NSTextStorage);
188
189        #[cfg(feature = "NSTextContainer")]
190        /// ************************** Text containers ***************************
191        #[unsafe(method(textContainers))]
192        #[unsafe(method_family = none)]
193        pub fn textContainers(&self) -> Retained<NSArray<NSTextContainer>>;
194
195        #[cfg(feature = "NSTextContainer")]
196        #[unsafe(method(addTextContainer:))]
197        #[unsafe(method_family = none)]
198        pub fn addTextContainer(&self, container: &NSTextContainer);
199
200        #[cfg(feature = "NSTextContainer")]
201        #[unsafe(method(insertTextContainer:atIndex:))]
202        #[unsafe(method_family = none)]
203        pub fn insertTextContainer_atIndex(&self, container: &NSTextContainer, index: NSUInteger);
204
205        #[unsafe(method(removeTextContainerAtIndex:))]
206        #[unsafe(method_family = none)]
207        pub fn removeTextContainerAtIndex(&self, index: NSUInteger);
208
209        #[cfg(feature = "NSTextContainer")]
210        #[unsafe(method(textContainerChangedGeometry:))]
211        #[unsafe(method_family = none)]
212        pub fn textContainerChangedGeometry(&self, container: &NSTextContainer);
213
214        #[cfg(feature = "NSTextContainer")]
215        #[unsafe(method(textContainerChangedTextView:))]
216        #[unsafe(method_family = none)]
217        pub fn textContainerChangedTextView(&self, container: &NSTextContainer);
218
219        /// ************************** Delegate ***************************
220        #[unsafe(method(delegate))]
221        #[unsafe(method_family = none)]
222        pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSLayoutManagerDelegate>>>;
223
224        /// Setter for [`delegate`][Self::delegate].
225        ///
226        /// This is a [weak property][objc2::topics::weak_property].
227        #[unsafe(method(setDelegate:))]
228        #[unsafe(method_family = none)]
229        pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NSLayoutManagerDelegate>>);
230
231        /// ********************* Global layout manager options **********************
232        #[unsafe(method(showsInvisibleCharacters))]
233        #[unsafe(method_family = none)]
234        pub fn showsInvisibleCharacters(&self) -> bool;
235
236        /// Setter for [`showsInvisibleCharacters`][Self::showsInvisibleCharacters].
237        #[unsafe(method(setShowsInvisibleCharacters:))]
238        #[unsafe(method_family = none)]
239        pub fn setShowsInvisibleCharacters(&self, shows_invisible_characters: bool);
240
241        #[unsafe(method(showsControlCharacters))]
242        #[unsafe(method_family = none)]
243        pub fn showsControlCharacters(&self) -> bool;
244
245        /// Setter for [`showsControlCharacters`][Self::showsControlCharacters].
246        #[unsafe(method(setShowsControlCharacters:))]
247        #[unsafe(method_family = none)]
248        pub fn setShowsControlCharacters(&self, shows_control_characters: bool);
249
250        #[unsafe(method(usesDefaultHyphenation))]
251        #[unsafe(method_family = none)]
252        pub fn usesDefaultHyphenation(&self) -> bool;
253
254        /// Setter for [`usesDefaultHyphenation`][Self::usesDefaultHyphenation].
255        #[unsafe(method(setUsesDefaultHyphenation:))]
256        #[unsafe(method_family = none)]
257        pub fn setUsesDefaultHyphenation(&self, uses_default_hyphenation: bool);
258
259        #[unsafe(method(usesFontLeading))]
260        #[unsafe(method_family = none)]
261        pub fn usesFontLeading(&self) -> bool;
262
263        /// Setter for [`usesFontLeading`][Self::usesFontLeading].
264        #[unsafe(method(setUsesFontLeading:))]
265        #[unsafe(method_family = none)]
266        pub fn setUsesFontLeading(&self, uses_font_leading: bool);
267
268        #[unsafe(method(allowsNonContiguousLayout))]
269        #[unsafe(method_family = none)]
270        pub fn allowsNonContiguousLayout(&self) -> bool;
271
272        /// Setter for [`allowsNonContiguousLayout`][Self::allowsNonContiguousLayout].
273        #[unsafe(method(setAllowsNonContiguousLayout:))]
274        #[unsafe(method_family = none)]
275        pub fn setAllowsNonContiguousLayout(&self, allows_non_contiguous_layout: bool);
276
277        #[unsafe(method(hasNonContiguousLayout))]
278        #[unsafe(method_family = none)]
279        pub fn hasNonContiguousLayout(&self) -> bool;
280
281        #[unsafe(method(limitsLayoutForSuspiciousContents))]
282        #[unsafe(method_family = none)]
283        pub fn limitsLayoutForSuspiciousContents(&self) -> bool;
284
285        /// Setter for [`limitsLayoutForSuspiciousContents`][Self::limitsLayoutForSuspiciousContents].
286        #[unsafe(method(setLimitsLayoutForSuspiciousContents:))]
287        #[unsafe(method_family = none)]
288        pub fn setLimitsLayoutForSuspiciousContents(
289            &self,
290            limits_layout_for_suspicious_contents: bool,
291        );
292
293        #[unsafe(method(backgroundLayoutEnabled))]
294        #[unsafe(method_family = none)]
295        pub fn backgroundLayoutEnabled(&self) -> bool;
296
297        /// Setter for [`backgroundLayoutEnabled`][Self::backgroundLayoutEnabled].
298        #[unsafe(method(setBackgroundLayoutEnabled:))]
299        #[unsafe(method_family = none)]
300        pub fn setBackgroundLayoutEnabled(&self, background_layout_enabled: bool);
301
302        #[cfg(feature = "NSCell")]
303        #[unsafe(method(defaultAttachmentScaling))]
304        #[unsafe(method_family = none)]
305        pub fn defaultAttachmentScaling(&self) -> NSImageScaling;
306
307        #[cfg(feature = "NSCell")]
308        /// Setter for [`defaultAttachmentScaling`][Self::defaultAttachmentScaling].
309        #[unsafe(method(setDefaultAttachmentScaling:))]
310        #[unsafe(method_family = none)]
311        pub fn setDefaultAttachmentScaling(&self, default_attachment_scaling: NSImageScaling);
312
313        #[cfg(feature = "NSTypesetter")]
314        /// ********************* Typesetter **********************
315        #[unsafe(method(typesetter))]
316        #[unsafe(method_family = none)]
317        pub fn typesetter(&self) -> Retained<NSTypesetter>;
318
319        #[cfg(feature = "NSTypesetter")]
320        /// Setter for [`typesetter`][Self::typesetter].
321        #[unsafe(method(setTypesetter:))]
322        #[unsafe(method_family = none)]
323        pub fn setTypesetter(&self, typesetter: &NSTypesetter);
324
325        #[unsafe(method(typesetterBehavior))]
326        #[unsafe(method_family = none)]
327        pub fn typesetterBehavior(&self) -> NSTypesetterBehavior;
328
329        /// Setter for [`typesetterBehavior`][Self::typesetterBehavior].
330        #[unsafe(method(setTypesetterBehavior:))]
331        #[unsafe(method_family = none)]
332        pub fn setTypesetterBehavior(&self, typesetter_behavior: NSTypesetterBehavior);
333
334        /// ************************ Invalidation *************************
335        ///
336        /// # Safety
337        ///
338        /// `actual_char_range` must be a valid pointer or null.
339        #[unsafe(method(invalidateGlyphsForCharacterRange:changeInLength:actualCharacterRange:))]
340        #[unsafe(method_family = none)]
341        pub unsafe fn invalidateGlyphsForCharacterRange_changeInLength_actualCharacterRange(
342            &self,
343            char_range: NSRange,
344            delta: NSInteger,
345            actual_char_range: NSRangePointer,
346        );
347
348        /// # Safety
349        ///
350        /// `actual_char_range` must be a valid pointer or null.
351        #[unsafe(method(invalidateLayoutForCharacterRange:actualCharacterRange:))]
352        #[unsafe(method_family = none)]
353        pub unsafe fn invalidateLayoutForCharacterRange_actualCharacterRange(
354            &self,
355            char_range: NSRange,
356            actual_char_range: NSRangePointer,
357        );
358
359        #[unsafe(method(invalidateDisplayForCharacterRange:))]
360        #[unsafe(method_family = none)]
361        pub fn invalidateDisplayForCharacterRange(&self, char_range: NSRange);
362
363        #[unsafe(method(invalidateDisplayForGlyphRange:))]
364        #[unsafe(method_family = none)]
365        pub fn invalidateDisplayForGlyphRange(&self, glyph_range: NSRange);
366
367        #[cfg(feature = "NSTextStorage")]
368        #[unsafe(method(processEditingForTextStorage:edited:range:changeInLength:invalidatedRange:))]
369        #[unsafe(method_family = none)]
370        pub fn processEditingForTextStorage_edited_range_changeInLength_invalidatedRange(
371            &self,
372            text_storage: &NSTextStorage,
373            edit_mask: NSTextStorageEditActions,
374            new_char_range: NSRange,
375            delta: NSInteger,
376            invalidated_char_range: NSRange,
377        );
378
379        /// ********************** Causing glyph generation and layout ***********************
380        #[unsafe(method(ensureGlyphsForCharacterRange:))]
381        #[unsafe(method_family = none)]
382        pub fn ensureGlyphsForCharacterRange(&self, char_range: NSRange);
383
384        #[unsafe(method(ensureGlyphsForGlyphRange:))]
385        #[unsafe(method_family = none)]
386        pub fn ensureGlyphsForGlyphRange(&self, glyph_range: NSRange);
387
388        #[unsafe(method(ensureLayoutForCharacterRange:))]
389        #[unsafe(method_family = none)]
390        pub fn ensureLayoutForCharacterRange(&self, char_range: NSRange);
391
392        #[unsafe(method(ensureLayoutForGlyphRange:))]
393        #[unsafe(method_family = none)]
394        pub fn ensureLayoutForGlyphRange(&self, glyph_range: NSRange);
395
396        #[cfg(feature = "NSTextContainer")]
397        #[unsafe(method(ensureLayoutForTextContainer:))]
398        #[unsafe(method_family = none)]
399        pub fn ensureLayoutForTextContainer(&self, container: &NSTextContainer);
400
401        #[cfg(feature = "NSTextContainer")]
402        #[unsafe(method(ensureLayoutForBoundingRect:inTextContainer:))]
403        #[unsafe(method_family = none)]
404        pub fn ensureLayoutForBoundingRect_inTextContainer(
405            &self,
406            bounds: NSRect,
407            container: &NSTextContainer,
408        );
409
410        #[cfg(all(feature = "NSFont", feature = "objc2-core-graphics"))]
411        #[cfg(target_vendor = "apple")]
412        /// ********************** Set glyphs and glyph properties ***********************
413        ///
414        /// # Safety
415        ///
416        /// - `glyphs` must be a valid pointer.
417        /// - `props` must be a valid pointer.
418        /// - `char_indexes` must be a valid pointer.
419        #[unsafe(method(setGlyphs:properties:characterIndexes:font:forGlyphRange:))]
420        #[unsafe(method_family = none)]
421        pub unsafe fn setGlyphs_properties_characterIndexes_font_forGlyphRange(
422            &self,
423            glyphs: NonNull<CGGlyph>,
424            props: NonNull<NSGlyphProperty>,
425            char_indexes: NonNull<NSUInteger>,
426            a_font: &NSFont,
427            glyph_range: NSRange,
428        );
429
430        /// ********************** Get glyphs and glyph properties ***********************
431        #[unsafe(method(numberOfGlyphs))]
432        #[unsafe(method_family = none)]
433        pub fn numberOfGlyphs(&self) -> NSUInteger;
434
435        #[cfg(feature = "objc2-core-graphics")]
436        #[cfg(target_vendor = "apple")]
437        /// # Safety
438        ///
439        /// `is_valid_index` must be a valid pointer or null.
440        #[unsafe(method(CGGlyphAtIndex:isValidIndex:))]
441        #[unsafe(method_family = none)]
442        pub unsafe fn CGGlyphAtIndex_isValidIndex(
443            &self,
444            glyph_index: NSUInteger,
445            is_valid_index: *mut Bool,
446        ) -> CGGlyph;
447
448        #[cfg(feature = "objc2-core-graphics")]
449        #[cfg(target_vendor = "apple")]
450        #[unsafe(method(CGGlyphAtIndex:))]
451        #[unsafe(method_family = none)]
452        pub fn CGGlyphAtIndex(&self, glyph_index: NSUInteger) -> CGGlyph;
453
454        #[unsafe(method(isValidGlyphIndex:))]
455        #[unsafe(method_family = none)]
456        pub fn isValidGlyphIndex(&self, glyph_index: NSUInteger) -> bool;
457
458        #[unsafe(method(propertyForGlyphAtIndex:))]
459        #[unsafe(method_family = none)]
460        pub fn propertyForGlyphAtIndex(&self, glyph_index: NSUInteger) -> NSGlyphProperty;
461
462        #[unsafe(method(characterIndexForGlyphAtIndex:))]
463        #[unsafe(method_family = none)]
464        pub fn characterIndexForGlyphAtIndex(&self, glyph_index: NSUInteger) -> NSUInteger;
465
466        #[unsafe(method(glyphIndexForCharacterAtIndex:))]
467        #[unsafe(method_family = none)]
468        pub fn glyphIndexForCharacterAtIndex(&self, char_index: NSUInteger) -> NSUInteger;
469
470        #[cfg(feature = "objc2-core-graphics")]
471        #[cfg(target_vendor = "apple")]
472        /// # Safety
473        ///
474        /// - `glyph_buffer` must be a valid pointer or null.
475        /// - `props` must be a valid pointer or null.
476        /// - `char_index_buffer` must be a valid pointer or null.
477        /// - `bidi_level_buffer` must be a valid pointer or null.
478        #[unsafe(method(getGlyphsInRange:glyphs:properties:characterIndexes:bidiLevels:))]
479        #[unsafe(method_family = none)]
480        pub unsafe fn getGlyphsInRange_glyphs_properties_characterIndexes_bidiLevels(
481            &self,
482            glyph_range: NSRange,
483            glyph_buffer: *mut CGGlyph,
484            props: *mut NSGlyphProperty,
485            char_index_buffer: *mut NSUInteger,
486            bidi_level_buffer: *mut c_uchar,
487        ) -> NSUInteger;
488
489        #[cfg(feature = "NSTextContainer")]
490        #[unsafe(method(setTextContainer:forGlyphRange:))]
491        #[unsafe(method_family = none)]
492        pub fn setTextContainer_forGlyphRange(
493            &self,
494            container: &NSTextContainer,
495            glyph_range: NSRange,
496        );
497
498        #[unsafe(method(setLineFragmentRect:forGlyphRange:usedRect:))]
499        #[unsafe(method_family = none)]
500        pub fn setLineFragmentRect_forGlyphRange_usedRect(
501            &self,
502            fragment_rect: NSRect,
503            glyph_range: NSRange,
504            used_rect: NSRect,
505        );
506
507        #[cfg(feature = "NSTextContainer")]
508        #[unsafe(method(setExtraLineFragmentRect:usedRect:textContainer:))]
509        #[unsafe(method_family = none)]
510        pub fn setExtraLineFragmentRect_usedRect_textContainer(
511            &self,
512            fragment_rect: NSRect,
513            used_rect: NSRect,
514            container: &NSTextContainer,
515        );
516
517        #[unsafe(method(setLocation:forStartOfGlyphRange:))]
518        #[unsafe(method_family = none)]
519        pub fn setLocation_forStartOfGlyphRange(&self, location: NSPoint, glyph_range: NSRange);
520
521        #[unsafe(method(setNotShownAttribute:forGlyphAtIndex:))]
522        #[unsafe(method_family = none)]
523        pub fn setNotShownAttribute_forGlyphAtIndex(&self, flag: bool, glyph_index: NSUInteger);
524
525        #[unsafe(method(setDrawsOutsideLineFragment:forGlyphAtIndex:))]
526        #[unsafe(method_family = none)]
527        pub fn setDrawsOutsideLineFragment_forGlyphAtIndex(
528            &self,
529            flag: bool,
530            glyph_index: NSUInteger,
531        );
532
533        #[unsafe(method(setAttachmentSize:forGlyphRange:))]
534        #[unsafe(method_family = none)]
535        pub fn setAttachmentSize_forGlyphRange(
536            &self,
537            attachment_size: NSSize,
538            glyph_range: NSRange,
539        );
540
541        /// ********************** Get layout information ***********************
542        ///
543        /// # Safety
544        ///
545        /// - `char_index` must be a valid pointer or null.
546        /// - `glyph_index` must be a valid pointer or null.
547        #[unsafe(method(getFirstUnlaidCharacterIndex:glyphIndex:))]
548        #[unsafe(method_family = none)]
549        pub unsafe fn getFirstUnlaidCharacterIndex_glyphIndex(
550            &self,
551            char_index: *mut NSUInteger,
552            glyph_index: *mut NSUInteger,
553        );
554
555        #[unsafe(method(firstUnlaidCharacterIndex))]
556        #[unsafe(method_family = none)]
557        pub fn firstUnlaidCharacterIndex(&self) -> NSUInteger;
558
559        #[unsafe(method(firstUnlaidGlyphIndex))]
560        #[unsafe(method_family = none)]
561        pub fn firstUnlaidGlyphIndex(&self) -> NSUInteger;
562
563        #[cfg(feature = "NSTextContainer")]
564        /// # Safety
565        ///
566        /// `effective_glyph_range` must be a valid pointer or null.
567        #[unsafe(method(textContainerForGlyphAtIndex:effectiveRange:))]
568        #[unsafe(method_family = none)]
569        pub unsafe fn textContainerForGlyphAtIndex_effectiveRange(
570            &self,
571            glyph_index: NSUInteger,
572            effective_glyph_range: NSRangePointer,
573        ) -> Option<Retained<NSTextContainer>>;
574
575        #[cfg(feature = "NSTextContainer")]
576        /// # Safety
577        ///
578        /// `effective_glyph_range` must be a valid pointer or null.
579        #[unsafe(method(textContainerForGlyphAtIndex:effectiveRange:withoutAdditionalLayout:))]
580        #[unsafe(method_family = none)]
581        pub unsafe fn textContainerForGlyphAtIndex_effectiveRange_withoutAdditionalLayout(
582            &self,
583            glyph_index: NSUInteger,
584            effective_glyph_range: NSRangePointer,
585            flag: bool,
586        ) -> Option<Retained<NSTextContainer>>;
587
588        #[cfg(feature = "NSTextContainer")]
589        #[unsafe(method(usedRectForTextContainer:))]
590        #[unsafe(method_family = none)]
591        pub fn usedRectForTextContainer(&self, container: &NSTextContainer) -> NSRect;
592
593        /// # Safety
594        ///
595        /// `effective_glyph_range` must be a valid pointer or null.
596        #[unsafe(method(lineFragmentRectForGlyphAtIndex:effectiveRange:))]
597        #[unsafe(method_family = none)]
598        pub unsafe fn lineFragmentRectForGlyphAtIndex_effectiveRange(
599            &self,
600            glyph_index: NSUInteger,
601            effective_glyph_range: NSRangePointer,
602        ) -> NSRect;
603
604        /// # Safety
605        ///
606        /// `effective_glyph_range` must be a valid pointer or null.
607        #[unsafe(method(lineFragmentRectForGlyphAtIndex:effectiveRange:withoutAdditionalLayout:))]
608        #[unsafe(method_family = none)]
609        pub unsafe fn lineFragmentRectForGlyphAtIndex_effectiveRange_withoutAdditionalLayout(
610            &self,
611            glyph_index: NSUInteger,
612            effective_glyph_range: NSRangePointer,
613            flag: bool,
614        ) -> NSRect;
615
616        /// # Safety
617        ///
618        /// `effective_glyph_range` must be a valid pointer or null.
619        #[unsafe(method(lineFragmentUsedRectForGlyphAtIndex:effectiveRange:))]
620        #[unsafe(method_family = none)]
621        pub unsafe fn lineFragmentUsedRectForGlyphAtIndex_effectiveRange(
622            &self,
623            glyph_index: NSUInteger,
624            effective_glyph_range: NSRangePointer,
625        ) -> NSRect;
626
627        /// # Safety
628        ///
629        /// `effective_glyph_range` must be a valid pointer or null.
630        #[unsafe(method(lineFragmentUsedRectForGlyphAtIndex:effectiveRange:withoutAdditionalLayout:))]
631        #[unsafe(method_family = none)]
632        pub unsafe fn lineFragmentUsedRectForGlyphAtIndex_effectiveRange_withoutAdditionalLayout(
633            &self,
634            glyph_index: NSUInteger,
635            effective_glyph_range: NSRangePointer,
636            flag: bool,
637        ) -> NSRect;
638
639        #[unsafe(method(extraLineFragmentRect))]
640        #[unsafe(method_family = none)]
641        pub fn extraLineFragmentRect(&self) -> NSRect;
642
643        #[unsafe(method(extraLineFragmentUsedRect))]
644        #[unsafe(method_family = none)]
645        pub fn extraLineFragmentUsedRect(&self) -> NSRect;
646
647        #[cfg(feature = "NSTextContainer")]
648        #[unsafe(method(extraLineFragmentTextContainer))]
649        #[unsafe(method_family = none)]
650        pub fn extraLineFragmentTextContainer(&self) -> Option<Retained<NSTextContainer>>;
651
652        #[unsafe(method(locationForGlyphAtIndex:))]
653        #[unsafe(method_family = none)]
654        pub fn locationForGlyphAtIndex(&self, glyph_index: NSUInteger) -> NSPoint;
655
656        #[unsafe(method(notShownAttributeForGlyphAtIndex:))]
657        #[unsafe(method_family = none)]
658        pub fn notShownAttributeForGlyphAtIndex(&self, glyph_index: NSUInteger) -> bool;
659
660        #[unsafe(method(drawsOutsideLineFragmentForGlyphAtIndex:))]
661        #[unsafe(method_family = none)]
662        pub fn drawsOutsideLineFragmentForGlyphAtIndex(&self, glyph_index: NSUInteger) -> bool;
663
664        #[unsafe(method(attachmentSizeForGlyphAtIndex:))]
665        #[unsafe(method_family = none)]
666        pub fn attachmentSizeForGlyphAtIndex(&self, glyph_index: NSUInteger) -> NSSize;
667
668        #[unsafe(method(truncatedGlyphRangeInLineFragmentForGlyphAtIndex:))]
669        #[unsafe(method_family = none)]
670        pub fn truncatedGlyphRangeInLineFragmentForGlyphAtIndex(
671            &self,
672            glyph_index: NSUInteger,
673        ) -> NSRange;
674
675        /// ********************** More sophisticated queries ***********************
676        ///
677        /// # Safety
678        ///
679        /// `actual_char_range` must be a valid pointer or null.
680        #[unsafe(method(glyphRangeForCharacterRange:actualCharacterRange:))]
681        #[unsafe(method_family = none)]
682        pub unsafe fn glyphRangeForCharacterRange_actualCharacterRange(
683            &self,
684            char_range: NSRange,
685            actual_char_range: NSRangePointer,
686        ) -> NSRange;
687
688        /// # Safety
689        ///
690        /// `actual_glyph_range` must be a valid pointer or null.
691        #[unsafe(method(characterRangeForGlyphRange:actualGlyphRange:))]
692        #[unsafe(method_family = none)]
693        pub unsafe fn characterRangeForGlyphRange_actualGlyphRange(
694            &self,
695            glyph_range: NSRange,
696            actual_glyph_range: NSRangePointer,
697        ) -> NSRange;
698
699        #[cfg(feature = "NSTextContainer")]
700        #[unsafe(method(glyphRangeForTextContainer:))]
701        #[unsafe(method_family = none)]
702        pub fn glyphRangeForTextContainer(&self, container: &NSTextContainer) -> NSRange;
703
704        #[unsafe(method(rangeOfNominallySpacedGlyphsContainingIndex:))]
705        #[unsafe(method_family = none)]
706        pub fn rangeOfNominallySpacedGlyphsContainingIndex(
707            &self,
708            glyph_index: NSUInteger,
709        ) -> NSRange;
710
711        #[cfg(feature = "NSTextContainer")]
712        #[unsafe(method(boundingRectForGlyphRange:inTextContainer:))]
713        #[unsafe(method_family = none)]
714        pub fn boundingRectForGlyphRange_inTextContainer(
715            &self,
716            glyph_range: NSRange,
717            container: &NSTextContainer,
718        ) -> NSRect;
719
720        #[cfg(feature = "NSTextContainer")]
721        #[unsafe(method(glyphRangeForBoundingRect:inTextContainer:))]
722        #[unsafe(method_family = none)]
723        pub fn glyphRangeForBoundingRect_inTextContainer(
724            &self,
725            bounds: NSRect,
726            container: &NSTextContainer,
727        ) -> NSRange;
728
729        #[cfg(feature = "NSTextContainer")]
730        #[unsafe(method(glyphRangeForBoundingRectWithoutAdditionalLayout:inTextContainer:))]
731        #[unsafe(method_family = none)]
732        pub fn glyphRangeForBoundingRectWithoutAdditionalLayout_inTextContainer(
733            &self,
734            bounds: NSRect,
735            container: &NSTextContainer,
736        ) -> NSRange;
737
738        #[cfg(all(feature = "NSTextContainer", feature = "objc2-core-foundation"))]
739        /// # Safety
740        ///
741        /// `partial_fraction` must be a valid pointer or null.
742        #[unsafe(method(glyphIndexForPoint:inTextContainer:fractionOfDistanceThroughGlyph:))]
743        #[unsafe(method_family = none)]
744        pub unsafe fn glyphIndexForPoint_inTextContainer_fractionOfDistanceThroughGlyph(
745            &self,
746            point: NSPoint,
747            container: &NSTextContainer,
748            partial_fraction: *mut CGFloat,
749        ) -> NSUInteger;
750
751        #[cfg(feature = "NSTextContainer")]
752        #[unsafe(method(glyphIndexForPoint:inTextContainer:))]
753        #[unsafe(method_family = none)]
754        pub fn glyphIndexForPoint_inTextContainer(
755            &self,
756            point: NSPoint,
757            container: &NSTextContainer,
758        ) -> NSUInteger;
759
760        #[cfg(all(feature = "NSTextContainer", feature = "objc2-core-foundation"))]
761        #[unsafe(method(fractionOfDistanceThroughGlyphForPoint:inTextContainer:))]
762        #[unsafe(method_family = none)]
763        pub fn fractionOfDistanceThroughGlyphForPoint_inTextContainer(
764            &self,
765            point: NSPoint,
766            container: &NSTextContainer,
767        ) -> CGFloat;
768
769        #[cfg(all(feature = "NSTextContainer", feature = "objc2-core-foundation"))]
770        /// # Safety
771        ///
772        /// `partial_fraction` must be a valid pointer or null.
773        #[unsafe(method(characterIndexForPoint:inTextContainer:fractionOfDistanceBetweenInsertionPoints:))]
774        #[unsafe(method_family = none)]
775        pub unsafe fn characterIndexForPoint_inTextContainer_fractionOfDistanceBetweenInsertionPoints(
776            &self,
777            point: NSPoint,
778            container: &NSTextContainer,
779            partial_fraction: *mut CGFloat,
780        ) -> NSUInteger;
781
782        #[cfg(feature = "objc2-core-foundation")]
783        /// # Safety
784        ///
785        /// - `positions` must be a valid pointer or null.
786        /// - `char_indexes` must be a valid pointer or null.
787        #[unsafe(method(getLineFragmentInsertionPointsForCharacterAtIndex:alternatePositions:inDisplayOrder:positions:characterIndexes:))]
788        #[unsafe(method_family = none)]
789        pub unsafe fn getLineFragmentInsertionPointsForCharacterAtIndex_alternatePositions_inDisplayOrder_positions_characterIndexes(
790            &self,
791            char_index: NSUInteger,
792            a_flag: bool,
793            d_flag: bool,
794            positions: *mut CGFloat,
795            char_indexes: *mut NSUInteger,
796        ) -> NSUInteger;
797
798        #[cfg(all(feature = "NSTextContainer", feature = "block2"))]
799        #[unsafe(method(enumerateLineFragmentsForGlyphRange:usingBlock:))]
800        #[unsafe(method_family = none)]
801        pub fn enumerateLineFragmentsForGlyphRange_usingBlock(
802            &self,
803            glyph_range: NSRange,
804            block: &block2::DynBlock<
805                dyn Fn(NSRect, NSRect, NonNull<NSTextContainer>, NSRange, NonNull<Bool>),
806            >,
807        );
808
809        #[cfg(all(feature = "NSTextContainer", feature = "block2"))]
810        #[unsafe(method(enumerateEnclosingRectsForGlyphRange:withinSelectedGlyphRange:inTextContainer:usingBlock:))]
811        #[unsafe(method_family = none)]
812        pub fn enumerateEnclosingRectsForGlyphRange_withinSelectedGlyphRange_inTextContainer_usingBlock(
813            &self,
814            glyph_range: NSRange,
815            selected_range: NSRange,
816            text_container: &NSTextContainer,
817            block: &block2::DynBlock<dyn Fn(NSRect, NonNull<Bool>)>,
818        );
819
820        /// ********************** Drawing support ***********************
821        #[unsafe(method(drawBackgroundForGlyphRange:atPoint:))]
822        #[unsafe(method_family = none)]
823        pub fn drawBackgroundForGlyphRange_atPoint(&self, glyphs_to_show: NSRange, origin: NSPoint);
824
825        #[unsafe(method(drawGlyphsForGlyphRange:atPoint:))]
826        #[unsafe(method_family = none)]
827        pub fn drawGlyphsForGlyphRange_atPoint(&self, glyphs_to_show: NSRange, origin: NSPoint);
828
829        #[cfg(all(
830            feature = "NSFont",
831            feature = "objc2-core-foundation",
832            feature = "objc2-core-graphics"
833        ))]
834        #[cfg(target_vendor = "apple")]
835        /// # Safety
836        ///
837        /// - `glyphs` must be a valid pointer.
838        /// - `positions` must be a valid pointer.
839        /// - `attributes` generic should be of the correct type.
840        #[unsafe(method(showCGGlyphs:positions:count:font:textMatrix:attributes:inContext:))]
841        #[unsafe(method_family = none)]
842        pub unsafe fn showCGGlyphs_positions_count_font_textMatrix_attributes_inContext(
843            &self,
844            glyphs: NonNull<CGGlyph>,
845            positions: NonNull<CGPoint>,
846            glyph_count: NSInteger,
847            font: &NSFont,
848            text_matrix: CGAffineTransform,
849            attributes: &NSDictionary<NSAttributedStringKey, AnyObject>,
850            cg_context: &CGContext,
851        );
852
853        #[cfg(feature = "NSColor")]
854        /// # Safety
855        ///
856        /// `rect_array` must be a valid pointer.
857        #[unsafe(method(fillBackgroundRectArray:count:forCharacterRange:color:))]
858        #[unsafe(method_family = none)]
859        pub unsafe fn fillBackgroundRectArray_count_forCharacterRange_color(
860            &self,
861            rect_array: NonNull<NSRect>,
862            rect_count: NSUInteger,
863            char_range: NSRange,
864            color: &NSColor,
865        );
866
867        #[cfg(all(feature = "NSAttributedString", feature = "objc2-core-foundation"))]
868        #[unsafe(method(drawUnderlineForGlyphRange:underlineType:baselineOffset:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:))]
869        #[unsafe(method_family = none)]
870        pub fn drawUnderlineForGlyphRange_underlineType_baselineOffset_lineFragmentRect_lineFragmentGlyphRange_containerOrigin(
871            &self,
872            glyph_range: NSRange,
873            underline_val: NSUnderlineStyle,
874            baseline_offset: CGFloat,
875            line_rect: NSRect,
876            line_glyph_range: NSRange,
877            container_origin: NSPoint,
878        );
879
880        #[cfg(feature = "NSAttributedString")]
881        #[unsafe(method(underlineGlyphRange:underlineType:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:))]
882        #[unsafe(method_family = none)]
883        pub fn underlineGlyphRange_underlineType_lineFragmentRect_lineFragmentGlyphRange_containerOrigin(
884            &self,
885            glyph_range: NSRange,
886            underline_val: NSUnderlineStyle,
887            line_rect: NSRect,
888            line_glyph_range: NSRange,
889            container_origin: NSPoint,
890        );
891
892        #[cfg(all(feature = "NSAttributedString", feature = "objc2-core-foundation"))]
893        #[unsafe(method(drawStrikethroughForGlyphRange:strikethroughType:baselineOffset:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:))]
894        #[unsafe(method_family = none)]
895        pub fn drawStrikethroughForGlyphRange_strikethroughType_baselineOffset_lineFragmentRect_lineFragmentGlyphRange_containerOrigin(
896            &self,
897            glyph_range: NSRange,
898            strikethrough_val: NSUnderlineStyle,
899            baseline_offset: CGFloat,
900            line_rect: NSRect,
901            line_glyph_range: NSRange,
902            container_origin: NSPoint,
903        );
904
905        #[cfg(feature = "NSAttributedString")]
906        #[unsafe(method(strikethroughGlyphRange:strikethroughType:lineFragmentRect:lineFragmentGlyphRange:containerOrigin:))]
907        #[unsafe(method_family = none)]
908        pub fn strikethroughGlyphRange_strikethroughType_lineFragmentRect_lineFragmentGlyphRange_containerOrigin(
909            &self,
910            glyph_range: NSRange,
911            strikethrough_val: NSUnderlineStyle,
912            line_rect: NSRect,
913            line_glyph_range: NSRange,
914            container_origin: NSPoint,
915        );
916
917        #[cfg(feature = "NSCell")]
918        #[unsafe(method(showAttachmentCell:inRect:characterIndex:))]
919        #[unsafe(method_family = none)]
920        pub fn showAttachmentCell_inRect_characterIndex(
921            &self,
922            cell: &NSCell,
923            rect: NSRect,
924            attachment_index: NSUInteger,
925        );
926
927        #[cfg(feature = "NSTextTable")]
928        /// ************************ Block information *************************
929        #[unsafe(method(setLayoutRect:forTextBlock:glyphRange:))]
930        #[unsafe(method_family = none)]
931        pub fn setLayoutRect_forTextBlock_glyphRange(
932            &self,
933            rect: NSRect,
934            block: &NSTextBlock,
935            glyph_range: NSRange,
936        );
937
938        #[cfg(feature = "NSTextTable")]
939        #[unsafe(method(setBoundsRect:forTextBlock:glyphRange:))]
940        #[unsafe(method_family = none)]
941        pub fn setBoundsRect_forTextBlock_glyphRange(
942            &self,
943            rect: NSRect,
944            block: &NSTextBlock,
945            glyph_range: NSRange,
946        );
947
948        #[cfg(feature = "NSTextTable")]
949        #[unsafe(method(layoutRectForTextBlock:glyphRange:))]
950        #[unsafe(method_family = none)]
951        pub fn layoutRectForTextBlock_glyphRange(
952            &self,
953            block: &NSTextBlock,
954            glyph_range: NSRange,
955        ) -> NSRect;
956
957        #[cfg(feature = "NSTextTable")]
958        #[unsafe(method(boundsRectForTextBlock:glyphRange:))]
959        #[unsafe(method_family = none)]
960        pub fn boundsRectForTextBlock_glyphRange(
961            &self,
962            block: &NSTextBlock,
963            glyph_range: NSRange,
964        ) -> NSRect;
965
966        #[cfg(feature = "NSTextTable")]
967        /// # Safety
968        ///
969        /// `effective_glyph_range` must be a valid pointer or null.
970        #[unsafe(method(layoutRectForTextBlock:atIndex:effectiveRange:))]
971        #[unsafe(method_family = none)]
972        pub unsafe fn layoutRectForTextBlock_atIndex_effectiveRange(
973            &self,
974            block: &NSTextBlock,
975            glyph_index: NSUInteger,
976            effective_glyph_range: NSRangePointer,
977        ) -> NSRect;
978
979        #[cfg(feature = "NSTextTable")]
980        /// # Safety
981        ///
982        /// `effective_glyph_range` must be a valid pointer or null.
983        #[unsafe(method(boundsRectForTextBlock:atIndex:effectiveRange:))]
984        #[unsafe(method_family = none)]
985        pub unsafe fn boundsRectForTextBlock_atIndex_effectiveRange(
986            &self,
987            block: &NSTextBlock,
988            glyph_index: NSUInteger,
989            effective_glyph_range: NSRangePointer,
990        ) -> NSRect;
991
992        /// ********************** Temporary attribute support ***********************
993        ///
994        /// # Safety
995        ///
996        /// `effective_char_range` must be a valid pointer or null.
997        #[unsafe(method(temporaryAttributesAtCharacterIndex:effectiveRange:))]
998        #[unsafe(method_family = none)]
999        pub unsafe fn temporaryAttributesAtCharacterIndex_effectiveRange(
1000            &self,
1001            char_index: NSUInteger,
1002            effective_char_range: NSRangePointer,
1003        ) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>;
1004
1005        /// # Safety
1006        ///
1007        /// `attrs` generic should be of the correct type.
1008        #[unsafe(method(setTemporaryAttributes:forCharacterRange:))]
1009        #[unsafe(method_family = none)]
1010        pub unsafe fn setTemporaryAttributes_forCharacterRange(
1011            &self,
1012            attrs: &NSDictionary<NSAttributedStringKey, AnyObject>,
1013            char_range: NSRange,
1014        );
1015
1016        /// # Safety
1017        ///
1018        /// `attrs` generic should be of the correct type.
1019        #[unsafe(method(addTemporaryAttributes:forCharacterRange:))]
1020        #[unsafe(method_family = none)]
1021        pub unsafe fn addTemporaryAttributes_forCharacterRange(
1022            &self,
1023            attrs: &NSDictionary<NSAttributedStringKey, AnyObject>,
1024            char_range: NSRange,
1025        );
1026
1027        #[unsafe(method(removeTemporaryAttribute:forCharacterRange:))]
1028        #[unsafe(method_family = none)]
1029        pub fn removeTemporaryAttribute_forCharacterRange(
1030            &self,
1031            attr_name: &NSAttributedStringKey,
1032            char_range: NSRange,
1033        );
1034
1035        /// # Safety
1036        ///
1037        /// `range` must be a valid pointer or null.
1038        #[unsafe(method(temporaryAttribute:atCharacterIndex:effectiveRange:))]
1039        #[unsafe(method_family = none)]
1040        pub unsafe fn temporaryAttribute_atCharacterIndex_effectiveRange(
1041            &self,
1042            attr_name: &NSAttributedStringKey,
1043            location: NSUInteger,
1044            range: NSRangePointer,
1045        ) -> Option<Retained<AnyObject>>;
1046
1047        /// # Safety
1048        ///
1049        /// `range` must be a valid pointer or null.
1050        #[unsafe(method(temporaryAttribute:atCharacterIndex:longestEffectiveRange:inRange:))]
1051        #[unsafe(method_family = none)]
1052        pub unsafe fn temporaryAttribute_atCharacterIndex_longestEffectiveRange_inRange(
1053            &self,
1054            attr_name: &NSAttributedStringKey,
1055            location: NSUInteger,
1056            range: NSRangePointer,
1057            range_limit: NSRange,
1058        ) -> Option<Retained<AnyObject>>;
1059
1060        /// # Safety
1061        ///
1062        /// `range` must be a valid pointer or null.
1063        #[unsafe(method(temporaryAttributesAtCharacterIndex:longestEffectiveRange:inRange:))]
1064        #[unsafe(method_family = none)]
1065        pub unsafe fn temporaryAttributesAtCharacterIndex_longestEffectiveRange_inRange(
1066            &self,
1067            location: NSUInteger,
1068            range: NSRangePointer,
1069            range_limit: NSRange,
1070        ) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>;
1071
1072        /// # Safety
1073        ///
1074        /// `value` should be of the correct type.
1075        #[unsafe(method(addTemporaryAttribute:value:forCharacterRange:))]
1076        #[unsafe(method_family = none)]
1077        pub unsafe fn addTemporaryAttribute_value_forCharacterRange(
1078            &self,
1079            attr_name: &NSAttributedStringKey,
1080            value: &AnyObject,
1081            char_range: NSRange,
1082        );
1083
1084        #[cfg(all(feature = "NSFont", feature = "objc2-core-foundation"))]
1085        /// ***************************** Font metrics *****************************
1086        #[unsafe(method(defaultLineHeightForFont:))]
1087        #[unsafe(method_family = none)]
1088        pub fn defaultLineHeightForFont(&self, the_font: &NSFont) -> CGFloat;
1089
1090        #[cfg(all(feature = "NSFont", feature = "objc2-core-foundation"))]
1091        #[unsafe(method(defaultBaselineOffsetForFont:))]
1092        #[unsafe(method_family = none)]
1093        pub fn defaultBaselineOffsetForFont(&self, the_font: &NSFont) -> CGFloat;
1094    );
1095}
1096
1097/// Methods declared on superclass `NSObject`.
1098impl NSLayoutManager {
1099    extern_methods!(
1100        #[unsafe(method(new))]
1101        #[unsafe(method_family = new)]
1102        pub fn new() -> Retained<Self>;
1103    );
1104}
1105
1106impl DefaultRetained for NSLayoutManager {
1107    #[inline]
1108    fn default_retained() -> Retained<Self> {
1109        Self::new()
1110    }
1111}
1112
1113/// NSTextViewSupport.
1114impl NSLayoutManager {
1115    extern_methods!(
1116        #[cfg(all(
1117            feature = "NSParagraphStyle",
1118            feature = "NSResponder",
1119            feature = "NSRulerMarker",
1120            feature = "NSRulerView",
1121            feature = "NSText",
1122            feature = "NSTextView",
1123            feature = "NSView"
1124        ))]
1125        /// *************************** Ruler support ****************************
1126        #[unsafe(method(rulerMarkersForTextView:paragraphStyle:ruler:))]
1127        #[unsafe(method_family = none)]
1128        pub fn rulerMarkersForTextView_paragraphStyle_ruler(
1129            &self,
1130            view: &NSTextView,
1131            style: &NSParagraphStyle,
1132            ruler: &NSRulerView,
1133        ) -> Retained<NSArray<NSRulerMarker>>;
1134
1135        #[cfg(all(
1136            feature = "NSParagraphStyle",
1137            feature = "NSResponder",
1138            feature = "NSRulerView",
1139            feature = "NSText",
1140            feature = "NSTextView",
1141            feature = "NSView"
1142        ))]
1143        #[unsafe(method(rulerAccessoryViewForTextView:paragraphStyle:ruler:enabled:))]
1144        #[unsafe(method_family = none)]
1145        pub fn rulerAccessoryViewForTextView_paragraphStyle_ruler_enabled(
1146            &self,
1147            view: &NSTextView,
1148            style: &NSParagraphStyle,
1149            ruler: &NSRulerView,
1150            is_enabled: bool,
1151        ) -> Option<Retained<NSView>>;
1152
1153        #[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
1154        /// ********************** First responder support ***********************
1155        #[unsafe(method(layoutManagerOwnsFirstResponderInWindow:))]
1156        #[unsafe(method_family = none)]
1157        pub fn layoutManagerOwnsFirstResponderInWindow(&self, window: &NSWindow) -> bool;
1158
1159        #[cfg(all(
1160            feature = "NSResponder",
1161            feature = "NSText",
1162            feature = "NSTextView",
1163            feature = "NSView"
1164        ))]
1165        /// # Safety
1166        ///
1167        /// This is not retained internally, you must ensure the object is still alive.
1168        #[unsafe(method(firstTextView))]
1169        #[unsafe(method_family = none)]
1170        pub unsafe fn firstTextView(&self, mtm: MainThreadMarker) -> Option<Retained<NSTextView>>;
1171
1172        #[cfg(all(
1173            feature = "NSResponder",
1174            feature = "NSText",
1175            feature = "NSTextView",
1176            feature = "NSView"
1177        ))]
1178        /// # Safety
1179        ///
1180        /// This is not retained internally, you must ensure the object is still alive.
1181        #[unsafe(method(textViewForBeginningOfSelection))]
1182        #[unsafe(method_family = none)]
1183        pub unsafe fn textViewForBeginningOfSelection(
1184            &self,
1185            mtm: MainThreadMarker,
1186        ) -> Option<Retained<NSTextView>>;
1187    );
1188}
1189
1190extern_protocol!(
1191    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nslayoutmanagerdelegate?language=objc)
1192    pub unsafe trait NSLayoutManagerDelegate: NSObjectProtocol {
1193        #[cfg(all(feature = "NSFont", feature = "objc2-core-graphics"))]
1194        #[cfg(target_vendor = "apple")]
1195        /// ********************** Glyph generation ***********************
1196        ///
1197        /// # Safety
1198        ///
1199        /// - `glyphs` must be a valid pointer.
1200        /// - `props` must be a valid pointer.
1201        /// - `char_indexes` must be a valid pointer.
1202        #[optional]
1203        #[unsafe(method(layoutManager:shouldGenerateGlyphs:properties:characterIndexes:font:forGlyphRange:))]
1204        #[unsafe(method_family = none)]
1205        unsafe fn layoutManager_shouldGenerateGlyphs_properties_characterIndexes_font_forGlyphRange(
1206            &self,
1207            layout_manager: &NSLayoutManager,
1208            glyphs: NonNull<CGGlyph>,
1209            props: NonNull<NSGlyphProperty>,
1210            char_indexes: NonNull<NSUInteger>,
1211            a_font: &NSFont,
1212            glyph_range: NSRange,
1213        ) -> NSUInteger;
1214
1215        #[cfg(feature = "objc2-core-foundation")]
1216        /// ********************** Line layout ***********************
1217        #[optional]
1218        #[unsafe(method(layoutManager:lineSpacingAfterGlyphAtIndex:withProposedLineFragmentRect:))]
1219        #[unsafe(method_family = none)]
1220        fn layoutManager_lineSpacingAfterGlyphAtIndex_withProposedLineFragmentRect(
1221            &self,
1222            layout_manager: &NSLayoutManager,
1223            glyph_index: NSUInteger,
1224            rect: NSRect,
1225        ) -> CGFloat;
1226
1227        #[cfg(feature = "objc2-core-foundation")]
1228        #[optional]
1229        #[unsafe(method(layoutManager:paragraphSpacingBeforeGlyphAtIndex:withProposedLineFragmentRect:))]
1230        #[unsafe(method_family = none)]
1231        fn layoutManager_paragraphSpacingBeforeGlyphAtIndex_withProposedLineFragmentRect(
1232            &self,
1233            layout_manager: &NSLayoutManager,
1234            glyph_index: NSUInteger,
1235            rect: NSRect,
1236        ) -> CGFloat;
1237
1238        #[cfg(feature = "objc2-core-foundation")]
1239        #[optional]
1240        #[unsafe(method(layoutManager:paragraphSpacingAfterGlyphAtIndex:withProposedLineFragmentRect:))]
1241        #[unsafe(method_family = none)]
1242        fn layoutManager_paragraphSpacingAfterGlyphAtIndex_withProposedLineFragmentRect(
1243            &self,
1244            layout_manager: &NSLayoutManager,
1245            glyph_index: NSUInteger,
1246            rect: NSRect,
1247        ) -> CGFloat;
1248
1249        #[optional]
1250        #[unsafe(method(layoutManager:shouldUseAction:forControlCharacterAtIndex:))]
1251        #[unsafe(method_family = none)]
1252        fn layoutManager_shouldUseAction_forControlCharacterAtIndex(
1253            &self,
1254            layout_manager: &NSLayoutManager,
1255            action: NSControlCharacterAction,
1256            char_index: NSUInteger,
1257        ) -> NSControlCharacterAction;
1258
1259        #[optional]
1260        #[unsafe(method(layoutManager:shouldBreakLineByWordBeforeCharacterAtIndex:))]
1261        #[unsafe(method_family = none)]
1262        fn layoutManager_shouldBreakLineByWordBeforeCharacterAtIndex(
1263            &self,
1264            layout_manager: &NSLayoutManager,
1265            char_index: NSUInteger,
1266        ) -> bool;
1267
1268        #[optional]
1269        #[unsafe(method(layoutManager:shouldBreakLineByHyphenatingBeforeCharacterAtIndex:))]
1270        #[unsafe(method_family = none)]
1271        fn layoutManager_shouldBreakLineByHyphenatingBeforeCharacterAtIndex(
1272            &self,
1273            layout_manager: &NSLayoutManager,
1274            char_index: NSUInteger,
1275        ) -> bool;
1276
1277        #[cfg(feature = "NSTextContainer")]
1278        #[optional]
1279        #[unsafe(method(layoutManager:boundingBoxForControlGlyphAtIndex:forTextContainer:proposedLineFragment:glyphPosition:characterIndex:))]
1280        #[unsafe(method_family = none)]
1281        fn layoutManager_boundingBoxForControlGlyphAtIndex_forTextContainer_proposedLineFragment_glyphPosition_characterIndex(
1282            &self,
1283            layout_manager: &NSLayoutManager,
1284            glyph_index: NSUInteger,
1285            text_container: &NSTextContainer,
1286            proposed_rect: NSRect,
1287            glyph_position: NSPoint,
1288            char_index: NSUInteger,
1289        ) -> NSRect;
1290
1291        #[cfg(all(feature = "NSTextContainer", feature = "objc2-core-foundation"))]
1292        /// # Safety
1293        ///
1294        /// - `line_fragment_rect` must be a valid pointer.
1295        /// - `line_fragment_used_rect` must be a valid pointer.
1296        /// - `baseline_offset` must be a valid pointer.
1297        #[optional]
1298        #[unsafe(method(layoutManager:shouldSetLineFragmentRect:lineFragmentUsedRect:baselineOffset:inTextContainer:forGlyphRange:))]
1299        #[unsafe(method_family = none)]
1300        unsafe fn layoutManager_shouldSetLineFragmentRect_lineFragmentUsedRect_baselineOffset_inTextContainer_forGlyphRange(
1301            &self,
1302            layout_manager: &NSLayoutManager,
1303            line_fragment_rect: NonNull<NSRect>,
1304            line_fragment_used_rect: NonNull<NSRect>,
1305            baseline_offset: NonNull<CGFloat>,
1306            text_container: &NSTextContainer,
1307            glyph_range: NSRange,
1308        ) -> bool;
1309
1310        /// ********************** Layout processing ***********************
1311        #[optional]
1312        #[unsafe(method(layoutManagerDidInvalidateLayout:))]
1313        #[unsafe(method_family = none)]
1314        fn layoutManagerDidInvalidateLayout(&self, sender: &NSLayoutManager);
1315
1316        #[cfg(feature = "NSTextContainer")]
1317        #[optional]
1318        #[unsafe(method(layoutManager:didCompleteLayoutForTextContainer:atEnd:))]
1319        #[unsafe(method_family = none)]
1320        fn layoutManager_didCompleteLayoutForTextContainer_atEnd(
1321            &self,
1322            layout_manager: &NSLayoutManager,
1323            text_container: Option<&NSTextContainer>,
1324            layout_finished_flag: bool,
1325        );
1326
1327        #[cfg(feature = "NSTextContainer")]
1328        #[optional]
1329        #[unsafe(method(layoutManager:textContainer:didChangeGeometryFromSize:))]
1330        #[unsafe(method_family = none)]
1331        fn layoutManager_textContainer_didChangeGeometryFromSize(
1332            &self,
1333            layout_manager: &NSLayoutManager,
1334            text_container: &NSTextContainer,
1335            old_size: NSSize,
1336        );
1337
1338        /// # Safety
1339        ///
1340        /// - `attrs` generic should be of the correct type.
1341        /// - `effective_char_range` must be a valid pointer or null.
1342        #[optional]
1343        #[unsafe(method(layoutManager:shouldUseTemporaryAttributes:forDrawingToScreen:atCharacterIndex:effectiveRange:))]
1344        #[unsafe(method_family = none)]
1345        unsafe fn layoutManager_shouldUseTemporaryAttributes_forDrawingToScreen_atCharacterIndex_effectiveRange(
1346            &self,
1347            layout_manager: &NSLayoutManager,
1348            attrs: &NSDictionary<NSAttributedStringKey, AnyObject>,
1349            to_screen: bool,
1350            char_index: NSUInteger,
1351            effective_char_range: NSRangePointer,
1352        ) -> Option<Retained<NSDictionary<NSAttributedStringKey, AnyObject>>>;
1353    }
1354);
1355
1356/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsglyphattributesoft?language=objc)
1357#[deprecated]
1358pub const NSGlyphAttributeSoft: c_uint = 0;
1359/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsglyphattributeelastic?language=objc)
1360#[deprecated]
1361pub const NSGlyphAttributeElastic: c_uint = 1;
1362/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsglyphattributebidilevel?language=objc)
1363#[deprecated]
1364pub const NSGlyphAttributeBidiLevel: c_uint = 2;
1365/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsglyphattributeinscribe?language=objc)
1366#[deprecated]
1367pub const NSGlyphAttributeInscribe: c_uint = 5;
1368
1369/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsglyphinscription?language=objc)
1370// NS_ENUM
1371#[deprecated = "Use NSGlyphProperty instead"]
1372#[repr(transparent)]
1373#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1374pub struct NSGlyphInscription(pub NSUInteger);
1375impl NSGlyphInscription {
1376    #[doc(alias = "NSGlyphInscribeBase")]
1377    #[deprecated]
1378    pub const InscribeBase: Self = Self(0);
1379    #[doc(alias = "NSGlyphInscribeBelow")]
1380    #[deprecated]
1381    pub const InscribeBelow: Self = Self(1);
1382    #[doc(alias = "NSGlyphInscribeAbove")]
1383    #[deprecated]
1384    pub const InscribeAbove: Self = Self(2);
1385    #[doc(alias = "NSGlyphInscribeOverstrike")]
1386    #[deprecated]
1387    pub const InscribeOverstrike: Self = Self(3);
1388    #[doc(alias = "NSGlyphInscribeOverBelow")]
1389    #[deprecated]
1390    pub const InscribeOverBelow: Self = Self(4);
1391}
1392
1393unsafe impl Encode for NSGlyphInscription {
1394    const ENCODING: Encoding = NSUInteger::ENCODING;
1395}
1396
1397unsafe impl RefEncode for NSGlyphInscription {
1398    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1399}
1400
1401/// NSLayoutManagerDeprecated.
1402impl NSLayoutManager {
1403    extern_methods!(
1404        #[cfg(feature = "NSFont")]
1405        /// # Safety
1406        ///
1407        /// `is_valid_index` must be a valid pointer or null.
1408        #[unsafe(method(glyphAtIndex:isValidIndex:))]
1409        #[unsafe(method_family = none)]
1410        pub unsafe fn glyphAtIndex_isValidIndex(
1411            &self,
1412            glyph_index: NSUInteger,
1413            is_valid_index: *mut Bool,
1414        ) -> NSGlyph;
1415
1416        #[cfg(feature = "NSFont")]
1417        #[unsafe(method(glyphAtIndex:))]
1418        #[unsafe(method_family = none)]
1419        pub fn glyphAtIndex(&self, glyph_index: NSUInteger) -> NSGlyph;
1420
1421        #[cfg(feature = "NSTextContainer")]
1422        /// # Safety
1423        ///
1424        /// `rect_count` must be a valid pointer.
1425        #[unsafe(method(rectArrayForCharacterRange:withinSelectedCharacterRange:inTextContainer:rectCount:))]
1426        #[unsafe(method_family = none)]
1427        pub unsafe fn rectArrayForCharacterRange_withinSelectedCharacterRange_inTextContainer_rectCount(
1428            &self,
1429            char_range: NSRange,
1430            sel_char_range: NSRange,
1431            container: &NSTextContainer,
1432            rect_count: NonNull<NSUInteger>,
1433        ) -> NSRectArray;
1434
1435        #[cfg(feature = "NSTextContainer")]
1436        /// # Safety
1437        ///
1438        /// `rect_count` must be a valid pointer.
1439        #[unsafe(method(rectArrayForGlyphRange:withinSelectedGlyphRange:inTextContainer:rectCount:))]
1440        #[unsafe(method_family = none)]
1441        pub unsafe fn rectArrayForGlyphRange_withinSelectedGlyphRange_inTextContainer_rectCount(
1442            &self,
1443            glyph_range: NSRange,
1444            sel_glyph_range: NSRange,
1445            container: &NSTextContainer,
1446            rect_count: NonNull<NSUInteger>,
1447        ) -> NSRectArray;
1448
1449        #[deprecated]
1450        #[unsafe(method(usesScreenFonts))]
1451        #[unsafe(method_family = none)]
1452        pub fn usesScreenFonts(&self) -> bool;
1453
1454        /// Setter for [`usesScreenFonts`][Self::usesScreenFonts].
1455        #[deprecated]
1456        #[unsafe(method(setUsesScreenFonts:))]
1457        #[unsafe(method_family = none)]
1458        pub fn setUsesScreenFonts(&self, uses_screen_fonts: bool);
1459
1460        #[cfg(feature = "NSFont")]
1461        #[deprecated]
1462        #[unsafe(method(substituteFontForFont:))]
1463        #[unsafe(method_family = none)]
1464        pub fn substituteFontForFont(&self, original_font: &NSFont) -> Retained<NSFont>;
1465
1466        #[cfg(feature = "NSFont")]
1467        /// # Safety
1468        ///
1469        /// `glyphs` must be a valid pointer.
1470        #[deprecated = "Use -setGlyphs:properties:characterIndexes:font:forGlyphRange instead"]
1471        #[unsafe(method(insertGlyphs:length:forStartingGlyphAtIndex:characterIndex:))]
1472        #[unsafe(method_family = none)]
1473        pub unsafe fn insertGlyphs_length_forStartingGlyphAtIndex_characterIndex(
1474            &self,
1475            glyphs: NonNull<NSGlyph>,
1476            length: NSUInteger,
1477            glyph_index: NSUInteger,
1478            char_index: NSUInteger,
1479        );
1480
1481        #[cfg(feature = "NSFont")]
1482        #[deprecated = "Use -setGlyphs:properties:characterIndexes:font:forGlyphRange instead"]
1483        #[unsafe(method(insertGlyph:atGlyphIndex:characterIndex:))]
1484        #[unsafe(method_family = none)]
1485        pub fn insertGlyph_atGlyphIndex_characterIndex(
1486            &self,
1487            glyph: NSGlyph,
1488            glyph_index: NSUInteger,
1489            char_index: NSUInteger,
1490        );
1491
1492        #[cfg(feature = "NSFont")]
1493        #[deprecated = "Use -setGlyphs:properties:characterIndexes:font:forGlyphRange instead"]
1494        #[unsafe(method(replaceGlyphAtIndex:withGlyph:))]
1495        #[unsafe(method_family = none)]
1496        pub fn replaceGlyphAtIndex_withGlyph(&self, glyph_index: NSUInteger, new_glyph: NSGlyph);
1497
1498        #[deprecated = "Use -setGlyphs:properties:characterIndexes:font:forGlyphRange instead"]
1499        #[unsafe(method(deleteGlyphsInRange:))]
1500        #[unsafe(method_family = none)]
1501        pub fn deleteGlyphsInRange(&self, glyph_range: NSRange);
1502
1503        #[deprecated = "Use -setGlyphs:properties:characterIndexes:font:forGlyphRange instead"]
1504        #[unsafe(method(setCharacterIndex:forGlyphAtIndex:))]
1505        #[unsafe(method_family = none)]
1506        pub fn setCharacterIndex_forGlyphAtIndex(
1507            &self,
1508            char_index: NSUInteger,
1509            glyph_index: NSUInteger,
1510        );
1511
1512        #[deprecated = "Use -setGlyphs:properties:characterIndexes:font:forGlyphRange instead"]
1513        #[unsafe(method(setIntAttribute:value:forGlyphAtIndex:))]
1514        #[unsafe(method_family = none)]
1515        pub fn setIntAttribute_value_forGlyphAtIndex(
1516            &self,
1517            attribute_tag: NSInteger,
1518            val: NSInteger,
1519            glyph_index: NSUInteger,
1520        );
1521
1522        #[deprecated = "Use -setGlyphs:properties:characterIndexes:font:forGlyphRange instead"]
1523        #[unsafe(method(invalidateGlyphsOnLayoutInvalidationForGlyphRange:))]
1524        #[unsafe(method_family = none)]
1525        pub fn invalidateGlyphsOnLayoutInvalidationForGlyphRange(&self, glyph_range: NSRange);
1526
1527        #[deprecated = "Use -getGlyphsInRange:glyphs:properties:characterIndexes:bidiLevels: instead"]
1528        #[unsafe(method(intAttribute:forGlyphAtIndex:))]
1529        #[unsafe(method_family = none)]
1530        pub fn intAttribute_forGlyphAtIndex(
1531            &self,
1532            attribute_tag: NSInteger,
1533            glyph_index: NSUInteger,
1534        ) -> NSInteger;
1535
1536        #[cfg(feature = "NSFont")]
1537        /// # Safety
1538        ///
1539        /// - `glyph_buffer` must be a valid pointer or null.
1540        /// - `char_index_buffer` must be a valid pointer or null.
1541        /// - `inscribe_buffer` must be a valid pointer or null.
1542        /// - `elastic_buffer` must be a valid pointer or null.
1543        #[deprecated = "Use -getGlyphsInRange:glyphs:properties:characterIndexes:bidiLevels: instead"]
1544        #[unsafe(method(getGlyphsInRange:glyphs:characterIndexes:glyphInscriptions:elasticBits:))]
1545        #[unsafe(method_family = none)]
1546        pub unsafe fn getGlyphsInRange_glyphs_characterIndexes_glyphInscriptions_elasticBits(
1547            &self,
1548            glyph_range: NSRange,
1549            glyph_buffer: *mut NSGlyph,
1550            char_index_buffer: *mut NSUInteger,
1551            inscribe_buffer: *mut NSGlyphInscription,
1552            elastic_buffer: *mut Bool,
1553        ) -> NSUInteger;
1554
1555        #[cfg(feature = "NSFont")]
1556        /// # Safety
1557        ///
1558        /// - `glyph_buffer` must be a valid pointer or null.
1559        /// - `char_index_buffer` must be a valid pointer or null.
1560        /// - `inscribe_buffer` must be a valid pointer or null.
1561        /// - `elastic_buffer` must be a valid pointer or null.
1562        /// - `bidi_level_buffer` must be a valid pointer or null.
1563        #[deprecated = "Use -getGlyphsInRange:glyphs:properties:characterIndexes:bidiLevels: instead"]
1564        #[unsafe(method(getGlyphsInRange:glyphs:characterIndexes:glyphInscriptions:elasticBits:bidiLevels:))]
1565        #[unsafe(method_family = none)]
1566        pub unsafe fn getGlyphsInRange_glyphs_characterIndexes_glyphInscriptions_elasticBits_bidiLevels(
1567            &self,
1568            glyph_range: NSRange,
1569            glyph_buffer: *mut NSGlyph,
1570            char_index_buffer: *mut NSUInteger,
1571            inscribe_buffer: *mut NSGlyphInscription,
1572            elastic_buffer: *mut Bool,
1573            bidi_level_buffer: *mut c_uchar,
1574        ) -> NSUInteger;
1575
1576        #[cfg(feature = "NSFont")]
1577        /// # Safety
1578        ///
1579        /// `glyph_array` must be a valid pointer or null.
1580        #[deprecated = "Use -getGlyphsInRange:glyphs:properties:characterIndexes:bidiLevels: instead"]
1581        #[unsafe(method(getGlyphs:range:))]
1582        #[unsafe(method_family = none)]
1583        pub unsafe fn getGlyphs_range(
1584            &self,
1585            glyph_array: *mut NSGlyph,
1586            glyph_range: NSRange,
1587        ) -> NSUInteger;
1588
1589        /// # Safety
1590        ///
1591        /// `actual_char_range` must be a valid pointer or null.
1592        #[deprecated = "Use -invalidateLayoutForCharacterRange:actualCharacterRange: instead"]
1593        #[unsafe(method(invalidateLayoutForCharacterRange:isSoft:actualCharacterRange:))]
1594        #[unsafe(method_family = none)]
1595        pub unsafe fn invalidateLayoutForCharacterRange_isSoft_actualCharacterRange(
1596            &self,
1597            char_range: NSRange,
1598            flag: bool,
1599            actual_char_range: NSRangePointer,
1600        );
1601
1602        #[cfg(feature = "NSTextStorage")]
1603        #[deprecated = "Use -processEditingForTextStorage:edited:range:changeInLength:invalidatedRange: instead"]
1604        #[unsafe(method(textStorage:edited:range:changeInLength:invalidatedRange:))]
1605        #[unsafe(method_family = none)]
1606        pub fn textStorage_edited_range_changeInLength_invalidatedRange(
1607            &self,
1608            str: &NSTextStorage,
1609            edited_mask: NSTextStorageEditedOptions,
1610            new_char_range: NSRange,
1611            delta: NSInteger,
1612            invalidated_char_range: NSRange,
1613        );
1614
1615        /// # Safety
1616        ///
1617        /// - `locations` must be a valid pointer.
1618        /// - `glyph_indexes` must be a valid pointer.
1619        #[deprecated = "Use -setLocation:forStartOfGlyphRange: instead"]
1620        #[unsafe(method(setLocations:startingGlyphIndexes:count:forGlyphRange:))]
1621        #[unsafe(method_family = none)]
1622        pub unsafe fn setLocations_startingGlyphIndexes_count_forGlyphRange(
1623            &self,
1624            locations: NSPointArray,
1625            glyph_indexes: NonNull<NSUInteger>,
1626            count: NSUInteger,
1627            glyph_range: NSRange,
1628        );
1629
1630        #[cfg(all(feature = "NSColor", feature = "NSFont"))]
1631        /// # Safety
1632        ///
1633        /// `glyphs` must be a valid pointer.
1634        #[deprecated = "Use -showCGGlyphs:positions:count:font:matrix:attributes:inContext: instead"]
1635        #[unsafe(method(showPackedGlyphs:length:glyphRange:atPoint:font:color:printingAdjustment:))]
1636        #[unsafe(method_family = none)]
1637        pub unsafe fn showPackedGlyphs_length_glyphRange_atPoint_font_color_printingAdjustment(
1638            &self,
1639            glyphs: NonNull<c_char>,
1640            glyph_len: NSUInteger,
1641            glyph_range: NSRange,
1642            point: NSPoint,
1643            font: &NSFont,
1644            color: &NSColor,
1645            printing_adjustment: NSSize,
1646        );
1647
1648        #[cfg(all(
1649            feature = "NSFont",
1650            feature = "NSGraphicsContext",
1651            feature = "objc2-core-graphics"
1652        ))]
1653        #[cfg(target_vendor = "apple")]
1654        /// # Safety
1655        ///
1656        /// - `glyphs` must be a valid pointer.
1657        /// - `positions` must be a valid pointer.
1658        /// - `attributes` generic should be of the correct type.
1659        #[deprecated]
1660        #[unsafe(method(showCGGlyphs:positions:count:font:matrix:attributes:inContext:))]
1661        #[unsafe(method_family = none)]
1662        pub unsafe fn showCGGlyphs_positions_count_font_matrix_attributes_inContext(
1663            &self,
1664            glyphs: NonNull<CGGlyph>,
1665            positions: NonNull<NSPoint>,
1666            glyph_count: NSUInteger,
1667            font: &NSFont,
1668            text_matrix: &NSAffineTransform,
1669            attributes: &NSDictionary<NSAttributedStringKey, AnyObject>,
1670            graphics_context: &NSGraphicsContext,
1671        );
1672
1673        #[deprecated = "Please use usesDefaultHyphenation or -[NSParagraphStyle hyphenationFactor] instead."]
1674        #[unsafe(method(hyphenationFactor))]
1675        #[unsafe(method_family = none)]
1676        pub fn hyphenationFactor(&self) -> c_float;
1677
1678        /// Setter for [`hyphenationFactor`][Self::hyphenationFactor].
1679        #[deprecated = "Please use usesDefaultHyphenation or -[NSParagraphStyle hyphenationFactor] instead."]
1680        #[unsafe(method(setHyphenationFactor:))]
1681        #[unsafe(method_family = none)]
1682        pub fn setHyphenationFactor(&self, hyphenation_factor: c_float);
1683    );
1684}
1685
1686/// NSGlyphGeneration.
1687impl NSLayoutManager {
1688    extern_methods!(
1689        #[cfg(feature = "NSGlyphGenerator")]
1690        #[unsafe(method(glyphGenerator))]
1691        #[unsafe(method_family = none)]
1692        pub fn glyphGenerator(&self) -> Retained<NSGlyphGenerator>;
1693
1694        #[cfg(feature = "NSGlyphGenerator")]
1695        /// Setter for [`glyphGenerator`][Self::glyphGenerator].
1696        #[unsafe(method(setGlyphGenerator:))]
1697        #[unsafe(method_family = none)]
1698        pub fn setGlyphGenerator(&self, glyph_generator: &NSGlyphGenerator);
1699    );
1700}
1701
1702#[cfg(feature = "NSGlyphGenerator")]
1703extern_conformance!(
1704    unsafe impl NSGlyphStorage for NSLayoutManager {}
1705);