Next Page > Hide TOC

NSMutableParagraphStyle Class Reference

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

Overview

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

Important: A paragraph style object should not be mutated after adding it to an attributed string; doing so can cause your program to crash.

Tasks

Setting Tab Stops

Setting Other Style 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
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
See Also
Declared In
NSParagraphStyle.h

setAlignment:

Sets the alignment of the receiver to alignment.

- (void)setAlignment:(NSTextAlignment)alignment

Discussion

alignment may be one of:

Availability
See Also
Related Sample Code
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
See Also
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
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
See Also
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
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
See Also
Declared In
NSParagraphStyle.h

setHyphenationFactor:

Specifies the 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
See Also
Declared In
NSParagraphStyle.h

setLineBreakMode:

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

- (void)setLineBreakMode:(NSLineBreakMode)mode

Discussion

The mode parameter may be one of:

See the description of lineBreakMode in the NSParagraphStyle class specification for descriptions of these values.

Availability
Related Sample Code
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
See Also
Declared In
NSParagraphStyle.h

setLineSpacing:

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

- (void)setLineSpacing:(CGFloat)aFloat

Discussion

This value must be nonnegative.

Availability
See Also
Related Sample Code
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
See Also
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
See Also
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
See Also
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
See Also
Declared In
NSParagraphStyle.h

setParagraphStyle:

Replaces the subattributes of the receiver with those in aStyle.

- (void)setParagraphStyle:(NSParagraphStyle *)aStyle

Availability
Related Sample Code
Declared In
NSParagraphStyle.h

setTabStops:

Replaces the tab stops in the receiver with tabStops.

- (void)setTabStops:(NSArray *)tabStops

Availability
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
See Also
Declared In
NSParagraphStyle.h

setTextBlocks:

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

- (void)setTextBlocks:(NSArray *)array

Availability
See Also
Related Sample Code
Declared In
NSParagraphStyle.h

setTextLists:

- (void)setTextLists:(NSArray *)array

Discussion

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

Availability
See Also
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 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.

Availability
See Also
Declared In
NSParagraphStyle.h

Next Page > Hide TOC


© 2008 Apple Inc. All Rights Reserved. (Last updated: 2008-10-15)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.