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

# glyph(at:isValidIndex:)

Returns the glyph at a specified index, and optionally returns a flag indicating whether the requested index is valid.

```
func glyph(at glyphIndex: Int, isValidIndex: UnsafeMutablePointer<ObjCBool>?) -> NSGlyph
```

## Parameters

`glyphIndex`

The index of the glyph to be returned.

`isValidIndex`

If not `NULL`, on output, <doc://com.apple.documentation/documentation/Swift/true> if the requested index is in range; otherwise <doc://com.apple.documentation/documentation/Swift/false>.

## Return Value

The glyph at the requested index, or `NSNullGlyph` if the requested index is out of the range `{0,` ``NSLayoutManager/numberOfGlyphs```}`.

## Discussion

If noncontiguous layout is not enabled, this method causes generation of all glyphs up to and including `glyphIndex`.

---

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)