[pango] Zero the space at the end of line when breaking lines
- From: Behdad Esfahbod <behdad src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [pango] Zero the space at the end of line when breaking lines
- Date: Fri, 25 Dec 2009 18:23:26 +0000 (UTC)
commit 2cd9c4b416cbe55dd68106003f360e861a6722be
Author: Behdad Esfahbod <behdad behdad org>
Date: Fri Dec 25 16:00:11 2009 +0100
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.
pango/pango-layout.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 42de439..df8207c 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]