Developer Documentation
PATH  Mac OS X Documentation > Application Kit Reference: Java

Table of Contents

NSParagraphStyle


Inherits from:
NSObject
Package:
com.apple.yellow.application


Class Description


NSParagraphStyle and its subclass NSMutableParagraphStyle encapsulate the paragraph or ruler attributes used by the NSAttributedString classes. Instances of these classes are often referred to as paragraph style objects, or when no confusion will result, as paragraph styles.

A paragraph style object represents a complex attribute value in an attributed string, storing a number of sub-attributes that affect paragraph layout for the characters of the string. Among these sub-attributes are alignment, tab stops, and indents. See the method descriptions for more information on each sub-attribute.




Constants


These constants specify what happens when a line is too long for its container:


Value Meaning
LineBreakByWordWrapping Wrapping occurs at word boundaries, unless the word itself doesn't fit on a single line.
LineBreakByCharWrapping Wrapping occurs before the first character that doesn't fit.
LineBreakByClipping Lines are simply not drawn past the edge of the text container.
LineBreakByTruncatingHead Each line is displayed so that the end fits in the container and the missing text is indicated by some kind of ellipsis glyph.
LineBreakByTruncatingTail Each line is displayed so that the beginning fits in the container and the missing text is indicated by some kind of ellipsis glyph.
LineBreakByTruncatingMiddle Each line is displayed so that the beginning and end fit in the container and the missing text is indicated by some kind of ellipsis glyph in the middle.

These constants the type of tab stop:


Value Meaning
LeftTabStopType Description forthcoming.
RightTabStopType Description forthcoming.
CenterTabStopType Description forthcoming.
DecimalTabStopType Description forthcoming.



Method Types


Constructors
NSParagraphStyle
Creating an NSParagraphStyle
defaultParagraphStyle
Accessing style information
alignment
firstLineHeadIndent
headIndent
tailIndent
tabStops
lineBreakMode
maximumLineHeight
minimumLineHeight
lineSpacing
paragraphSpacing


Constructors



NSParagraphStyle

public NSParagraphStyle()

Description forthcoming.


Static Methods



defaultParagraphStyle

public static NSParagraphStyle defaultParagraphStyle()

Returns the default paragraph style. The default paragraph style has the following default values:
Sub-Attribute Default Value
Alignment NaturalTextAlignment
Tab stops 12 left-aligned tabs, spaced by 28.0 points
Line break mode LineBreakByWordWrapping
All others 0.0

See individual method descriptions for explanations of each sub-attribute.




Instance Methods



alignment

public int alignment()

Returns the text alignment of the paragraph style. Text alignment is one of:

Natural text alignment is realized as left or right alignment depending on the line sweep direction of the first script contained in the paragraph.

See Also: setAlignment (NSMutableParagraphStyle)



firstLineHeadIndent

public float firstLineHeadIndent()

Returns the distance in points from the leading margin of a text container to the beginning of the paragraph's first line. This value is always nonnegative.

See Also: headIndent, tailIndent, setFirstLineHeadIndent (NSMutableParagraphStyle)



headIndent

public float headIndent()

Returns the distance in points from the leading margin of a text container to the beginning of lines other than the first. This value is always nonnegative.

See Also: firstLineHeadIndent, tailIndent, setHeadIndent (NSMutableParagraphStyle)



lineBreakMode

public int lineBreakMode()

Returns the mode that should be used to break lines when laying out the paragraph's text. See "Constants" for a list of values.

See Also: setLineBreakMode (NSMutableParagraphStyle)



lineSpacing

public float lineSpacing()

Returns the space in points added between lines within the paragraph (commonly known as leading). This value is always nonnegative.

See Also: maximumLineHeight, minimumLineHeight, paragraphSpacing, setLineSpacing (NSMutableParagraphStyle)



maximumLineHeight

public float maximumLineHeight()

Returns the maximum height that any line in the paragraph style will occupy, regardless of the font size or size of any attached graphic. Glyphs and graphics exceeding this height will overlap neighboring lines; however, a maximum height of zero implies no line height limit. This value is always nonnegative. The default value is zero.

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

See Also: minimumLineHeight, lineSpacing, setMaximumLineHeight (NSMutableParagraphStyle)



minimumLineHeight

public float minimumLineHeight()

Returns the minimum height that any line in the paragraph style will occupy, regardless of the font size or size of any attached graphic. This value is always nonnegative.

See Also: maximumLineHeight, lineSpacing, setMinimumLineHeight (NSMutableParagraphStyle)



paragraphSpacing

public float paragraphSpacing()

Returns the space added at the end of the paragraph to separate it from the following paragraph. This value is always nonnegative.

See Also: lineSpacing, setParagraphSpacing (NSMutableParagraphStyle)



tabStops

public NSArray tabStops()

Returns the NSTextTab objects, sorted by location, that define the tab stops for the paragraph style.

See Also: location (NSTextTab), setTabStops (NSMutableParagraphStyle), addTabStop (NSMutableParagraphStyle), removeTabStop (NSMutableParagraphStyle)



tailIndent

public float tailIndent()

Returns the distance in points from the margin of a text container to the end of lines. If positive, this is the distance from the leading margin (for example, the left margin in left-to-right text). If zero or negative, it's the distance from the trailing margin.

For example, a paragraph style designed to fit exactly in a 2-inch wide container has a head indent of 0.0 and a tail indent of 0.0. One designed to fit with a quarter-inch margin has a head indent of 0.25 and a tail indent of -0.25.

See Also: headIndent, firstLineHeadIndent, setTailIndent: (NSMutableParagraphStyle)




Table of Contents