<!--
{
  "availability" : [
    "macOS: 10.7.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSLayoutManager/lineFragmentUsedRect(forGlyphAt:effectiveRange:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSLayoutManager(im)lineFragmentUsedRectForGlyphAtIndex:effectiveRange:"
  },
  "title" : "lineFragmentUsedRect(forGlyphAt:effectiveRange:)"
}
-->

# lineFragmentUsedRect(forGlyphAt:effectiveRange:)

Returns the usage rectangle for the line fragment and (optionally) returns the entire range of glyphs in that fragment.

```
func lineFragmentUsedRect(forGlyphAt glyphIndex: Int, effectiveRange effectiveGlyphRange: NSRangePointer?) -> NSRect
```

## Parameters

`glyphIndex`

The glyph for which to return the line fragment used rectangle.

`effectiveGlyphRange`

If not `NULL`, on output, the range for all glyphs in the line fragment.

## Return Value

The used rectangle for the line fragment in which the given glyph is laid out.

## Discussion

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

Line fragment used rectangles are always in container coordinates.

Overriding this method is not recommended. If the line fragment used rectangle needs to be modified, that should be done at the typesetter level or by calling [`setLineFragmentRect(_:forGlyphRange:usedRect:)`](/documentation/AppKit/NSLayoutManager/setLineFragmentRect(_:forGlyphRange:usedRect:)).

---

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)