Pango.Layout.xy_to_index
Description: Reference for Pango.Layout.xy_to_index

### Method

# Pango.Layout.xy_to_index

#### Declaration [src]

    gboolean
    pango_layout_xy_to_index (
      PangoLayout* layout,
      int x,
      int y,
      int* index_,
      int* trailing
    )

#### Description [src]

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 `pango_layout_line_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`.

#### Parameters

`x` | `int`
| the X offset (in Pango units) from the left edge of the layout.
`y` | `int`
| the Y offset (in Pango units) from the top edge of the layout
`index_` | `int*`
| location to store calculated byte index
| Direction: out
| Ownership of the data is transferred to the callee
`trailing` | `int*`
| location to store a 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.
| Direction: out
| Ownership of the data is transferred to the callee

#### Return value

Returns: `gboolean`
`TRUE` if the coordinates were inside text, `FALSE` otherwise.