<!--
{
  "availability" : [
    "macOS: 10.5.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTypesetter/layoutCharacters(in:for:maximumNumberOfLineFragments:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSTypesetter(im)layoutCharactersInRange:forLayoutManager:maximumNumberOfLineFragments:"
  },
  "title" : "layoutCharacters(in:for:maximumNumberOfLineFragments:)"
}
-->

# layoutCharacters(in:for:maximumNumberOfLineFragments:)

Lays out characters in the given character range for the specified layout manager.

```
func layoutCharacters(in characterRange: NSRange, for layoutManager: NSLayoutManager, maximumNumberOfLineFragments maxNumLines: Int) -> NSRange
```

## Parameters

`characterRange`

The range of the characters to lay out.

`layoutManager`

The layout manager that does the drawing.

`maxNumLines`

The maximum number of line fragments to lay out. Specify `NSUIntegerMax` for unlimited number of line fragments.

## Return Value

The method returns the actual character range that the receiving `NSTypesetter` processed.

## Discussion

The layout process can be interrupted when the number of line fragments exceeds `maxNumLines`.

---

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)