pango r2540 - in branches/pango-1-18: . pango



Author: behdad
Date: Wed Jan  9 22:12:59 2008
New Revision: 2540
URL: http://svn.gnome.org/viewvc/pango?rev=2540&view=rev

Log:
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.



Modified:
   branches/pango-1-18/ChangeLog
   branches/pango-1-18/pango/pango-layout.c

Modified: branches/pango-1-18/pango/pango-layout.c
==============================================================================
--- branches/pango-1-18/pango/pango-layout.c	(original)
+++ branches/pango-1-18/pango/pango-layout.c	Wed Jan  9 22:12:59 2008
@@ -451,6 +451,9 @@
  * 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,
@@ -3315,10 +3318,18 @@
 
   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)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]