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

# glyphIndexForCharacter(at:)

Returns the index of the first glyph of the character at the specified index.

```
func glyphIndexForCharacter(at charIndex: Int) -> Int
```

## Parameters

`charIndex`

The index of the character for which to return the associated glyph.

## Return Value

The index of the first glyph associated with the character at the specified index.

## Discussion

If noncontiguous layout is not enabled, this method causes generation of all glyphs up to and including those associated with the specified character. This method accepts an index beyond the last character, returning an index extrapolated from the last actual character index.

In many cases it’s better to use the range-mapping methods, [`characterRange(forGlyphRange:actualGlyphRange:)`](/documentation/AppKit/NSLayoutManager/characterRange(forGlyphRange:actualGlyphRange:)) and [`glyphRange(forCharacterRange:actualCharacterRange:)`](/documentation/AppKit/NSLayoutManager/glyphRange(forCharacterRange:actualCharacterRange:)), which provide more comprehensive information.

---

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)