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

# lineFragmentRect(forGlyphAt:effectiveRange:withoutAdditionalLayout:)

Returns the line fragment rectangle that contains the glyph at the specified glyph index.

```
func lineFragmentRect(forGlyphAt glyphIndex: Int, effectiveRange effectiveGlyphRange: NSRangePointer?, withoutAdditionalLayout flag: Bool) -> NSRect
```

## Parameters

`glyphIndex`

The glyph for which to return the line fragment rectangle.

`effectiveGlyphRange`

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

`flag`

If <doc://com.apple.documentation/documentation/Swift/true>, glyph generation and layout are not performed, so this option should not be used unless layout is known to be complete for the range in question, or unless noncontiguous layout is enabled; if <doc://com.apple.documentation/documentation/Swift/false>, both are performed as needed.

## Return Value

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

## Discussion

This method is primarily for use from within `NSTypesetter`, after layout is complete for the range in question, but before the layout manager’s call to `NSTypesetter` has returned. In that case glyph and layout holes have not yet been recalculated, so the layout manager does not yet know that layout is complete for that range, and this variant must be used.

Overriding this method is not recommended. If the line fragment 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)