Instance Method

locationForGlyphAtIndex:

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

Declaration

iOS, Mac Catalyst, tvOS
- (CGPoint)locationForGlyphAtIndex:(NSUInteger)glyphIndex;
macOS
- (NSPoint)locationForGlyphAtIndex:(NSUInteger)glyphIndex;

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

- attachmentSizeForGlyphAtIndex:

Returns the size of the attachment glyph at the specified index.

- drawsOutsideLineFragmentForGlyphAtIndex:

Indicates whether the glyph draws outside of its line fragment rectangle.

extraLineFragmentRect

The rectangle for the extra line fragment at the end of a document.

extraLineFragmentTextContainer

The text container that contains the extra line fragment rectangle.

extraLineFragmentUsedRect

The rectangle enclosing the insertion point drawn in the extra line fragment rectangle.

- firstUnlaidCharacterIndex

The index for the first character in the layout manager that has not been laid out.

- firstUnlaidGlyphIndex

The index for the first glyph in the layout manager that has not been laid out.

- getFirstUnlaidCharacterIndex:glyphIndex:

Returns the indexes for the first character and glyph that have invalid layout information.

- lineFragmentRectForGlyphAtIndex:effectiveRange:

Returns the rectangle for the line fragment in which the glyph is laid out and (optionally), by reference, the whole range of glyphs in that fragment.

- lineFragmentRectForGlyphAtIndex:effectiveRange:withoutAdditionalLayout:

Returns the line fragment rectangle containing the glyph at the given glyph index.

- lineFragmentUsedRectForGlyphAtIndex:effectiveRange:

Returns the usage rectangle for the line fragment and (optionally) returns the whole range of glyphs in that fragment.

- lineFragmentUsedRectForGlyphAtIndex:effectiveRange:withoutAdditionalLayout:

Returns the usage rectangle for the line fragment and (optionally) returns the whole range of glyphs that are in that fragment.

- notShownAttributeForGlyphAtIndex:

Indicates whether the glyph at the specified index has a visible representation.

- truncatedGlyphRangeInLineFragmentForGlyphAtIndex:

Returns the range of truncated glyphs for a line fragment containing the specified index.