### Method

# Pango GlyphString x_to_index

#### Declaration [src]

    void
    pango_glyph_string_x_to_index (
      PangoGlyphString* glyphs,
      const char* text,
      int length,
      PangoAnalysis* analysis,
      int x_pos,
      int* index_,
      int* trailing
    )

#### Description [src]

Convert from x offset to character position.

Character positions are computed by dividing up each cluster into equal portions. In scripts where positioning within a cluster is not allowed (such as Thai), the returned value may not be a valid cursor position; the caller must combine the result with the logical attributes for the text to compute the valid cursor position.

#### Parameters

`text`

  Type: `const char*`

  The text for the run.

  The data is owned by the caller of the method.
  The value is a NUL terminated UTF-8 string.

`length`

  Type: `int`

  The number of bytes (not characters) in text.

`analysis`

  Type: `PangoAnalysis`

  The analysis information return from `pango_itemize()`.

  The data is owned by the caller of the method.

`x_pos`

  Type: `int`

  The x offset (in Pango units).

`index_`

  Type: `int*`

  Location to store calculated byte index within `text`.

  The argument will be set by the function.
  The argument can be `NULL`.

`trailing`

  Type: `int*`

  Location to store a boolean indicating whether the user clicked on the leading or trailing edge of the character.

  The argument will be set by the function.
  The argument can be `NULL`.