summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-11-10 17:20:13 -0500
committerMatthias Clasen <mclasen@redhat.com>2021-11-10 19:39:12 -0500
commitc03ca7de6c6001251684f7a3a071b38b3d35317e (patch)
tree5e247a1eb3ea4b45cb7ad144f66eba4433f27d85
parentffdc738e9057b9202dc889dd87829dcd90f4d87a (diff)
downloadpango-c03ca7de6c6001251684f7a3a071b38b3d35317e.tar.gz
layout: Fix a poblem with hyphen width
In some cases, we were forgetting to account for the width of a hyphen.
-rw-r--r--pango/pango-layout.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 9e8ce248..1a460d4c 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -3792,7 +3792,8 @@ find_break_extra_width (PangoLayout *layout,
#if 0
# define DEBUG debug
-void
+static int pango_layout_line_get_width (PangoLayoutLine *line);
+static void
debug (const char *where, PangoLayoutLine *line, ParaBreakState *state)
{
int line_width = pango_layout_line_get_width (line);
@@ -3919,10 +3920,10 @@ process_item (PangoLayout *layout,
extra_width = 0;
for (num_chars = 0; num_chars < item->num_chars; num_chars++)
{
+ extra_width = find_break_extra_width (layout, state, num_chars);
+
if (width + extra_width > state->remaining_width && break_num_chars < item->num_chars)
- {
- break;
- }
+ break;
/* If there are no previous runs we have to take care to grab at least one char. */
if (can_break_at (layout, state->start_offset + num_chars, retrying_with_char_breaks) &&
@@ -3931,11 +3932,7 @@ process_item (PangoLayout *layout,
break_num_chars = num_chars;
break_width = width;
break_extra_width = extra_width;
-
- extra_width = find_break_extra_width (layout, state, num_chars);
}
- else
- extra_width = 0;
width += state->log_widths[state->log_widths_offset + num_chars];
}