GNOME Bugzilla – Bug 135843
Getting the resolved direction out of a PangoLayout
Last modified: 2018-05-22 12:05:08 UTC
Had to write: static PangoDirection get_cursor_direction (GtkLabel *label) { PangoDirection last_direction; GSList *lines; g_assert (label->select_info); gtk_label_ensure_layout (label); for (l = pango_layout_get_lines (label->layout);; l; l = l->next) { PangoLayoutLine *line = l->data; /* If label->select_info->selection_end is at the very end of * the line, we don't know if the cursor is on this line or * the next without looking ahead at the next line. (End * of paragraph is different from line break.) But it's * definitely in this paragraph, which is good enough * to figure out the resolved direction. */ if (line->start_index + line->length >= label->select_info->selection_end) return line->resolved_dir; } return PANGO_DIRECTION_LTR; } Should be in Pango.
*** This bug has been marked as a duplicate of 326693 ***
So, the api for this should probably text an index into the text and return the par dir for that position.
Anyone willing to cook a patch? :)
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/pango/issues/14.