<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSATSTypesetter",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSATSTypesetter"
  },
  "title" : "NSATSTypesetter"
}
-->

# NSATSTypesetter

A concrete typesetter object that places glyphs during the text layout process.

```
class NSATSTypesetter
```

## Overview

An [`NSATSTypesetter`](/documentation/AppKit/NSATSTypesetter) object creates line fragment rectangles, positions glyphs within the line fragments, determines line breaks by word wrapping and hyphenation, and handles tab positioning. This object encapsulates the advanced typesetting capabilities of Core Text. [`NSATSTypesetter`](/documentation/AppKit/NSATSTypesetter) provides line and character spacing accuracy and supports many languages, including bidirectional languages.

> Note:
> Use this class with ``doc://com.apple.appkit/documentation/AppKit/NSLayoutManager`` in macOS11 and earlier. In macOS12 and later, consider using ``doc://com.apple.appkit/documentation/AppKit/NSTextLayoutManager`` which provides improved support for international scripts.

## Topics

### Getting the shared typesetter object

[`shared`](/documentation/AppKit/NSATSTypesetter/shared)

Returns a shared instance of the typesetter.

### Accessing the layout manager

[`layoutManager`](/documentation/AppKit/NSATSTypesetter/layoutManager)

The layout manager for the text being typeset.

[`usesFontLeading`](/documentation/AppKit/NSATSTypesetter/usesFontLeading)

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

[`typesetterBehavior`](/documentation/AppKit/NSATSTypesetter/typesetterBehavior)

The current typesetter behavior value.

[`hyphenationFactor`](/documentation/AppKit/NSATSTypesetter/hyphenationFactor)

The threshold controlling when hyphenation is attempted.

[`bidiProcessingEnabled`](/documentation/AppKit/NSATSTypesetter/bidiProcessingEnabled)

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

### Getting the text container

[`currentTextContainer`](/documentation/AppKit/NSATSTypesetter/currentTextContainer)

The text container for the text being typeset.

[`lineFragmentPadding`](/documentation/AppKit/NSATSTypesetter/lineFragmentPadding)

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

### Performing font substitution

[`substituteFont(for:)`](/documentation/AppKit/NSATSTypesetter/substituteFont(for:))

Returns a screen font suitable for use in place of the specified original font,.

### Getting the location of text tabs

[`textTab(forGlyphLocation:writingDirection:maxLocation:)`](/documentation/AppKit/NSATSTypesetter/textTab(forGlyphLocation:writingDirection:maxLocation:))

Returns the text tab closest to the specified glyph location and not beyond a maximum position.

### Accessing paragraph information

[`attributedString`](/documentation/AppKit/NSATSTypesetter/attributedString)

The backing store that contains the text on which this typesetter operates.

[`setParagraphGlyphRange(_:separatorGlyphRange:)`](/documentation/AppKit/NSATSTypesetter/setParagraphGlyphRange(_:separatorGlyphRange:))

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

[`paragraphGlyphRange`](/documentation/AppKit/NSATSTypesetter/paragraphGlyphRange)

The current glyph range being processed.

[`paragraphSeparatorGlyphRange`](/documentation/AppKit/NSATSTypesetter/paragraphSeparatorGlyphRange)

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

### Laying out a paragraph

[`layoutParagraph(at:)`](/documentation/AppKit/NSATSTypesetter/layoutParagraph(at:))

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

### Getting Spacing Information

[`lineSpacing(afterGlyphAt:withProposedLineFragmentRect:)`](/documentation/AppKit/NSATSTypesetter/lineSpacing(afterGlyphAt:withProposedLineFragmentRect:))

Returns the line spacing in effect following the specified glyph.

[`paragraphSpacing(afterGlyphAt:withProposedLineFragmentRect:)`](/documentation/AppKit/NSATSTypesetter/paragraphSpacing(afterGlyphAt:withProposedLineFragmentRect:))

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

[`paragraphSpacing(beforeGlyphAt:withProposedLineFragmentRect:)`](/documentation/AppKit/NSATSTypesetter/paragraphSpacing(beforeGlyphAt:withProposedLineFragmentRect:))

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

### Laying Out Glyphs

[`boundingBox(forControlGlyphAt:for:proposedLineFragment:glyphPosition:characterIndex:)`](/documentation/AppKit/NSATSTypesetter/boundingBox(forControlGlyphAt:for:proposedLineFragment:glyphPosition:characterIndex:))

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

[`getLineFragmentRect(_:usedRect:forParagraphSeparatorGlyphRange:atProposedOrigin:)`](/documentation/AppKit/NSATSTypesetter/getLineFragmentRect(_:usedRect:forParagraphSeparatorGlyphRange:atProposedOrigin:))

Calculates the line fragment rectangle and the portion of the rectangle that contains marks.

[`hyphenCharacter(forGlyphAt:)`](/documentation/AppKit/NSATSTypesetter/hyphenCharacter(forGlyphAt:))

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

[`hyphenationFactor(forGlyphAt:)`](/documentation/AppKit/NSATSTypesetter/hyphenationFactor(forGlyphAt:))

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

[`shouldBreakLine(byHyphenatingBeforeCharacterAt:)`](/documentation/AppKit/NSATSTypesetter/shouldBreakLine(byHyphenatingBeforeCharacterAt:))

Breaks a line by hyphenating before the character at the specified index.

[`shouldBreakLine(byWordBeforeCharacterAt:)`](/documentation/AppKit/NSATSTypesetter/shouldBreakLine(byWordBeforeCharacterAt:))

Breaks a line by word-wrapping before the character at the specified index.

[`willSetLineFragmentRect(_:forGlyphRange:usedRect:baselineOffset:)`](/documentation/AppKit/NSATSTypesetter/willSetLineFragmentRect(_:forGlyphRange:usedRect:baselineOffset:))

Notifies subclasses that the typesetter is about to set a new line fragment.

[`setHardInvalidation(_:forGlyphRange:)`](/documentation/AppKit/NSATSTypesetter/setHardInvalidation(_:forGlyphRange:))

Sets a Boolean value that determines whether the layout manager invalidates the specified portion of the glyph cache.

### Deprecated

[`getGlyphs(in:glyphs:characterIndexes:glyphInscriptions:elasticBits:)`](/documentation/AppKit/NSATSTypesetter/getGlyphs(in:glyphs:characterIndexes:glyphInscriptions:elasticBits:))

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

[`lineFragmentRectForProposedRect:remainingRect:`](/documentation/AppKit/NSATSTypesetter/lineFragmentRectForProposedRect:remainingRect:)

This method has been deprecated. Use the NSTypesetter method [`getLineFragmentRect(_:usedRect:remaining:forStartingGlyphAt:proposedRect:lineSpacing:paragraphSpacingBefore:paragraphSpacingAfter:)`](/documentation/AppKit/NSTypesetter/getLineFragmentRect(_:usedRect:remaining:forStartingGlyphAt:proposedRect:lineSpacing:paragraphSpacingBefore:paragraphSpacingAfter:)) instead.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)