diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2008-01-09 22:12:59 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2008-01-09 22:12:59 +0000 |
commit | b4841f4254130bc32cc6a8942ca1bc7b53a84ac6 (patch) | |
tree | a9e5f551bd5d069a1c754459417de1e80ec4cbb9 | |
parent | 19c3b5a5e588a7e6574159be372a464239874132 (diff) | |
download | pango-b4841f4254130bc32cc6a8942ca1bc7b53a84ac6.tar.gz |
Bug 508381 – indent and center alignment don't mix
2008-01-08 Behdad Esfahbod <behdad@gnome.org>
Bug 508381 – indent and center alignment don't mix
* pango/pango-layout.c: Ignore indent if aligned center, and document
so. This assumption was present in some places and not the others.
Fixed now.
svn path=/branches/pango-1-18/; revision=2540
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | pango/pango-layout.c | 21 |
2 files changed, 26 insertions, 3 deletions
@@ -1,3 +1,11 @@ +2008-01-08 Behdad Esfahbod <behdad@gnome.org> + + Bug 508381 – indent and center alignment don't mix + + * pango/pango-layout.c: Ignore indent if aligned center, and document + so. This assumption was present in some places and not the others. + Fixed now. + 2008-01-09 Jürg Billeter <j@bitron.ch> * Makefile.am: Use install -D to install pango.aliases.win32 to diff --git a/pango/pango-layout.c b/pango/pango-layout.c index a002b028..139adf7a 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -451,6 +451,9 @@ pango_layout_is_wrapped (PangoLayout *layout) * of @indent will produce a hanging indentation. That is, the first line will * have the full width, and subsequent lines will be indented by the * absolute value of @indent. + * + * The indent setting is ignored if layout alignment is set to + * %PANGO_ALIGN_CENTER. **/ void pango_layout_set_indent (PangoLayout *layout, @@ -3201,6 +3204,7 @@ process_item (PangoLayout *layout, else { PangoItem *new_item; + int new_break_width; length = g_utf8_offset_to_pointer (layout->text + item->offset, break_num_chars) - (layout->text + item->offset); @@ -3314,10 +3318,18 @@ process_line (PangoLayout *layout, if (layout->ellipsize != PANGO_ELLIPSIZE_NONE) state->remaining_width = -1; - else if (state->first_line) - state->remaining_width = (layout->indent >= 0) ? layout->width - layout->indent : layout->width; else - state->remaining_width = (layout->indent >= 0) ? layout->width : layout->width + layout->indent; + { + state->remaining_width = layout->width; + + if (layout->alignment != PANGO_ALIGN_CENTER) + { + if (state->first_line && layout->indent >= 0) + state->remaining_width -= layout->indent; + else if (!state->first_line && layout->indent < 0) + state->remaining_width += layout->indent; + } + } DEBUG ("starting to fill line", line, state); while (state->items) @@ -4732,6 +4744,7 @@ static void justify_clusters (PangoLayoutLine *line, ParaBreakState *state) { + int offset; int total_remaining_width, total_gaps = 0; int added_so_far, gaps_so_far; gboolean is_hinted; @@ -4757,6 +4770,8 @@ justify_clusters (PangoLayoutLine *line, { PangoLayoutRun *run = run_iter->data; PangoGlyphString *glyphs = run->glyphs; + PangoGlyphItemIter cluster_iter; + gboolean have_cluster; gboolean is_first_gap = TRUE; int i; |