diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2006-04-07 09:12:41 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2006-04-07 09:12:41 +0000 |
commit | 7a8abd8d561bcee77502291d4356c0fcd841732d (patch) | |
tree | f6d8efc48ee74097467832b682b1d297a648cef6 /pango/pangocairo-fcfont.c | |
parent | 4d00873d62cc47b6c93bb8e3e644c613fecfcfb1 (diff) | |
download | pango-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.
Diffstat (limited to 'pango/pangocairo-fcfont.c')
-rw-r--r-- | pango/pangocairo-fcfont.c | 21 |
1 files changed, 14 insertions, 7 deletions
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 * |