gfx/cairo/win32-cleartype-clipping.patch

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/cairo/win32-cleartype-clipping.patch	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,23 @@
     1.4 +diff --git a/gfx/cairo/cairo/src/cairo-win32-font.c b/gfx/cairo/cairo/src/cairo-win32-font.c
     1.5 +--- a/gfx/cairo/cairo/src/cairo-win32-font.c
     1.6 ++++ b/gfx/cairo/cairo/src/cairo-win32-font.c
     1.7 +@@ -986,6 +986,19 @@ _cairo_win32_scaled_font_init_glyph_metr
     1.8 + 			      &metrics, 0, NULL, &matrix) == GDI_ERROR) {
     1.9 + 	  status = _cairo_win32_print_gdi_error ("_cairo_win32_scaled_font_init_glyph_metrics:GetGlyphOutlineW");
    1.10 + 	  memset (&metrics, 0, sizeof (GLYPHMETRICS));
    1.11 ++	} else {
    1.12 ++	    if (metrics.gmBlackBoxX > 0 && scaled_font->base.options.antialias != CAIRO_ANTIALIAS_NONE) {
    1.13 ++		/* The bounding box reported by Windows supposedly contains the glyph's "black" area;
    1.14 ++		 * however, antialiasing (especially with ClearType) means that the actual image that
    1.15 ++		 * needs to be rendered may "bleed" into the adjacent pixels, mainly on the right side.
    1.16 ++		 * To avoid clipping the glyphs when drawn by _cairo_surface_fallback_show_glyphs,
    1.17 ++		 * for example, or other code that uses glyph extents to determine the area to update,
    1.18 ++		 * we add a pixel of "slop" to left side of the nominal "black" area returned by GDI,
    1.19 ++		 * and two pixels to the right (as tests show some glyphs bleed into this column).
    1.20 ++		 */
    1.21 ++		metrics.gmptGlyphOrigin.x -= 1;
    1.22 ++		metrics.gmBlackBoxX += 3;
    1.23 ++	    }
    1.24 + 	}
    1.25 + 	cairo_win32_scaled_font_done_font (&scaled_font->base);
    1.26 + 	if (status)

mercurial