diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-08-20 01:38:03 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-08-20 02:08:46 -0400 |
commit | ee44512da69e479f4af6c69b6113d6974042e6dc (patch) | |
tree | 910dd69d7e87ace350db3bdd758cbc0c7eece81c /pango/pango-layout.c | |
parent | 7a0bbde18c64f0abb75a5b5aa576ba8af22da3de (diff) | |
download | pango-ee44512da69e479f4af6c69b6113d6974042e6dc.tar.gz |
layout: Fix some end-of-line position
Make pango_layout_index_to_pos report non-empty
rectangles at the end of a line.
Diffstat (limited to 'pango/pango-layout.c')
-rw-r--r-- | pango/pango-layout.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c index ac7eaab0..5ae46f85 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -2394,10 +2394,10 @@ pango_layout_index_to_pos (PangoLayout *layout, if (tmp_line->start_index > index) { - /* index is in the paragraph delim&iters, move to + /* index is in the paragraph delimiters, move to * end of previous line * - * This shouldn’t occur in the first loop &iteration as the first + * This shouldn’t occur in the first loop iteration as the first * line’s start_index should always be 0. */ g_assert (layout_line != NULL); @@ -2409,20 +2409,21 @@ pango_layout_index_to_pos (PangoLayout *layout, layout_line = tmp_line; - if (layout_line->start_index + layout_line->length > index) + if (layout_line->start_index + layout_line->length >= index) { - while (TRUE) + do { PangoLayoutRun *run = _pango_layout_iter_get_run (&iter); pango_layout_iter_get_run_extents (&iter, NULL, &run_logical_rect); - if (run->item->offset <= index && index < run->item->offset + run->item->length) + if (!run) break; - if (!pango_layout_iter_next_run (&iter)) + if (run->item->offset <= index && index < run->item->offset + run->item->length) break; - } + } + while (pango_layout_iter_next_run (&iter)); break; } |