---
title: "layoutRect(for:glyphRange:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nslayoutmanager/layoutrect(for:glyphrange:)"
---

# layoutRect(for:glyphRange:)

Returns the rectangle for the layout of the specified text block and glyph range.

## Declaration

```swift
func layoutRect(for block: NSTextBlock, glyphRange: NSRange) -> NSRect
```

## Return Value

Return Value The layout rectangle, or NSZeroRect if no rectangle has been set for the specified block since the last invalidation.

## Discussion

Discussion This method causes glyph generation but not layout. Block layout rectangles and bounds rectangles are always in container coordinates.

## See Also

### Handling layout for text blocks

- [setLayoutRect(_:for:glyphRange:)](appkit/nslayoutmanager/setlayoutrect(_:for:glyphrange:).md)
- [setBoundsRect(_:for:glyphRange:)](appkit/nslayoutmanager/setboundsrect(_:for:glyphrange:).md)
- [boundsRect(for:glyphRange:)](appkit/nslayoutmanager/boundsrect(for:glyphrange:).md)
- [layoutRect(for:at:effectiveRange:)](appkit/nslayoutmanager/layoutrect(for:at:effectiverange:).md)
- [boundsRect(for:at:effectiveRange:)](appkit/nslayoutmanager/boundsrect(for:at:effectiverange:).md)
