Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSMutableParagraphStyleMBS class.

NSMutableParagraphStyleMBS.addTabStop(tabstop as NSTextTabMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Text MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Adds tabStop to the receiver.

NSMutableParagraphStyleMBS.Constructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Text MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ✅ Yes All
The constructor.

NSMutableParagraphStyleMBS.removeTabStop(tabstop as NSTextTabMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Text MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Removes the first text tab whose location and type are equal to those of tabStop.

NSMutableParagraphStyleMBS.setAlignment(alignment as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Text MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the alignment of the receiver to alignment.
Example
dim n as NSParagraphStyleMBS = NSParagraphStyleMBS.defaultParagraphStyle
MsgBox str(n.alignment) // 4 = natural

dim m as NSMutableParagraphStyleMBS = n.mutableCopy
m.setAlignment NSParagraphStyleMBS.NSCenterTextAlignment
MsgBox str(m.alignment) // 2 = center

alignment may be one of:

NSLeftTextAlignment
NSRightTextAlignment
NSCenterTextAlignment
NSJustifiedTextAlignment
NSNaturalTextAlignment

NSMutableParagraphStyleMBS.setBaseWritingDirection(writingDirection as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Text MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the base writing direction for the receiver.

It can be NSWritingDirectionNaturalDirection, NSWritingDirectionLeftToRight, or NSWritingDirectionRightToLeft. If you specify NSWritingDirectionNaturalDirection, the receiver resolves the writing direction to either NSWritingDirectionLeftToRight or NSWritingDirectionRightToLeft, depending on the direction for the user's language preference setting.

NSMutableParagraphStyleMBS.setDefaultTabInterval(value as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Text MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the default tab interval for the receiver.

Tabs after the last specified in tabStops are placed at integral multiples of this distance. This value must be nonnegative.

Some examples using this method:

NSMutableParagraphStyleMBS.setFirstLineHeadIndent(value as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Text MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the distance in points from the leading margin of a text container to the beginning of the paragraph's first line to value.

This value must be nonnegative.

NSMutableParagraphStyleMBS.setHeaderLevel(level as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Text MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Specifies whether the paragraph is to be treated as a header for purposes of HTML generation.

Should be set to 0 (the default value) if the paragraph is not a header, or from 1 through 6 if the paragraph is to be treated as a header.

NSMutableParagraphStyleMBS.setHeadIndent(value as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Text MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the distance in points from the leading margin of a text container to the beginning of lines other than the first to value.

This value must be nonnegative.

NSMutableParagraphStyleMBS.setHyphenationFactor(value as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Text MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Specifies the threshold for hyphenation.

Valid values lie between 0.0 and 1.0 inclusive. The default value is 0.0. Hyphenation is attempted when the ratio of the text width (as broken without hyphenation) to the width of the line fragment is less than the hyphenation factor. When the paragraph's hyphenation factor is 0.0, the layout manager's hyphenation factor is used instead. When both are 0.0, hyphenation is disabled.

NSMutableParagraphStyleMBS.setLineBreakMode(mode as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Text MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the mode used to break lines in a layout container to mode.

The mode parameter may be one of:

NSLineBreakByWordWrapping
NSLineBreakByCharWrapping
NSLineBreakByClipping
NSLineBreakByTruncatingHead
NSLineBreakByTruncatingTail
NSLineBreakByTruncatingMiddle
See the description of lineBreakMode in the NSParagraphStyle class specification for descriptions of these values.

NSMutableParagraphStyleMBS.setLineHeightMultiple(value as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Text MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the line height multiple for the receiver.

The natural line height of the receiver is multiplied by this factor before being constrained by minimum and maximum line height. This value must be nonnegative.

Some examples using this method:

NSMutableParagraphStyleMBS.setLineSpacing(value as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Text MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the space in points added between lines within the paragraph to value.
Example
// works for Labels, TextArea and TextFields

// control is either a textfield or a textview
dim n as NSTextFieldMBS = me.NSTextFieldMBS
dim v as NSTextViewMBS = me.NSTextViewMBS

// get text with attributes
dim a as NSAttributedStringMBS

if n<>Nil then
a = n.attributedStringValue
elseif v<>nil then
a = v.textStorage
end if

// get style
dim p as NSParagraphStyleMBS

try
p = a.attributeAtIndex(a.NSParagraphStyleAttributeName, 0)
catch ex as NSExceptionMBS
// we have none, so make one
p = new NSParagraphStyleMBS
end try

// modify it
dim m as NSMutableParagraphStyleMBS = p.mutableCopy
m.setLineSpacing 5

// add back to styled text
dim s as NSMutableAttributedStringMBS = a.mutableCopy
s.addAttribute(a.NSParagraphStyleAttributeName, m, new NSRangeMBS(0, s.length))

// and apply to control
if n<>Nil then
n.attributedStringValue = s
elseif v<>nil then
v.textStorage.setAttributedString s
end if

This value must be nonnegative.

NSMutableParagraphStyleMBS.setMaximumLineHeight(value as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Text MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the maximum height that any line in the paragraph style will occupy, regardless of the font size or size of any attached graphic, to value.

Glyphs and graphics exceeding this height will overlap neighboring lines; however, a maximum height of 0 implies no line height limit. This value must be nonnegative.

Although this limit applies to the line itself, line spacing adds extra space between adjacent lines.

NSMutableParagraphStyleMBS.setMinimumLineHeight(value as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Text MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the minimum height that any line in the paragraph style will occupy, regardless of the font size or size of any attached graphic, to value.

This value must be nonnegative.

NSMutableParagraphStyleMBS.setParagraphSpacing(value as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Text MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the space added at the end of the paragraph to separate it from the following paragraph to value.

This value must be nonnegative.

NSMutableParagraphStyleMBS.setParagraphSpacingBefore(value as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Text MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the distance between the paragraph's top and the beginning of its text content.

This value must be nonnegative.

NSMutableParagraphStyleMBS.setParagraphStyle(ParagraphStyle as NSParagraphStyleMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Text MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Replaces the subattributes of the receiver with those in ParagraphStyle.

NSMutableParagraphStyleMBS.setTabStops(tabStops() as NSTextTabMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Text MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Replaces the tab stops in the receiver with tabStops.

Some examples using this method:

NSMutableParagraphStyleMBS.setTailIndent(value as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Text MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the distance in points from the margin of a text container to the end of lines to value.

If positive, this is the distance from the leading margin (for example, the left margin in left-to-right text). That is, it's the absolute line width. If 0 or negative, it's the distance from the trailing margin—the value is added to the line width.

For example, to create a paragraph style that fits exactly in a 2-inch wide container, set its head indent to 0.0 and its tail indent to 0.0. To create a paragraph style with quarter-inch margins, set its head indent to 0.25 and its tail indent to –0.25.

NSMutableParagraphStyleMBS.setTextBlocks(TextBlocks() as NSTextBlockMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Text MBS MacCocoa Plugin 22.0 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Sets the text blocks that contain the paragraph.

NSMutableParagraphStyleMBS.setTextLists(TextLists() as NSTextListMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Text MBS MacCocoa Plugin 18.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Sets the text lists containing the paragraph.

Some examples using this method:

NSMutableParagraphStyleMBS.setTighteningFactorForTruncation(value as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Text MBS MacCocoa Plugin 12.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Specifies the threshold for using tightening as an alternative to truncation.

When the line break mode specifies truncation, the text system attempts to tighten intercharacter spacing as an alternative to truncation, provided that the ratio of the text width to the line fragment width does not exceed 1.0 + the value returned by tighteningFactorForTruncation. Otherwise the text is truncated at a location determined by the line break mode. The default value is 0.05. This method accepts positive and negative values. Values less than or equal to 0.0 result in not tightening.

The items on this page are in the following plugins: MBS MacCocoa Plugin.


The biggest plugin in space...