Class

NSATSTypesetter

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

Declaration

@interface NSATSTypesetter : NSTypesetter

Overview

The typesetter creates line fragment rectangles, positions glyphs within the line fragments, determines line breaks by word wrapping and hyphenation, and handles tab positioning.

NSATSTypesetter encapsulates the advanced typesetting capabilities of Core Text. NSATSTypesetter provides line and character spacing accuracy and supports many languages, including bidirectional languages.

Subclassing

NSATSTypesetter introduced a set of interfaces in OS X version 10.3 that facilitated subclassing and made it possible to substitute a custom layout engine into the Cocoa text system. In OS X version 10.4, those interfaces moved to NSTypesetter, which you can subclass to the same effect. See the NSTypesetter reference documentation for relevant subclassing notes.

Topics

Getting a typesetter

sharedTypesetter

Returns a shared instance of NSATSTypesetter.

Managing the layout manager

layoutManager

The layout manager for the text being typeset.

usesFontLeading

A Boolean value controlling whether the typesetter uses the leading (or line gap) value specified in the font metric information.

typesetterBehavior

The current typesetter behavior value.

hyphenationFactor

The threshold controlling when hyphenation is attempted

Managing the text container

currentTextContainer

The text container for the text being typeset.

lineFragmentPadding

The amount (in points) by which text is inset within line fragment rectangles

Mapping screen and printer fonts

- substituteFontForFont:

Returns a screen font suitable for use in place of the specified original font, or simply returns the original font if a screen font can’t be used or isn’t available.

Managing text tabs

- textTabForGlyphLocation:writingDirection:maxLocation:

Returns the text tab next closest to a given glyph location, indexing in the specified direction but not beyond a given glyph location.

Bidirectional text processing

bidiProcessingEnabled

A Boolean value controlling whether the typesetter performs bidirectional text processing.

Accessing paragraph typesetting information

attributedString

The text backing store on which this typesetter operates.

- setParagraphGlyphRange:separatorGlyphRange:

Sets the current glyph range being processed and the paragraph separator glyph range (the range of the paragraph separator character or characters).

paragraphGlyphRange

The current glyph range being processed

paragraphSeparatorGlyphRange

The current paragraph separator range, which is the full range that contains the current glyph range and that extends from one paragraph separator character to the next.

Paragraph layout

- layoutParagraphAtPoint:

Lays out glyphs in the current glyph range until the next paragraph separator is reached.

Line and paragraph spacing

- lineSpacingAfterGlyphAtIndex:withProposedLineFragmentRect:

Returns the line spacing in effect following the specified glyph.

- paragraphSpacingAfterGlyphAtIndex:withProposedLineFragmentRect:

Returns the paragraph spacing, the number of points of space added following a paragraph, which is in effect after the specified glyph.

- paragraphSpacingBeforeGlyphAtIndex:withProposedLineFragmentRect:

Returns the number of points of space added before a paragraph, which is in effect before the specified glyph.

Glyph caching

- setHardInvalidation:forGlyphRange:

Sets a Boolean value controlling whether to force the layout manager to invalidate the portion of the glyph cache in the given glyph range when invalidating layout.

Laying out glyphs

- boundingBoxForControlGlyphAtIndex:forTextContainer:proposedLineFragment:glyphPosition:characterIndex:

Returns the bounding rectangle for the given control glyph, at the given glyph position and character index, in the given text container.

- getLineFragmentRect:usedRect:forParagraphSeparatorGlyphRange:atProposedOrigin:

Calculates the line fragment rectangle and line fragment used rectangle for blank lines.

- hyphenCharacterForGlyphAtIndex:

Returns the hyphen character to be inserted after the given glyph when hyphenation is enabled in the layout manager.

- hyphenationFactorForGlyphAtIndex:

Returns the hyphenation factor in effect at the given glyph index.

- shouldBreakLineByHyphenatingBeforeCharacterAtIndex:

The typesetter calls this method, if implemented by a subclass, before breaking a line by hyphenating before the character at the given character index, enabling the subclass to control line breaking.

- shouldBreakLineByWordBeforeCharacterAtIndex:

The typesetter calls this method, if implemented by a subclass, before breaking a line by word wrapping before the character at the given character index, enabling the subclass to control line breaking.

- willSetLineFragmentRect:forGlyphRange:usedRect:baselineOffset:

Called by the typesetter just prior to calling setLineFragmentRect:forGlyphRange:usedRect:baselineOffset: which stores the actual line fragment rectangle location in the layout manager.

Interfacing with glyph storage

- getGlyphsInRange:glyphs:characterIndexes:glyphInscriptions:elasticBits:

Extracts the information needed to lay out the glyphs in the given glyph buffer from the given glyph range.

Deprecated

Relationships

Inherits From

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.

NSTextBlock

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

NSTypesetter

An abstract class that performs various type layout tasks.

NSTextLayoutOrientationProvider

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