Class

NSTextBlock

A block of text laid out in a subregion of the text container.

Overview

A text block appears as an attribute of a paragraph, and as part of the paragraph style. The most important subclass of NSTextBlock is NSTextTableBlock, which represents a block of text that appears as a cell in a table. The table itself is represented by a separate class, NSTextTable, which is referenced by all of its NSTextTableBlock objects and which controls their sizing and positioning.

Topics

Creating text blocks

init

Initializes and returns an empty text block object.

Working with dimensions of content

setValue:type:forDimension:

Sets a dimension of the text block.

valueForDimension:

Returns the value of the specified text block dimension.

valueTypeForDimension:

Returns the value type of the specified text block dimension.

contentWidth

The width of the text block.

contentWidthValueType

The type of value stored for the text block width.

Getting and setting margins, borders, and padding

setWidth:type:forLayer:edge:

Sets the width of a specified edge of a specified layer of the text block.

setWidth:type:forLayer:

Sets the width of all edges of a specified layer of the text block.

widthForLayer:edge:

Returns the width of an edge of a specified layer of the text block.

widthValueTypeForLayer:edge:

Returns the value type of an edge of a specified layer of the text block.

Getting and setting alignment

verticalAlignment

The vertical alignment of the text block.

Working with color

backgroundColor

The background color of the text block.

setBorderColor:forEdge:

Sets the border color of the specified edge of the text block.

setBorderColor:

Sets the color of all borders of the text block.

borderColorForEdge:

Returns the border color of the specified text block edge.

Determining size and position of a text block

rectForLayoutAtPoint:inRect:textContainer:characterRange:

Returns the rectangle within which glyphs should be laid out for the specified arguments.

boundsRectForContentRect:inRect:textContainer:characterRange:

Returns the rectangle the text in the block actually occupies, including padding, borders, and margins.

Drawing colors and decorations

drawBackgroundWithFrame:inView:characterRange:layoutManager:

Called by the layout manager to draw any colors and other decorations before the text is drawn.

Constants

NSTextBlockValueType

The following constants specify values used by the methods setValue:type:forDimension: and valueTypeForDimension: to specify text block value types.

NSTextBlockDimension

The following constants specify values used by the methods setValue:type:forDimension:, valueForDimension:, and valueTypeForDimension: to specify text block dimensions.

NSTextBlockLayer

The following constants specify values used by the properties and methods contentWidthValueType, setWidth:type:forLayer:edge:, setWidth:type:forLayer:, widthForLayer:edge:, and widthValueTypeForLayer:edge: to specify text block layer values.

NSTextBlockVerticalAlignment

The following constants specify values used by the property verticalAlignment to specify vertical alignment.

Instance Methods

setContentWidth:type:

Sets the width of the text block.

Relationships

Inherits From

Conforms To

See Also

Layout

NSLayoutManager

An object that coordinates the layout and display of characters held in an NSTextStorage object.

NSLayoutManagerDelegate

A set of optional methods implemented by delegates of NSLayoutManager objects.

NSTextContainer

A region where text is laid out.

NSATSTypesetter

A concrete subclass of NSTypesetter that places glyphs during the text layout process.

NSTypesetter

An abstract class that performs various type layout tasks.

NSTextLayoutOrientationProvider

A set of methods that define the orientation of text for an object.