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 |
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.
– setParagraphStyle:
– setAlignment:
– setFirstLineHeadIndent:
– setHeadIndent:
– setTailIndent:
– setLineBreakMode:
– setMaximumLineHeight:
– setMinimumLineHeight:
– setLineSpacing:
– setParagraphSpacing:
– setBaseWritingDirection:
– setLineHeightMultiple:
– setParagraphSpacingBefore:
– setDefaultTabInterval:
Adds tabStop to the receiver.
- (void)addTabStop:(NSTextTab *)tabStop
– removeTabStop:
– setTabStops:
– tabStops
(NSParagraphStyle)NSParagraphStyle.h
Removes the first text tab whose location and type are equal to those of tabStop.
- (void)removeTabStop:(NSTextTab *)tabStop
– addTabStop:
– setTabStops:
– tabStops
(NSParagraphStyle)NSParagraphStyle.h
Sets the alignment of the receiver to alignment.
- (void)setAlignment:(NSTextAlignment)alignment
alignment may be one of:
– alignment
(NSParagraphStyle)NSParagraphStyle.h
Sets the base writing direction for the receiver.
- (void)setBaseWritingDirection:(NSWritingDirection)writingDirection
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.
+ defaultWritingDirectionForLanguage:
(NSParagraphStyle)– baseWritingDirection
(NSParagraphStyle)NSParagraphStyle.h
Sets the default tab interval for the receiver.
- (void)setDefaultTabInterval:(CGFloat)aFloat
Tabs after the last specified in tabStops
are placed at integral multiples of this distance. This value must be nonnegative.
– defaultTabInterval
(NSParagraphStyle)NSParagraphStyle.h
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
This value must be nonnegative.
– setHeadIndent:
– setTailIndent:
– firstLineHeadIndent
(NSParagraphStyle)NSParagraphStyle.h
Specifies whether the paragraph is to be treated as a header for purposes of HTML generation.
- (void)setHeaderLevel:(NSInteger)level
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.
– headerLevel
(NSParagraphStyle)NSParagraphStyle.h
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
This value must be nonnegative.
– setFirstLineHeadIndent:
– setTailIndent:
– headIndent
(NSParagraphStyle)NSParagraphStyle.h
Specifies the threshold for hyphenation.
- (void)setHyphenationFactor:(float)aFactor
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.
– hyphenationFactor
(NSParagraphStyle)NSParagraphStyle.h
Sets the mode used to break lines in a layout container to mode.
- (void)setLineBreakMode:(NSLineBreakMode)mode
The mode parameter may be one of:
See the description of lineBreakMode
in the NSParagraphStyle class specification for descriptions of these values.
NSParagraphStyle.h
Sets the line height multiple for the receiver.
- (void)setLineHeightMultiple:(CGFloat)aFloat
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.
– lineHeightMultiple
(NSParagraphStyle)NSParagraphStyle.h
Sets the space in points added between lines within the paragraph to aFloat.
- (void)setLineSpacing:(CGFloat)aFloat
This value must be nonnegative.
– setMaximumLineHeight:
– setMinimumLineHeight:
– setParagraphSpacing:
– lineSpacing
(NSParagraphStyle)NSParagraphStyle.h
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
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.
– setMinimumLineHeight:
– setLineSpacing:
– maximumLineHeight
(NSParagraphStyle)NSParagraphStyle.h
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
This value must be nonnegative.
– setMaximumLineHeight:
– setLineSpacing:
– minimumLineHeight
(NSParagraphStyle)NSParagraphStyle.h
Sets the space added at the end of the paragraph to separate it from the following paragraph to aFloat.
- (void)setParagraphSpacing:(CGFloat)aFloat
This value must be nonnegative.
– setLineSpacing:
– setParagraphSpacingBefore:
– paragraphSpacing
(NSParagraphStyle)NSParagraphStyle.h
Sets the distance between the paragraph’s top and the beginning of its text content
- (void)setParagraphSpacingBefore:(CGFloat)aFloat
. This value must be nonnegative.
– setParagraphSpacing:
– paragraphSpacingBefore
(NSParagraphStyle)NSParagraphStyle.h
Replaces the subattributes of the receiver with those in aStyle.
- (void)setParagraphStyle:(NSParagraphStyle *)aStyle
NSParagraphStyle.h
Replaces the tab stops in the receiver with tabStops.
- (void)setTabStops:(NSArray *)tabStops
– addTabStop:
– removeTabStop:
– tabStops
(NSParagraphStyle)NSParagraphStyle.h
Sets the distance in points from the margin of a text container to the end of lines to aFloat.
- (void)setTailIndent:(CGFloat)aFloat
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.
– setHeadIndent:
– setFirstLineHeadIndent:
– tailIndent
(NSParagraphStyle)NSParagraphStyle.h
Sets the text blocks containing the paragraph, nested from outermost to innermost to array.
- (void)setTextBlocks:(NSArray *)array
– textBlocks
(NSParagraphStyle)NSParagraphStyle.h
- (void)setTextLists:(NSArray *)array
Sets the text lists containing the paragraph, nested from outermost to innermost, to array.
– textLists
(NSParagraphStyle)NSParagraphStyle.h
Specifies the threshold for using tightening as an alternative to truncation.
- (void)setTighteningFactorForTruncation:(float)aFactor
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.
– tighteningFactorForTruncation
(NSParagraphStyle)NSParagraphStyle.h
© 2008 Apple Inc. All Rights Reserved. (Last updated: 2008-10-15)