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

# cgGlyph(at:isValidIndex:)

Returns the glyph at the specified index along with information about whether the glyph index is valid.

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

## Parameters

`glyphIndex`

The index of the glyph that you want.

`isValidIndex`

An optional Boolean variable. On return, the variable is set to <doc://com.apple.documentation/documentation/Swift/true> if the glyph index is valid or <doc://com.apple.documentation/documentation/Swift/false> if it is not.

## Return Value

The glyph at the specified index or <doc://com.apple.documentation/documentation/CoreGraphics/kCGFontIndexInvalid> if the index is out of range.

## Discussion

If noncontiguous layout is disabled, calling this method generates all glyphs up to and including the one at `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)