Returns the index of the glyph falling under the given point, expressed in the given container's coordinate system.
- iOS 7.0+
- macOS 10.0+
- tvOS 9.0+
The point for which to return the glyph, in coordinates of
The container in which the returned glyph is laid out.
NULL, on output, the fraction of the distance between the location of the glyph returned and the location of the next glyph.
The index of the glyph falling under the given point, expressed in the given container's coordinate system.
If no glyph is under
point, the nearest glyph is returned, where nearest is defined according to the requirements of selection by mouse. Clients who wish to determine whether the the point actually lies within the bounds of the glyph returned should follow this with a call to
bounding and test whether the point falls in the rectangle returned by that method. If
partial is non-NULL, it returns by reference the fraction of the distance between the location of the glyph returned and the location of the next glyph.
For purposes such as dragging out a selection or placing the insertion point, a partial percentage less than or equal to 0.5 indicates that
point should be considered as falling before the glyph index returned; a partial percentage greater than 0.5 indicates that it should be considered as falling after the glyph index returned. If the nearest glyph doesn’t lie under
point at all (for example, if
point is beyond the beginning or end of a line), this ratio is 0 or 1.
If the glyph stream contains the glyphs “A” and “b”, with the width of “A” being 13 points, and the user clicks at a location 8 points into “A”,
partial is 8/13, or 0.615. In this case, the point given should be considered as falling between “A” and “b” for purposes such as dragging out a selection or placing the insertion point.
Performs glyph generation and layout if needed.