summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2009-12-25 16:00:11 +0100
committerBehdad Esfahbod <behdad@behdad.org>2009-12-25 19:22:18 +0100
commit2cd9c4b416cbe55dd68106003f360e861a6722be (patch)
tree6dfef1c763e0b45371d1f79e1c9fbb246e752452
parentdded011854cf721ca80587e3f7587d2af31a859d (diff)
downloadpango-2cd9c4b416cbe55dd68106003f360e861a6722be.tar.gz
Zero the space at the end of line when breaking lines
Previously we were not zeroing the final space in the line when breaking lines and were doing that only after lines were broken. This was broken since setting layout width to its own logical width (under width=-1) could result in differently broken lines. That's fixed now. Problem originally reported on gtk-list on 2009-12-22 by Ben Pfaff.
-rw-r--r--pango/pango-layout.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 42de439b..df8207c3 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -3307,6 +3307,16 @@ process_item (PangoLayout *layout,
width += state->log_widths[state->log_widths_offset + num_chars];
}
+ /* If there's a space at the end of the line, include that also.
+ * The logic here should match zero_line_final_space().
+ * XXX Currently it doesn't quite match the logic there. We don't check
+ * the cluster here. But should be fine in practice. */
+ if (break_num_chars > 0 && break_num_chars < item->num_chars &&
+ 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 (layout->wrap == PANGO_WRAP_WORD_CHAR && force_fit && break_width > state->remaining_width && !retrying_with_char_breaks)
{
retrying_with_char_breaks = TRUE;