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

# glyph(at:)

Returns the glyph at the specified index.

```
func glyph(at glyphIndex: Int) -> NSGlyph
```

## Parameters

`glyphIndex`

The index of a glyph in the receiver. This value must not exceed the bounds of the receiver’s glyph array.

## Return Value

The glyph at `glyphIndex`.

## Discussion

Raises an `NSRangeException` if `glyphIndex` is out of bounds.

Performs glyph generation if needed. To avoid an exception with [`glyph(at:)`](/documentation/AppKit/NSLayoutManager/glyph(at:)) you must first check the glyph index against the number of glyphs, which requires generating all glyphs. Another method, [`glyph(at:isValidIndex:)`](/documentation/AppKit/NSLayoutManager/glyph(at:isValidIndex:)), generates glyphs only up to the one requested, so using it can be more efficient.

---

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)