[pango/line-breaking-fixes2] More tweaks, and comments
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/line-breaking-fixes2] More tweaks, and comments
- Date: Mon, 15 Nov 2021 03:57:35 +0000 (UTC)
commit 261c4faf04e2142e17b2e2a40766ca1f87a9231b
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Nov 14 22:46:03 2021 -0500
More tweaks, and comments
pango/pango-layout.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index f0795a62..3a4b7818 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -3956,15 +3956,16 @@ process_item (PangoLayout *layout,
/* We don't want to walk the entire item if we can help it, but
* we need to keep going at least until we've found a breakpoint
- * that 'works' (as in, doesn't overflow the budget we have),
- * and there is no hope of finding a better one.
+ * that 'works' (as in, it doesn't overflow the budget we have,
+ * or there is no hope of finding a better one).
*
* We rely on the fact that MIN(width + extra_width, width) is
* monotonically increasing.
*/
if (MIN (width + extra_width, width) > state->remaining_width &&
- break_width + break_extra_width <= state->remaining_width &&
- break_num_chars < item->num_chars)
+ break_num_chars < item->num_chars &&
+ (break_width + break_extra_width <= state->remaining_width ||
+ MIN (width + extra_width, width) > break_width + break_extra_width))
{
break;
}
@@ -4042,16 +4043,16 @@ process_item (PangoLayout *layout,
if (break_width > state->remaining_width &&
!break_disabled[break_num_chars])
{
- /* Unsplit the item, disable the breakpoint, try again */
-
+ /* Unsplit the item, disable the breakpoint, try find a better one.
+ *
+ * If we can't find a different breakpoint that works better, we'll
+ * end up here again, with break_disabled being set, and take the break
+ */
uninsert_run (line);
pango_item_free (new_item);
pango_item_unsplit (item, length, break_num_chars);
break_disabled[break_num_chars] = TRUE;
- width = orig_width;
- break_width = width;
- break_num_chars = item->num_chars;
goto retry_break;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]