Method

PangoLayoutLinex_to_index

Declaration [src]

gboolean
pango_layout_line_x_to_index (
  PangoLayoutLine* line,
  int x_pos,
  int* index_,
  int* trailing
)

Description [src]

Converts from x offset to the byte index of the corresponding character within the text of the layout.

If x_pos is outside the line, index_ and trailing will point to the very first or very last position in the line. This determination is based on the resolved direction of the paragraph; for example, if the resolved direction is right-to-left, then an X position to the right of the line (after it) results in 0 being stored in index_ and trailing. An X position to the left of the line results in index_ pointing to the (logical) last grapheme in the line and trailing being set to the number of characters in that grapheme. The reverse is true for a left-to-right line.

Parameters

x_pos int
 

The X offset (in Pango units) from the left edge of the line.

index_ int*
 

Location to store calculated byte index for the grapheme in which the user clicked.

 The argument will be set by the function.
trailing int*
 

Location to store an integer indicating where in the grapheme the user clicked. It will either be zero, or the number of characters in the grapheme. 0 represents the leading edge of the grapheme.

 The argument will be set by the function.

Return value

Returns: gboolean
 

FALSE if x_pos was outside the line, TRUE if inside.