Contents

glyphIndexForCharacter(at:)

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

Declaration

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

See Also

Accessing glyphs