Instance Method

fixAttributes(in:)

Cleans up font, paragraph style, and attachment attributes within the given range.

Declaration

func fixAttributes(in range: NSRange)

Parameters

range

The character range within which to fix attributes. Raises an rangeException if any part of range lies beyond the end of the receiver’s characters.

Discussion

Removes attachment attributes assigned to characters other than NSAttachmentCharacter, assigns default fonts to characters with illegal fonts for their scripts and otherwise corrects font attribute assignments, and assigns the first paragraph style attribute value in each paragraph to all characters of the paragraph.

This method extends the range as needed to cover the last paragraph partially contained.

Raises an rangeException if any part of aRange lies beyond the end of the receiver’s characters.

NSTextStorage subclasses that return true from the fixesAttributesLazily method should avoid directly calling fixAttributes(in:) or else bracket such calls with beginEditing() and endEditing() messages.

See Also

Fixing attributes after changes

func fixAttachmentAttribute(in: NSRange)

Cleans up attachment attributes in aRange, removing all attachment attributes assigned to characters other than NSAttachmentCharacter.

func fixFontAttribute(in: NSRange)

Fixes the font attribute in aRange, assigning default fonts to characters with illegal fonts for their scripts and otherwise correcting font attribute assignments.

func fixParagraphStyleAttribute(in: NSRange)

Fixes the paragraph style attributes in aRange, assigning the first paragraph style attribute value in each paragraph to all characters of the paragraph.