Class

NSTextBlock

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

Declaration

@interface NSTextBlock : NSObject

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 a NSTextTable object. All NSTextBlock objects reference this table, 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.

- setContentWidth:type:

Sets the width of the text block.

contentWidth

The width of the text block.

contentWidthValueType

The type of value stored for the text block width.

NSTextBlockDimension

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

NSTextBlockValueType

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

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.

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.

Getting and setting alignment

verticalAlignment

The vertical alignment of the text block.

NSTextBlockVerticalAlignment

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

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.

Relationships

Inherits From

See Also

Formatted Content

NSParagraphStyle

The paragraph or ruler attributes used by an attributed string.

NSMutableParagraphStyle

An object that enables changing the values of the subattributes in a paragraph style attribute.

NSTextTable

An object that represents a text table as a whole.

NSTextTableBlock

A text block that appears as a cell in a text table.

NSTextTab

A tab in an NSParagraphStyle object, storing an alignment type and location.

NSTextList

A section of text that forms a single list.