Contents

location(forGlyphAt:)

Returns the location for the specified glyph within its line fragment.

Declaration

func location(forGlyphAt glyphIndex: Int) -> CGPoint

Parameters

  • glyphIndex:

    The glyph whose location is returned.

Return Value

The location of the given glyph.

Discussion

If the given glyph does not have an explicit location set for it (for example, if it is part of (but not first in) a sequence of nominally spaced characters), the location is calculated by glyph advancements from the location of the most recent preceding glyph with a location set.

Glyph locations are relative to their line fragment rectangle’s origin. The line fragment rectangle in turn is defined in the coordinate system of the text container where it resides.

This method causes glyph generation and layout for the line fragment containing the specified glyph, or if noncontiguous layout is not enabled, up to and including that line fragment.

See Also

Getting layout information