Platforms to show: All Mac Windows Linux Cross-Platform
Back to NSMutableAttributedStringMBS class.
NSMutableAttributedStringMBS.addAttribute(name as string, value as Variant, range as NSRangeMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 12.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
name: A string specifying the attribute name. Attribute keys can be supplied by another framework or can be custom ones you define. For information about where to find the system-supplied attribute keys, see the overview section in NSAttributedString Class Reference.
value: The attribute value associated with name.
Range: The range of characters to which the specified attribute/value pair applies.
You may assign any name/value pair you wish to a range of characters, in addition to the standard attributes described in the "Constants" section of NSAttributedString Additions. Raises an NSInvalidArgumentException if name or value is nil and an NSRangeException if any part of range lies beyond the end of the receiver's characters.
Plugin version 16.0 or newer ignores calls here with value = nil or empty name to avoid exceptions.
Some examples using this method:
NSMutableAttributedStringMBS.addAttributes(attrs as Dictionary, range as NSRangeMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 12.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
attributes: A dictionary containing the attributes to add. Attribute keys can be supplied by another framework or can be custom ones you define. For information about where to find the system-supplied attribute keys, see the overview section in NSAttributedString Class Reference.
Range: The range of characters to which the specified attributes apply.
You may assign any name/value pair you wish to a range of characters, in addition to the standard attributes described in the "Constants" section of NSAttributedString Additions. Raises an NSInvalidArgumentException if attributes is nil and an NSRangeException if any part of range lies beyond the end of the receiver's characters.
NSMutableAttributedStringMBS.appendAttributedString(attrString as NSAttributedStringMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 12.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
attributedString: The string whose characters and attributes are added.
Some examples using this method:
NSMutableAttributedStringMBS.appendString(attrString as String)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 18.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
NSMutableAttributedStringMBS.applyFontTraits(FontTraitMask as Integer, offset as Integer, length as Integer)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 16.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
See the NSFontManager class specification for a description of the font traits available. Raises an NSRangeException if any part of aRange lies beyond the end of the receiver’s characters.
NSMutableAttributedStringMBS.AsCFMutableAttributedString as Variant
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 14.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
For passing to functions which need a CFMutableAttributedStringMBS.
NSMutableAttributedStringMBS.beginEditing
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 9.6 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
You can nest pairs of beginEditing and endEditing messages.
NSMutableAttributedStringMBS.Constructor
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 19.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
NSMutableAttributedStringMBS.containsAttachmentsInRange(offset as Integer, length as Integer) as Boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 16.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
NSMutableAttributedStringMBS.deleteCharactersInRange(range as NSRangeMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 9.6 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Raises an NSRangeException if any part of aRange lies beyond the end of the receiver's characters.
NSMutableAttributedStringMBS.endEditing
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 9.6 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
The NSMutableAttributedString implementation does nothing. NSTextStorage, for example, overrides this method to invoke fixAttributesInRange and to inform its NSLayoutManager objects that they need to re-lay the text.
NSMutableAttributedStringMBS.fixAttachmentAttributeInRange(offset as Integer, length as Integer)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 16.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
Raises an NSRangeException if any part of aRange lies beyond the end of the receiver’s characters.
NSMutableAttributedStringMBS.fixAttributesInRange(offset as Integer, length as Integer)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 16.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Raises an NSRangeException if any part of aRange lies beyond the end of the receiver’s characters.
NSTextStorage subclasses that return YES from the fixesAttributesLazily method should avoid directly calling fixAttributesInRange: or else bracket such calls with beginEditing and endEditing messages.
NSMutableAttributedStringMBS.fixFontAttributeInRange(offset as Integer, length as Integer)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 16.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
For example, Kanji characters assigned a Latin font are reassigned an appropriate Kanji font. Raises an NSRangeException if any part of aRange lies beyond the end of the receiver’s characters.
NSMutableAttributedStringMBS.fixParagraphStyleAttributeInRange(offset as Integer, length as Integer)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 16.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
This method extends the range as needed to cover the last paragraph partially contained. A paragraph is delimited by any of these characters, the longest possible sequence being preferred to any shorter:
- U+000D (\r or CR)
- U+000A (\n or LF)
- U+2029 (Unicode paragraph separator) \r\n, in that order (also known as CRLF)
Raises an NSRangeException if any part of aRange lies beyond the end of the receiver’s characters.
NSMutableAttributedStringMBS.fontAttributesInRange(offset as Integer, length as Integer) as Dictionary
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 16.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
NSMutableAttributedStringMBS.insertAttributedString(attrString as NSAttributedStringMBS, location as UInt64)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 12.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
attributedString: The string whose characters and attributes are inserted.
index: The index at which the characters and attributes are inserted.
The new characters and attributes begin at the given index and the existing characters and attributes from the index to the end of the receiver are shifted by the length of the attributed string. Raises an NSRangeException if index lies beyond the end of the receiver's characters.
NSMutableAttributedStringMBS.insertString(attrString as String, location as UInt64)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 18.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
NSMutableAttributedStringMBS.removeAttribute(name as string, range as NSRangeMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 12.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
name: A string specifying the attribute name to remove. Attribute keys can be supplied by another framework or can be custom ones you define. For information about where to find the system-supplied attribute keys, see the overview section in NSAttributedString Class Reference.
Range: The range of characters from which the specified attribute is removed.
Raises an NSRangeException if any part of range lies beyond the end of the receiver's characters.
NSMutableAttributedStringMBS.replaceCharacters(search as String, text as String, Options as Integer = 1)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 24.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Default options is for case insensitive search, but you can pass other options.
(see search flags in PDFDocumentMBS class)
NSMutableAttributedStringMBS.replaceCharactersInRange(range as NSRangeMBS, attrString as NSAttributedStringMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 12.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Range: The range of characters and attributes replaced.
attributedString: The attributed string whose characters and attributes replace those in the specified range.
Raises an NSRangeException if any part of range lies beyond the end of the receiver's characters.
See also:
NSMutableAttributedStringMBS.replaceCharactersInRange(range as NSRangeMBS, text as string)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 12.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Range: A range specifying the characters to replace.
text: A string specifying the characters to replace those in range.
The new characters inherit the attributes of the first replaced character from range. Where the length of range is 0, the new characters inherit the attributes of the character preceding range if it has any, otherwise of the character following range.
Raises an NSRangeException if any part of range lies beyond the end of the receiver's characters.
See also:
NSMutableAttributedStringMBS.rulerAttributesInRange(offset as Integer, length as Integer) as Dictionary
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 16.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
NSMutableAttributedStringMBS.setAlignment(alignment as Integer, offset as Integer, length as Integer)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 16.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
When attribute fixing takes place, this change will affect only paragraphs whose first character was included in aRange. Raises an NSRangeException if any part of a range lies beyond the end of the receiver’s characters.
NSMutableAttributedStringMBS.setAttributedString(attrString as NSAttributedStringMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 12.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
attributedString: The attributed string whose characters and attributes replace those in the receiver.
NSMutableAttributedStringMBS.setAttributes(attrs as Dictionary, range as NSRangeMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 12.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
attributes: A dictionary containing the attributes to set. Attribute keys can be supplied by another framework or can be custom ones you define. For information about where to find the system-supplied attribute keys, see the overview section in NSAttributedString Class Reference.
Range: The range of characters whose attributes are set.
These new attributes replace any attributes previously associated with the characters in range. Raises an NSRangeException if any part of range lies beyond the end of the receiver's characters.
To set attributes for a zero-length NSMutableAttributedString displayed in a text view, use the NSTextView method setTypingAttributes.
NSMutableAttributedStringMBS.setBaseWritingDirection(writingDirection as Integer, offset as Integer, length as Integer)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 16.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
NSMutableAttributedStringMBS.setString(attrString as String)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 18.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
NSMutableAttributedStringMBS.subscriptRange(offset as Integer, length as Integer)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 16.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
NSMutableAttributedStringMBS.superscriptRange(offset as Integer, length as Integer)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 16.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
NSMutableAttributedStringMBS.unscriptRange(offset as Integer, length as Integer)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 16.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
NSMutableAttributedStringMBS.updateAttachmentsFromPath(file as folderitem)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 15.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
See also:
NSMutableAttributedStringMBS.updateAttachmentsFromPath(path as string)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Text | MBS MacBase Plugin | 15.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
See also:
The items on this page are in the following plugins: MBS MacBase Plugin.