Returns the fraction of the distance from the left side of the character to the right side that a given point lies.
- macOS 10.5+
The point to test.
The fraction of the distance
a is through the glyph in which it lies. May be 0 or 1 if
a is not within the bounding rectangle of a glyph (0 if the point is to the left or above the glyph; 1 if it's to the right or below).
Implementation of this method is optional. This allows caller to perform precise selection handling.
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
a should be considered as falling before the glyph; a partial percentage greater than 0.5 indicates that it should be considered as falling after the glyph. If the nearest glyph doesn’t lie under
a at all (for example, if
a is beyond the beginning or end of a line), this ratio is 0 or 1.
For example, if the glyph stream contains the glyphs “A” and “b”, with the width of “A” being 13 points, and
a is 8 points from the left side of “A”, then the fraction of the distance is 8/13, or 0.615. In this case, the
a should be considered as falling between “A” and “b” for purposes such as dragging out a selection or placing the insertion point.