summaryrefslogtreecommitdiff
path: root/pango/pango-layout.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2008-01-08 22:55:14 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2008-01-08 22:55:14 +0000
commit7f7dbc1ecc87f11c03aea4a37e2011af3dd9b308 (patch)
treed6665d38e9e2e05d6d6954d04b530f107eb03e40 /pango/pango-layout.c
parentca4707911136cc7e951a83e7ae907524ab352662 (diff)
downloadpango-7f7dbc1ecc87f11c03aea4a37e2011af3dd9b308.tar.gz
Ignore indent if aligned center, and document so. This assumption was
2008-01-08 Behdad Esfahbod <behdad@gnome.org> * 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=/trunk/; revision=2538
Diffstat (limited to 'pango/pango-layout.c')
-rw-r--r--pango/pango-layout.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index dd1ce5bd..df4772af 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,
@@ -3314,10 +3317,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)