---
title: "glyphIndexForCharacter(at:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/nslayoutmanager/glyphindexforcharacter(at:)"
---

# glyphIndexForCharacter(at:)

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

## Declaration

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

## Parameters

- `charIndex`: The index of the character for which to return the associated glyph.

## Return Value

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

## Discussion

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:) and glyphRange(forCharacterRange:actualCharacterRange:), which provide more comprehensive information.

## See Also

### Accessing glyphs

- [getGlyphs(in:glyphs:properties:characterIndexes:bidiLevels:)](uikit/nslayoutmanager/getglyphs(in:glyphs:properties:characterindexes:bidilevels:).md)
- [cgGlyph(at:)](uikit/nslayoutmanager/cgglyph(at:).md)
- [cgGlyph(at:isValidIndex:)](uikit/nslayoutmanager/cgglyph(at:isvalidindex:).md)
- [setGlyphs(_:properties:characterIndexes:font:forGlyphRange:)](uikit/nslayoutmanager/setglyphs(_:properties:characterindexes:font:forglyphrange:).md)
- [characterIndexForGlyph(at:)](uikit/nslayoutmanager/characterindexforglyph(at:).md)
- [isValidGlyphIndex(_:)](uikit/nslayoutmanager/isvalidglyphindex(_:).md)
- [numberOfGlyphs](uikit/nslayoutmanager/numberofglyphs.md)
- [propertyForGlyph(at:)](uikit/nslayoutmanager/propertyforglyph(at:).md)
- [NSLayoutManager.GlyphProperty](uikit/nslayoutmanager/glyphproperty.md)
