When doing ALIGN_CENTER, round line offset to whole pixel if hinting.
authorBehdad Esfahbod <behdad@gnome.org>
Fri, 21 Mar 2008 09:27:19 +0000 (09:27 +0000)
committerBehdad Esfahbod <behdad@src.gnome.org>
Fri, 21 Mar 2008 09:27:19 +0000 (09:27 +0000)
2008-03-21  Behdad Esfahbod  <behdad@gnome.org>

        * pango/pango-layout.c (get_x_offset): When doing ALIGN_CENTER,
        round line offset to whole pixel if hinting.

svn path=/trunk/; revision=2584

ChangeLog
pango/pango-layout.c

index 57ccf98..906c933 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-03-21  Behdad Esfahbod  <behdad@gnome.org>
+
+       * pango/pango-layout.c (get_x_offset): When doing ALIGN_CENTER,
+       round line offset to whole pixel if hinting.
+
 2008-03-11  Richard Hult  <richard@imendio.com>
 
        * pango/pangocairo-atsuifont.c (_pango_cairo_atsui_font_new):
index 137ebab..af81668 100644 (file)
@@ -2297,9 +2297,14 @@ get_x_offset (PangoLayout     *layout,
     *x_offset = 0;
   else if (alignment == PANGO_ALIGN_RIGHT)
     *x_offset = layout_width - line_width;
-  else if (alignment == PANGO_ALIGN_CENTER)
+  else if (alignment == PANGO_ALIGN_CENTER) {
     *x_offset = (layout_width - line_width) / 2;
-  else
+    /* hinting */
+    if (((layout_width | line_width) & (PANGO_SCALE - 1)) == 0)
+      {
+       *x_offset = PANGO_UNITS_ROUND (*x_offset);
+      }
+  } else
     *x_offset = 0;
 
   /* Indentation */