<!--
{
  "availability" : [
    "macOS: 10.11.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSLayoutManager/enumerateLineFragments(forGlyphRange:using:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSLayoutManager(im)enumerateLineFragmentsForGlyphRange:usingBlock:"
  },
  "title" : "enumerateLineFragments(forGlyphRange:using:)"
}
-->

# enumerateLineFragments(forGlyphRange:using:)

Enumerates line fragments intersecting with the specified glyph range.

```
func enumerateLineFragments(forGlyphRange glyphRange: NSRange, using block: @escaping (NSRect, NSRect, NSTextContainer, NSRange, UnsafeMutablePointer<ObjCBool>) -> Void)
```

## Parameters

`glyphRange`

The glyph range for which to return line fragment rectangles.

`block`

The block to apply to the glyph range. The block has five arguments:

- rect: The current line fragment rectangle.
- usedRect: The portion of the line fragment rectangle that actually contains glyphs or other marks that are drawn (including the text container’s line fragment padding).
- textContainer: The text container in which the glyphs are laid out.
- glyphRange: The range of glyphs laid out in the current line fragment.
- stop: A reference to a Boolean value. The block can set the value to <doc://com.apple.documentation/documentation/Swift/true> to stop further processing of the array. The stop argument is an out-only argument. You should only set this Boolean to <doc://com.apple.documentation/documentation/Swift/true> within the block.

## Discussion

This method causes glyph generation and layout for the line fragment containing the glyphs in the specified range, or if noncontiguous layout is not enabled, for all of the text up to and including that line fragment.

Line fragment rectangles are always in container coordinates.

---

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)