summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2008-03-21 09:27:19 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2008-03-21 09:27:19 +0000
commit6758d48c8283896856f3af3d545b6b836078078b (patch)
tree24ac7df5387d9ae77464a5be8c47c051bb6edf84
parent15af7e09d1a72384b309ffef0da1fc08383e702f (diff)
downloadpango-6758d48c8283896856f3af3d545b6b836078078b.tar.gz
When doing ALIGN_CENTER, round line offset to whole pixel if hinting.
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
-rw-r--r--ChangeLog5
-rw-r--r--pango/pango-layout.c9
2 files changed, 12 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 57ccf982..906c9334 100644
--- 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):
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 137ebabd..af816689 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -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 */