Commit 3a566950 authored by Matthias Clasen's avatar Matthias Clasen
Browse files

Fix line-break accounting more

When looking for breakpoints, we were assuming that
there is no point to keep looking forward once we
hit a spot where the broken off part is too long.

But with hyphen insertion, that is no longer true,
necessarily. Consider 'bli '. Breaking after 'bl'
will insert 'bl-', which might be longer than
'bli', which is what will be inserted when we
break after the i.

To fix this, keep looking for breakpoints as long
as there is still a chance to find one.
parent cadc688f
......@@ -3951,16 +3951,22 @@ process_item (PangoLayout *layout,
{
extra_width = find_break_extra_width (layout, state, num_chars);
if (width + extra_width > state->remaining_width && break_num_chars < item->num_chars)
break;
if (MIN (width + extra_width, width) > state->remaining_width && break_num_chars < item->num_chars)
{
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) &&
(num_chars > 0 || line->runs))
{
break_num_chars = num_chars;
break_width = width;
break_extra_width = extra_width;
if (width + extra_width <= state->remaining_width ||
break_num_chars >= last_break_char)
{
break_num_chars = num_chars;
break_width = width;
break_extra_width = extra_width;
}
}
width += state->log_widths[state->log_widths_offset + num_chars];
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment