characterIndexForGlyph(at:)
Returns the index in the text storage for the first character of the specified glyph.
Declaration
func characterIndexForGlyph(at glyphIndex: Int) -> IntParameters
- glyphIndex:
The index of the glyph for which to return the associated character.
Return Value
The index of the first character associated with the glyph at the specified index.
Discussion
If noncontiguous layout is not enabled, this method causes generation of all glyphs up to and including glyphIndex. This method accepts an index beyond the last glyph, returning an index extrapolated from the last actual glyph 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.