diff options
-rw-r--r-- | pango/pango-layout.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c index 821f767c..b605ded5 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -3752,7 +3752,11 @@ find_break_extra_width (PangoLayout *layout, ParaBreakState *state, int pos) { - /* Check whether to insert a hyphen */ + /* Check whether to insert a hyphen, + * or whether we are breaking after one of those + * characters that turn into a hyphen, + * or after a space. + */ if (layout->log_attrs[state->start_offset + pos].break_inserts_hyphen) { ensure_hyphen_width (state); @@ -3762,6 +3766,11 @@ find_break_extra_width (PangoLayout *layout, else return state->hyphen_width; } + else if (state->start_offset + pos > 0 && + layout->log_attrs[state->start_offset + pos - 1].is_white) + { + return - state->log_widths[state->log_widths_offset + pos - 1]; + } return 0; } @@ -3977,6 +3986,11 @@ process_item (PangoLayout *layout, insert_run (line, state, new_item, FALSE); break_width = pango_glyph_string_get_width (((PangoGlyphItem *)(line->runs->data))->glyphs); + + if (state->start_offset + break_num_chars > 0 && + layout->log_attrs[state->start_offset + break_num_chars - 1].is_white) + break_width -= state->log_widths[state->log_widths_offset + break_num_chars - 1]; + if (break_width > state->remaining_width && !break_disabled[break_num_chars] && break_num_chars > 1) |