From b514863a0ee8e6c4f0a994f6f5e7db18ce290e79 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Thu, 21 Oct 2010 13:59:25 +0200 Subject: [PATCH] Actually implement round_glpyh_positions The previous commit only added this option and made sure it gets set, but it didn't actually have any effect. This commit now implements this option. Signed-off-by: Uli Schlachter --- src/cairo-scaled-font.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c index b40e4d40e..12d8ceace 100644 --- a/src/cairo-scaled-font.c +++ b/src/cairo-scaled-font.c @@ -2071,6 +2071,7 @@ _cairo_scaled_font_glyph_device_extents (cairo_scaled_font_t *scaled_font, cairo_box_t box = { { INT_MAX, INT_MAX }, { INT_MIN, INT_MIN }}; cairo_scaled_glyph_t *glyph_cache[64]; cairo_bool_t overlap = overlap_out ? FALSE : TRUE; + cairo_round_glyph_positions_t round_glyph_positions = _cairo_font_options_get_round_glyph_positions (&scaled_font->options); int i; if (unlikely (scaled_font->status)) @@ -2099,11 +2100,17 @@ _cairo_scaled_font_glyph_device_extents (cairo_scaled_font_t *scaled_font, glyph_cache[cache_index] = scaled_glyph; } - x = _cairo_fixed_from_double (glyphs[i].x); + if (round_glyph_positions == CAIRO_ROUND_GLYPH_POS_ON) + x = _cairo_fixed_from_double (_cairo_lround (glyphs[i].x)); + else + x = _cairo_fixed_from_double (glyphs[i].x); x1 = x + scaled_glyph->bbox.p1.x; x2 = x + scaled_glyph->bbox.p2.x; - y = _cairo_fixed_from_double (glyphs[i].y); + if (round_glyph_positions == CAIRO_ROUND_GLYPH_POS_ON) + y = _cairo_fixed_from_double (_cairo_lround (glyphs[i].y)); + else + y = _cairo_fixed_from_double (glyphs[i].y); y1 = y + scaled_glyph->bbox.p1.y; y2 = y + scaled_glyph->bbox.p2.y;