index_to_x


Description:

public void index_to_x (string text, int length, Analysis analysis, int index_, bool trailing, out int x_pos)

Converts from character position to x position.

The X position is measured from the left edge of the run. Character positions are obtained using font metrics for ligatures where available, and computed by dividing up each cluster into equal portions, otherwise.

<picture> <source srcset="glyphstring-positions-dark.png" media="(prefers-color-scheme: dark)"> <img alt="Glyph positions" src="glyphstring-positions-light.png"> </picture>

Parameters:

this

the glyphs return 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]

index_

the byte index within text

trailing

whether we should compute the result for the beginning (false) or end (true ) of the character.

x_pos

location to store result