#[repr(C)]pub struct NSTypesetter { /* private fields */ }
NSTypesetter
only.Expand description
Implementations§
Source§impl NSTypesetter
impl NSTypesetter
pub unsafe fn usesFontLeading(&self) -> bool
Sourcepub unsafe fn setUsesFontLeading(&self, uses_font_leading: bool)
pub unsafe fn setUsesFontLeading(&self, uses_font_leading: bool)
Setter for usesFontLeading
.
pub unsafe fn typesetterBehavior(&self) -> NSTypesetterBehavior
NSLayoutManager
only.Sourcepub unsafe fn setTypesetterBehavior(
&self,
typesetter_behavior: NSTypesetterBehavior,
)
Available on crate feature NSLayoutManager
only.
pub unsafe fn setTypesetterBehavior( &self, typesetter_behavior: NSTypesetterBehavior, )
NSLayoutManager
only.Setter for typesetterBehavior
.
pub unsafe fn hyphenationFactor(&self) -> c_float
Sourcepub unsafe fn setHyphenationFactor(&self, hyphenation_factor: c_float)
pub unsafe fn setHyphenationFactor(&self, hyphenation_factor: c_float)
Setter for hyphenationFactor
.
pub unsafe fn lineFragmentPadding(&self) -> CGFloat
objc2-core-foundation
only.Sourcepub unsafe fn setLineFragmentPadding(&self, line_fragment_padding: CGFloat)
Available on crate feature objc2-core-foundation
only.
pub unsafe fn setLineFragmentPadding(&self, line_fragment_padding: CGFloat)
objc2-core-foundation
only.Setter for lineFragmentPadding
.
pub unsafe fn substituteFontForFont( &self, original_font: &NSFont, ) -> Retained<NSFont>
NSFont
only.pub unsafe fn textTabForGlyphLocation_writingDirection_maxLocation( &self, glyph_location: CGFloat, direction: NSWritingDirection, max_location: CGFloat, ) -> Option<Retained<NSTextTab>>
NSParagraphStyle
and NSText
and objc2-core-foundation
only.pub unsafe fn bidiProcessingEnabled(&self) -> bool
Sourcepub unsafe fn setBidiProcessingEnabled(&self, bidi_processing_enabled: bool)
pub unsafe fn setBidiProcessingEnabled(&self, bidi_processing_enabled: bool)
Setter for bidiProcessingEnabled
.
pub unsafe fn attributedString(&self) -> Option<Retained<NSAttributedString>>
Sourcepub unsafe fn setAttributedString(
&self,
attributed_string: Option<&NSAttributedString>,
)
pub unsafe fn setAttributedString( &self, attributed_string: Option<&NSAttributedString>, )
Setter for attributedString
.
pub unsafe fn setParagraphGlyphRange_separatorGlyphRange( &self, paragraph_range: NSRange, paragraph_separator_range: NSRange, )
pub unsafe fn paragraphGlyphRange(&self) -> NSRange
pub unsafe fn paragraphSeparatorGlyphRange(&self) -> NSRange
pub unsafe fn paragraphCharacterRange(&self) -> NSRange
pub unsafe fn paragraphSeparatorCharacterRange(&self) -> NSRange
pub unsafe fn layoutParagraphAtPoint( &self, line_fragment_origin: NSPointPointer, ) -> NSUInteger
pub unsafe fn beginParagraph(&self)
pub unsafe fn endParagraph(&self)
pub unsafe fn beginLineWithGlyphAtIndex(&self, glyph_index: NSUInteger)
pub unsafe fn endLineWithGlyphRange(&self, line_glyph_range: NSRange)
pub unsafe fn lineSpacingAfterGlyphAtIndex_withProposedLineFragmentRect( &self, glyph_index: NSUInteger, rect: NSRect, ) -> CGFloat
objc2-core-foundation
only.pub unsafe fn paragraphSpacingBeforeGlyphAtIndex_withProposedLineFragmentRect( &self, glyph_index: NSUInteger, rect: NSRect, ) -> CGFloat
objc2-core-foundation
only.pub unsafe fn paragraphSpacingAfterGlyphAtIndex_withProposedLineFragmentRect( &self, glyph_index: NSUInteger, rect: NSRect, ) -> CGFloat
objc2-core-foundation
only.pub unsafe fn getLineFragmentRect_usedRect_forParagraphSeparatorGlyphRange_atProposedOrigin( &self, line_fragment_rect: NSRectPointer, line_fragment_used_rect: NSRectPointer, paragraph_separator_glyph_range: NSRange, line_origin: NSPoint, )
pub unsafe fn attributesForExtraLineFragment( &self, ) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>
pub unsafe fn layoutManager(&self) -> Option<Retained<NSLayoutManager>>
NSLayoutManager
only.pub unsafe fn textContainers( &self, ) -> Option<Retained<NSArray<NSTextContainer>>>
NSTextContainer
only.pub unsafe fn currentTextContainer(&self) -> Option<Retained<NSTextContainer>>
NSTextContainer
only.pub unsafe fn currentParagraphStyle(&self) -> Option<Retained<NSParagraphStyle>>
NSParagraphStyle
only.pub unsafe fn setHardInvalidation_forGlyphRange( &self, flag: bool, glyph_range: NSRange, )
pub unsafe fn layoutGlyphsInLayoutManager_startingAtGlyphIndex_maxNumberOfLineFragments_nextGlyphIndex( &self, layout_manager: &NSLayoutManager, start_glyph_index: NSUInteger, max_num_lines: NSUInteger, next_glyph: NonNull<NSUInteger>, )
NSLayoutManager
only.pub unsafe fn layoutCharactersInRange_forLayoutManager_maximumNumberOfLineFragments( &self, character_range: NSRange, layout_manager: &NSLayoutManager, max_num_lines: NSUInteger, ) -> NSRange
NSLayoutManager
only.pub unsafe fn printingAdjustmentInLayoutManager_forNominallySpacedGlyphRange_packedGlyphs_count( layout_mgr: &NSLayoutManager, nominally_spaced_glyphs_range: NSRange, packed_glyphs: NonNull<c_uchar>, packed_glyphs_count: NSUInteger, ) -> NSSize
NSLayoutManager
only.pub unsafe fn baselineOffsetInLayoutManager_glyphIndex( &self, layout_mgr: &NSLayoutManager, glyph_index: NSUInteger, ) -> CGFloat
NSLayoutManager
and objc2-core-foundation
only.NSLayoutManager
only.pub unsafe fn defaultTypesetterBehavior() -> NSTypesetterBehavior
NSLayoutManager
only.Source§impl NSTypesetter
Methods declared on superclass NSObject
.
impl NSTypesetter
Methods declared on superclass NSObject
.
Source§impl NSTypesetter
NSLayoutPhaseInterface.
impl NSTypesetter
NSLayoutPhaseInterface.
pub unsafe fn willSetLineFragmentRect_forGlyphRange_usedRect_baselineOffset( &self, line_rect: NSRectPointer, glyph_range: NSRange, used_rect: NSRectPointer, baseline_offset: NonNull<CGFloat>, )
objc2-core-foundation
only.pub unsafe fn shouldBreakLineByWordBeforeCharacterAtIndex( &self, char_index: NSUInteger, ) -> bool
pub unsafe fn shouldBreakLineByHyphenatingBeforeCharacterAtIndex( &self, char_index: NSUInteger, ) -> bool
pub unsafe fn hyphenationFactorForGlyphAtIndex( &self, glyph_index: NSUInteger, ) -> c_float
pub unsafe fn hyphenCharacterForGlyphAtIndex( &self, glyph_index: NSUInteger, ) -> u32
pub unsafe fn boundingBoxForControlGlyphAtIndex_forTextContainer_proposedLineFragment_glyphPosition_characterIndex( &self, glyph_index: NSUInteger, text_container: &NSTextContainer, proposed_rect: NSRect, glyph_position: NSPoint, char_index: NSUInteger, ) -> NSRect
NSTextContainer
only.Source§impl NSTypesetter
NSGlyphStorageInterface.
impl NSTypesetter
NSGlyphStorageInterface.
pub unsafe fn characterRangeForGlyphRange_actualGlyphRange( &self, glyph_range: NSRange, actual_glyph_range: NSRangePointer, ) -> NSRange
pub unsafe fn glyphRangeForCharacterRange_actualCharacterRange( &self, char_range: NSRange, actual_char_range: NSRangePointer, ) -> NSRange
pub unsafe fn getLineFragmentRect_usedRect_remainingRect_forStartingGlyphAtIndex_proposedRect_lineSpacing_paragraphSpacingBefore_paragraphSpacingAfter( &self, line_fragment_rect: NSRectPointer, line_fragment_used_rect: NSRectPointer, remaining_rect: NSRectPointer, starting_glyph_index: NSUInteger, proposed_rect: NSRect, line_spacing: CGFloat, paragraph_spacing_before: CGFloat, paragraph_spacing_after: CGFloat, )
objc2-core-foundation
only.pub unsafe fn setLineFragmentRect_forGlyphRange_usedRect_baselineOffset( &self, fragment_rect: NSRect, glyph_range: NSRange, used_rect: NSRect, baseline_offset: CGFloat, )
objc2-core-foundation
only.pub unsafe fn setNotShownAttribute_forGlyphRange( &self, flag: bool, glyph_range: NSRange, )
pub unsafe fn setDrawsOutsideLineFragment_forGlyphRange( &self, flag: bool, glyph_range: NSRange, )
pub unsafe fn setLocation_withAdvancements_forStartOfGlyphRange( &self, location: NSPoint, advancements: *const CGFloat, glyph_range: NSRange, )
objc2-core-foundation
only.pub unsafe fn setAttachmentSize_forGlyphRange( &self, attachment_size: NSSize, glyph_range: NSRange, )
pub unsafe fn setBidiLevels_forGlyphRange( &self, levels: *const u8, glyph_range: NSRange, )
Source§impl NSTypesetter
NSTypesetter_Deprecated.
impl NSTypesetter
NSTypesetter_Deprecated.
pub unsafe fn actionForControlCharacterAtIndex( &self, char_index: NSUInteger, ) -> NSTypesetterControlCharacterAction
pub unsafe fn getGlyphsInRange_glyphs_characterIndexes_glyphInscriptions_elasticBits_bidiLevels( &self, glyphs_range: NSRange, glyph_buffer: *mut NSGlyph, char_index_buffer: *mut NSUInteger, inscribe_buffer: *mut NSGlyphInscription, elastic_buffer: *mut Bool, bidi_level_buffer: *mut c_uchar, ) -> NSUInteger
NSFont
and NSLayoutManager
only.pub unsafe fn substituteGlyphsInRange_withGlyphs( &self, glyph_range: NSRange, glyphs: *mut NSGlyph, )
NSFont
only.pub unsafe fn insertGlyph_atGlyphIndex_characterIndex( &self, glyph: NSGlyph, glyph_index: NSUInteger, character_index: NSUInteger, )
NSFont
only.pub unsafe fn deleteGlyphsInRange(&self, glyph_range: NSRange)
Methods from Deref<Target = NSObject>§
Sourcepub fn doesNotRecognizeSelector(&self, sel: Sel) -> !
pub fn doesNotRecognizeSelector(&self, sel: Sel) -> !
Handle messages the object doesn’t recognize.
See Apple’s documentation for details.
Methods from Deref<Target = AnyObject>§
Sourcepub fn class(&self) -> &'static AnyClass
Available on crate feature NSAccessibilityConstants
only.
pub fn class(&self) -> &'static AnyClass
NSAccessibilityConstants
only.Dynamically find the class of this object.
§Panics
May panic if the object is invalid (which may be the case for objects
returned from unavailable init
/new
methods).
§Example
Check that an instance of NSObject
has the precise class NSObject
.
use objc2::ClassType;
use objc2::runtime::NSObject;
let obj = NSObject::new();
assert_eq!(obj.class(), NSObject::class());
Sourcepub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
👎Deprecated: this is difficult to use correctly, use Ivar::load
instead.Available on crate feature NSAccessibilityConstants
only.
pub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
Ivar::load
instead.NSAccessibilityConstants
only.Use Ivar::load
instead.
§Safety
The object must have an instance variable with the given name, and it
must be of type T
.
See Ivar::load_ptr
for details surrounding this.
Sourcepub fn downcast_ref<T>(&self) -> Option<&T>where
T: DowncastTarget,
Available on crate feature NSAccessibilityConstants
only.
pub fn downcast_ref<T>(&self) -> Option<&T>where
T: DowncastTarget,
NSAccessibilityConstants
only.Attempt to downcast the object to a class of type T
.
This is the reference-variant. Use Retained::downcast
if you want
to convert a retained object to another type.
§Mutable classes
Some classes have immutable and mutable variants, such as NSString
and NSMutableString
.
When some Objective-C API signature says it gives you an immutable class, it generally expects you to not mutate that, even though it may technically be mutable “under the hood”.
So using this method to convert a NSString
to a NSMutableString
,
while not unsound, is generally frowned upon unless you created the
string yourself, or the API explicitly documents the string to be
mutable.
See Apple’s documentation on mutability and on
isKindOfClass:
for more details.
§Generic classes
Objective-C generics are called “lightweight generics”, and that’s because they aren’t exposed in the runtime. This makes it impossible to safely downcast to generic collections, so this is disallowed by this method.
You can, however, safely downcast to generic collections where all the
type-parameters are AnyObject
.
§Panics
This works internally by calling isKindOfClass:
. That means that the
object must have the instance method of that name, and an exception
will be thrown (if CoreFoundation is linked) or the process will abort
if that is not the case. In the vast majority of cases, you don’t need
to worry about this, since both root objects NSObject
and
NSProxy
implement this method.
§Examples
Cast an NSString
back and forth from NSObject
.
use objc2::rc::Retained;
use objc2_foundation::{NSObject, NSString};
let obj: Retained<NSObject> = NSString::new().into_super();
let string = obj.downcast_ref::<NSString>().unwrap();
// Or with `downcast`, if we do not need the object afterwards
let string = obj.downcast::<NSString>().unwrap();
Try (and fail) to cast an NSObject
to an NSString
.
use objc2_foundation::{NSObject, NSString};
let obj = NSObject::new();
assert!(obj.downcast_ref::<NSString>().is_none());
Try to cast to an array of strings.
use objc2_foundation::{NSArray, NSObject, NSString};
let arr = NSArray::from_retained_slice(&[NSObject::new()]);
// This is invalid and doesn't type check.
let arr = arr.downcast_ref::<NSArray<NSString>>();
This fails to compile, since it would require enumerating over the array to ensure that each element is of the desired type, which is a performance pitfall.
Downcast when processing each element instead.
use objc2_foundation::{NSArray, NSObject, NSString};
let arr = NSArray::from_retained_slice(&[NSObject::new()]);
for elem in arr {
if let Some(data) = elem.downcast_ref::<NSString>() {
// handle `data`
}
}
Trait Implementations§
Source§impl AsRef<AnyObject> for NSTypesetter
impl AsRef<AnyObject> for NSTypesetter
Source§impl AsRef<NSObject> for NSTypesetter
impl AsRef<NSObject> for NSTypesetter
Source§impl AsRef<NSTypesetter> for NSATSTypesetter
Available on crate feature NSATSTypesetter
only.
impl AsRef<NSTypesetter> for NSATSTypesetter
NSATSTypesetter
only.Source§fn as_ref(&self) -> &NSTypesetter
fn as_ref(&self) -> &NSTypesetter
Source§impl AsRef<NSTypesetter> for NSTypesetter
impl AsRef<NSTypesetter> for NSTypesetter
Source§impl Borrow<AnyObject> for NSTypesetter
impl Borrow<AnyObject> for NSTypesetter
Source§impl Borrow<NSObject> for NSTypesetter
impl Borrow<NSObject> for NSTypesetter
Source§impl Borrow<NSTypesetter> for NSATSTypesetter
Available on crate feature NSATSTypesetter
only.
impl Borrow<NSTypesetter> for NSATSTypesetter
NSATSTypesetter
only.Source§fn borrow(&self) -> &NSTypesetter
fn borrow(&self) -> &NSTypesetter
Source§impl ClassType for NSTypesetter
impl ClassType for NSTypesetter
Source§const NAME: &'static str = "NSTypesetter"
const NAME: &'static str = "NSTypesetter"
Source§type ThreadKind = <<NSTypesetter as ClassType>::Super as ClassType>::ThreadKind
type ThreadKind = <<NSTypesetter as ClassType>::Super as ClassType>::ThreadKind
Source§impl Debug for NSTypesetter
impl Debug for NSTypesetter
Source§impl Deref for NSTypesetter
impl Deref for NSTypesetter
Source§impl Hash for NSTypesetter
impl Hash for NSTypesetter
Source§impl Message for NSTypesetter
impl Message for NSTypesetter
Source§impl NSObjectProtocol for NSTypesetter
impl NSObjectProtocol for NSTypesetter
Source§fn isEqual(&self, other: Option<&AnyObject>) -> bool
fn isEqual(&self, other: Option<&AnyObject>) -> bool
Source§fn hash(&self) -> usize
fn hash(&self) -> usize
Source§fn isKindOfClass(&self, cls: &AnyClass) -> bool
fn isKindOfClass(&self, cls: &AnyClass) -> bool
Source§fn is_kind_of<T>(&self) -> bool
fn is_kind_of<T>(&self) -> bool
isKindOfClass
directly, or cast your objects with AnyObject::downcast_ref