NSMutableParagraphStyle Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/AppKit.framework
Availability
Available in OS X v10.0 and later.
Companion guide
Declared in
NSParagraphStyle.h
Related sample code

Overview

The NSMutableParagraphStyle class adds methods to its superclass, NSParagraphStyle, for changing the values of the subattributes in a paragraph style attribute. See the NSParagraphStyle and NSAttributedString specifications for more information.

Tasks

Setting Other Style Information

Accessing Tab Information

Setting Text Blocks and Lists

Controlling Hyphenation and Truncation

Setting HTML Header Level

Instance Methods

addTabStop:

Adds tabStop to the receiver.

- (void)addTabStop:(NSTextTab *)tabStop
Availability
  • Available in OS X v10.0 and later.
See Also
Related Sample Code
Declared In
NSParagraphStyle.h

removeTabStop:

Removes the first text tab whose location and type are equal to those of tabStop.

- (void)removeTabStop:(NSTextTab *)tabStop
Availability
  • Available in OS X v10.0 and later.
See Also
Declared In
NSParagraphStyle.h

setAlignment:

Sets the alignment of the receiver to alignment.

- (void)setAlignment:(NSTextAlignment)alignment
Availability
  • Available in OS X v10.0 and later.
See Also
Declared In
NSParagraphStyle.h

setBaseWritingDirection:

Sets the base writing direction for the receiver.

- (void)setBaseWritingDirection:(NSWritingDirection)writingDirection
Discussion

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.

Availability
  • Available in OS X v10.2 and later.
See Also
Related Sample Code
Declared In
NSParagraphStyle.h

setDefaultTabInterval:

Sets the default tab interval for the receiver.

- (void)setDefaultTabInterval:(CGFloat)aFloat
Discussion

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

Availability
  • Available in OS X v10.3 and later.
See Also
Related Sample Code
Declared In
NSParagraphStyle.h

setFirstLineHeadIndent:

Sets the distance in points from the leading margin of a text container to the beginning of the paragraph’s first line to aFloat.

- (void)setFirstLineHeadIndent:(CGFloat)aFloat
Discussion

This value must be nonnegative.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSParagraphStyle.h

setHeaderLevel:

Specifies whether the paragraph is to be treated as a header for purposes of HTML generation.

- (void)setHeaderLevel:(NSInteger)level
Discussion

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.

Availability
  • Available in OS X v10.4 and later.
See Also
Declared In
NSParagraphStyle.h

setHeadIndent:

Sets the distance in points from the leading margin of a text container to the beginning of lines other than the first to aFloat.

- (void)setHeadIndent:(CGFloat)aFloat
Discussion

This value must be nonnegative.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSParagraphStyle.h

setHyphenationFactor:

Specifies the paragraph’s threshold for hyphenation.

- (void)setHyphenationFactor:(float)aFactor
Discussion

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.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSParagraphStyle.h

setLineBreakMode:

Sets the mode used to break lines in a layout container to mode.

- (void)setLineBreakMode:(NSLineBreakMode)mode
Discussion

For a list of line break constants, see the “Constants” section of NSParagraphStyle Class Reference.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSParagraphStyle.h

setLineHeightMultiple:

Sets the line height multiple for the receiver.

- (void)setLineHeightMultiple:(CGFloat)aFloat
Discussion

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.

Availability
  • Available in OS X v10.3 and later.
See Also
Declared In
NSParagraphStyle.h

setLineSpacing:

Sets the distance in points added between lines within the paragraph to aFloat.

- (void)setLineSpacing:(CGFloat)aFloat
Discussion

This value must be nonnegative.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSParagraphStyle.h

setMaximumLineHeight:

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 aFloat.

- (void)setMaximumLineHeight:(CGFloat)aFloat
Discussion

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.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSParagraphStyle.h

setMinimumLineHeight:

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 aFloat.

- (void)setMinimumLineHeight:(CGFloat)aFloat
Discussion

This value must be nonnegative.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSParagraphStyle.h

setParagraphSpacing:

Sets the space added at the end of the paragraph to separate it from the following paragraph to aFloat.

- (void)setParagraphSpacing:(CGFloat)aFloat
Discussion

This value must be nonnegative.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSParagraphStyle.h

setParagraphSpacingBefore:

Sets the distance between the paragraph’s top and the beginning of its text content

- (void)setParagraphSpacingBefore:(CGFloat)aFloat
Discussion

. This value must be nonnegative.

Availability
  • Available in OS X v10.3 and later.
Declared In
NSParagraphStyle.h

setParagraphStyle:

Replaces the subattributes of the receiver with those in the specified paragraph style object.

- (void)setParagraphStyle:(NSParagraphStyle *)aStyle
Availability
  • Available in OS X v10.0 and later.
Declared In
NSParagraphStyle.h

setTabStops:

Replaces the tab stops in the receiver with tabStops.

- (void)setTabStops:(NSArray *)tabStops
Availability
  • Available in OS X v10.0 and later.
See Also
Related Sample Code
Declared In
NSParagraphStyle.h

setTailIndent:

Sets the distance in points from the margin of a text container to the end of lines to aFloat.

- (void)setTailIndent:(CGFloat)aFloat
Discussion

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.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSParagraphStyle.h

setTextBlocks:

Sets the text blocks containing the paragraph, nested from outermost to innermost to array.

- (void)setTextBlocks:(NSArray *)array
Availability
  • Available in OS X v10.4 and later.
Related Sample Code
Declared In
NSParagraphStyle.h

setTextLists:

Sets the array of text lists containing the paragraph.

- (void)setTextLists:(NSArray *)array
Discussion

Sets the text lists containing the paragraph, nested from outermost to innermost, to array.

Availability
  • Available in OS X v10.4 and later.
Declared In
NSParagraphStyle.h

setTighteningFactorForTruncation:

Specifies the threshold for using tightening as an alternative to truncation.

- (void)setTighteningFactorForTruncation:(float)aFactor
Discussion

When the line break mode specifies truncation, the text system attempts to tighten inter character 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.

Availability
  • Available in OS X v10.4 and later.
See Also
Declared In
NSParagraphStyle.h