Pango delete/backspace best practices



Dear list,

I would like to leverage your experience with the Pango API.

I am currently using "pango_layout_move_cursor_visually" to handle arrow-key presses. This establishes the byte index that the cursor should be moved to, visually skipping whole grapheme clusters.

However, I understand that there are more states are required when handling the delete and backspace keys, depending on the text's language.

i.e. it is possible to press a deletion key, and the grapheme cluster be altered, but not reduce the number of grapheme clusters in the string.

Reading the Pango API documentation, this aspect appears to be represented with the "PangoLogAttr.backspace_deletes_character" member variable.

However, unlike "pango_layout_move_cursor_visually", "pango_get_log_attrs" operates below the level of a PangoLayout object, requiring a PangoLanguage* to be passed.

Must I manually store the language that a block of text is written in and convert this to a PangoLanguage object?

What is the best practice when handling a delete/backspace key press?

Cheers,

Jeff.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]