x_to_index
Description:
public void x_to_index (string text, int length, Analysis analysis, int x_pos, out int index_, out int trailing)
Convert from x offset to character position.
Character positions are computed by dividing up each cluster into equal portions. In scripts where positioning within a cluster is not allowed (such as Thai), the returned value may not be a valid cursor position; the caller must combine the result with the logical attributes for the text to compute the valid cursor position.
Parameters:
| this |
the glyphs returned from [func@shape] |
| text |
the text for the run |
| length |
the number of bytes (not characters) in text. |
| analysis |
the analysis information return from [func@itemize] |
| x_pos |
the x offset (in Pango units) |
| index_ |
location to store calculated byte index within |
| trailing |
location to store a boolean indicating whether the user clicked on the leading or trailing edge of the character |