Package: pango

Function pango-layout-xy-to-index

Lambda List

pango-layout-xy-to-index (layout x y)

Arguments

layout -- a pango-layout object
x -- the integer y offset (in Pango units) from the left edge of the layout
y -- the integer y offset (in Pango units) from the top edge of the layout

Return Value

index -- an integer with the calculated byte index
trailing -- 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 trailing edge of the grapheme
true -- if the coordinates were inside text, false otherwise

Details

Converts from x and y position within a layout to the byte index to the character at that logical position. If the y position is not inside the layout, the closest position is chosen (the position will be clamped inside the layout). If the x position is not within the layout, then the start or the end of the line is chosen as described for the function pango-layout-x-to-index. If either the x or y positions were not inside the layout, then the function returns false; on an exact hit, it returns true.
 

See also

2021-1-15