UI module

index_at_x

procedure · 1 overloadsince 0.31.0Source

The byte offset in string_to_measure of the grapheme boundary nearest to horizontal position x.

index_at_x :: (
    text: *Text_System,
    string_to_measure: string,
    style: Text_Style,
    x: float
) -> int

The byte offset in string_to_measure of the grapheme boundary nearest to horizontal position x.

Parameters

text: *Text_System
the text system holding the fonts.
string_to_measure: string
the UTF-8 text.
style: Text_Style
the font and size the text is drawn with.
x: float
the position in points from the start of the text. Zero or less gives 0.

Returns

int

See also