[pango/x-to-index-full: 2/2] layout: Use pango_glyph_string_x_to_index_full
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/x-to-index-full: 2/2] layout: Use pango_glyph_string_x_to_index_full
- Date: Mon, 30 Aug 2021 04:11:33 +0000 (UTC)
commit 0fe04e52998cc7328f8f981a3d366e6d6540f8fb
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Aug 28 19:22:05 2021 -0400
layout: Use pango_glyph_string_x_to_index_full
pango/pango-layout.c | 18 +++++++++++++-----
1 file 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]