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

# glyphRange(for:)

Returns the range of glyphs lying within the specified text container.

```
func glyphRange(for container: NSTextContainer) -> NSRange
```

## Discussion

This is a less efficient method than the similar [`textContainer(forGlyphAt:effectiveRange:)`](/documentation/AppKit/NSLayoutManager/textContainer(forGlyphAt:effectiveRange:)).

Performs glyph generation and layout if needed.

---

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)