Instance Method


Sets the location for the first glyph of the given range.


iOS, Mac Catalyst, tvOS
- (void)setLocation:(CGPoint)location forStartOfGlyphRange:(NSRange)glyphRange;
- (void)setLocation:(NSPoint)location forStartOfGlyphRange:(NSRange)glyphRange;



The location to which the first glyph is set, relative to the origin of the glyph’s line fragment origin.


The glyphs whose location is set.


Setting the location for a glyph range implies that its first glyph is not nominally spaced with respect to the previous glyph. In the course of layout, all glyphs should end up being included in a range passed to this method, but only glyphs that start a new nominal range should be at the start of such ranges. The first glyph in a line fragment should always start a new nominal range. Glyph locations are given relative to their line fragment rectangle's origin.

Before setting the location for a glyph range, you must specify the text container with setTextContainer:forGlyphRange: and the line fragment rectangle with setLineFragmentRect:forGlyphRange:usedRect:.

This method is used by the layout mechanism and should be invoked only during typesetting, in almost all cases only by the typesetter. For example, a custom typesetter might invoke it.

See Also

Setting Layout Information

- setAttachmentSize:forGlyphRange:

Sets the size at which the given glyph (assumed to be an attachment) is asked to draw in the given glyph range.

- setDrawsOutsideLineFragment:forGlyphAtIndex:

Specifies whether the given glyph exceeds the bounds of the line fragment where it’s laid out.

- setExtraLineFragmentRect:usedRect:textContainer:

Sets the bounds and container for the extra line fragment.

- setLineFragmentRect:forGlyphRange:usedRect:

Associates the given line fragment bounds with the given range of glyphs.

- setNotShownAttribute:forGlyphAtIndex:

Sets the glyph at the given index to be one that isn’t shown.