diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-08-28 19:22:05 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-08-30 00:03:44 -0400 |
commit | 0fe04e52998cc7328f8f981a3d366e6d6540f8fb (patch) | |
tree | 83a067c68a51c69c7c6bdaa4c0cda467760148d5 | |
parent | a89d6ab2716e1801647f3807c13fe5b9e20c21dc (diff) | |
download | pango-x-to-index-full.tar.gz |
layout: Use pango_glyph_string_x_to_index_fullx-to-index-full
-rw-r--r-- | pango/pango-layout.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c index d3d93e60..b2fd5f97 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -4869,12 +4869,20 @@ pango_layout_line_x_to_index (PangoLayoutLine *line, int grapheme_end_offset; int pos; int char_index; + int attr_offset; - pango_glyph_string_x_to_index (run->glyphs, - layout->text + run->item->offset, run->item->length, - &run->item->analysis, - x_pos - start_pos, - &pos, &char_trailing); + /* Note: we simply assert here, since our items are all internally + * created. If that ever changes, we need to add a fallback here. + */ + g_assert (run->item->analysis.flags & PANGO_ANALYSIS_FLAG_HAS_CHAR_OFFSET); + attr_offset = ((PangoItemPrivate *)run->item)->char_offset; + + pango_glyph_string_x_to_index_full (run->glyphs, + layout->text + run->item->offset, run->item->length, + &run->item->analysis, + layout->log_attrs + attr_offset, + x_pos - start_pos, + &pos, &char_trailing); char_index = run->item->offset + pos; |