summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2006-04-07 09:12:41 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2006-04-07 09:12:41 +0000
commit7a8abd8d561bcee77502291d4356c0fcd841732d (patch)
treef6d8efc48ee74097467832b682b1d297a648cef6
parent4d00873d62cc47b6c93bb8e3e644c613fecfcfb1 (diff)
downloadpango-7a8abd8d561bcee77502291d4356c0fcd841732d.tar.gz
Incorrect text rendering when in x86 64-bit precision mode
2006-04-07 Behdad Esfahbod <behdad@gnome.org> Incorrect text rendering when in x86 64-bit precision mode https://bugs.freedesktop.org/show_bug.cgi?id=5200 * pango/pangocairo-fcfont.c:Round metrics when converting to Pango units.
-rw-r--r--ChangeLog8
-rw-r--r--pango/pangocairo-fcfont.c21
2 files changed, 22 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index a0c31991..6e95d608 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2006-04-07 Behdad Esfahbod <behdad@gnome.org>
+ Incorrect text rendering when in x86 64-bit precision mode
+ https://bugs.freedesktop.org/show_bug.cgi?id=5200
+
+ * pango/pangocairo-fcfont.c:Round metrics when converting
+ to Pango units.
+
+2006-04-07 Behdad Esfahbod <behdad@gnome.org>
+
* === Released 1.12.1 ===
* configure.in: Version 1.12.1
diff --git a/pango/pangocairo-fcfont.c b/pango/pangocairo-fcfont.c
index 31a91afb..647e5425 100644
--- a/pango/pangocairo-fcfont.c
+++ b/pango/pangocairo-fcfont.c
@@ -45,6 +45,13 @@ typedef struct _GlyphExtentsCacheEntry GlyphExtentsCacheEntry;
typedef struct _GUnicharToGlyphCacheEntry GUnicharToGlyphCacheEntry;
+
+
+#define PANGO_UNITS(Double) ((int)((Double) * PANGO_SCALE + 0.49999))
+
+
+
+
/* define one of these to profile one of the caches */
#undef PROFILE_GLYPH_EXTENTS_CACHE
#undef PROFILE_CHAR_TO_GLYPH_CACHE
@@ -366,8 +373,8 @@ pango_cairo_fc_font_glyph_extents_cache_init (PangoCairoFcFont *cffont)
cairo_scaled_font_extents (scaled_font, &font_extents);
cffont->font_extents.x = 0;
- cffont->font_extents.y = - font_extents.ascent * PANGO_SCALE;
- cffont->font_extents.height = (font_extents.ascent + font_extents.descent) * PANGO_SCALE;
+ cffont->font_extents.y = - PANGO_UNITS (font_extents.ascent);
+ cffont->font_extents.height = PANGO_UNITS (font_extents.ascent + font_extents.descent);
cffont->font_extents.width = 0;
cffont->glyph_extents_cache = g_new0 (GlyphExtentsCacheEntry, GLYPH_CACHE_NUM_ENTRIES);
@@ -399,11 +406,11 @@ compute_glyph_extents (PangoCairoFcFont *cffont,
&cairo_glyph, 1, &extents);
entry->glyph = glyph;
- entry->width = extents.x_advance * PANGO_SCALE;
- entry->ink_rect.x = extents.x_bearing * PANGO_SCALE;
- entry->ink_rect.y = extents.y_bearing * PANGO_SCALE;
- entry->ink_rect.width = extents.width * PANGO_SCALE;
- entry->ink_rect.height = extents.height * PANGO_SCALE;
+ entry->width = PANGO_UNITS (extents.x_advance);
+ entry->ink_rect.x = PANGO_UNITS (extents.x_bearing);
+ entry->ink_rect.y = PANGO_UNITS (extents.y_bearing);
+ entry->ink_rect.width = PANGO_UNITS (extents.width);
+ entry->ink_rect.height = PANGO_UNITS (extents.height);
}
static GlyphExtentsCacheEntry *