---
title: "lineFragmentRect(forGlyphAt:effectiveRange:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/nslayoutmanager/linefragmentrect(forglyphat:effectiverange:)"
---

# lineFragmentRect(forGlyphAt:effectiveRange:)

Returns the rectangle for the line fragment where the glyph lies and (optionally), by reference, the entire range of glyphs in that fragment.

## Declaration

```swift
func lineFragmentRect(forGlyphAt glyphIndex: Int, effectiveRange effectiveGlyphRange: NSRangePointer?) -> CGRect
```

## 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.

## Return Value

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

## Discussion

Discussion This method causes glyph generation and layout for the line fragment containing the specified glyph, 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. 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:).

## See Also

### Related Documentation

- [setLineFragmentRect(_:forGlyphRange:usedRect:)](uikit/nslayoutmanager/setlinefragmentrect(_:forglyphrange:usedrect:).md)

### Getting layout information

- [attachmentSize(forGlyphAt:)](uikit/nslayoutmanager/attachmentsize(forglyphat:).md)
- [drawsOutsideLineFragment(forGlyphAt:)](uikit/nslayoutmanager/drawsoutsidelinefragment(forglyphat:).md)
- [extraLineFragmentRect](uikit/nslayoutmanager/extralinefragmentrect.md)
- [extraLineFragmentTextContainer](uikit/nslayoutmanager/extralinefragmenttextcontainer.md)
- [extraLineFragmentUsedRect](uikit/nslayoutmanager/extralinefragmentusedrect.md)
- [firstUnlaidCharacterIndex()](uikit/nslayoutmanager/firstunlaidcharacterindex().md)
- [firstUnlaidGlyphIndex()](uikit/nslayoutmanager/firstunlaidglyphindex().md)
- [getFirstUnlaidCharacterIndex(_:glyphIndex:)](uikit/nslayoutmanager/getfirstunlaidcharacterindex(_:glyphindex:).md)
- [lineFragmentRect(forGlyphAt:effectiveRange:withoutAdditionalLayout:)](uikit/nslayoutmanager/linefragmentrect(forglyphat:effectiverange:withoutadditionallayout:).md)
- [lineFragmentUsedRect(forGlyphAt:effectiveRange:)](uikit/nslayoutmanager/linefragmentusedrect(forglyphat:effectiverange:).md)
- [lineFragmentUsedRect(forGlyphAt:effectiveRange:withoutAdditionalLayout:)](uikit/nslayoutmanager/linefragmentusedrect(forglyphat:effectiverange:withoutadditionallayout:).md)
- [location(forGlyphAt:)](uikit/nslayoutmanager/location(forglyphat:).md)
- [notShownAttribute(forGlyphAt:)](uikit/nslayoutmanager/notshownattribute(forglyphat:).md)
- [truncatedGlyphRange(inLineFragmentForGlyphAt:)](uikit/nslayoutmanager/truncatedglyphrange(inlinefragmentforglyphat:).md)
