gfx/cairo/win32-cleartype-clipping.patch

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 diff --git a/gfx/cairo/cairo/src/cairo-win32-font.c b/gfx/cairo/cairo/src/cairo-win32-font.c
     2 --- a/gfx/cairo/cairo/src/cairo-win32-font.c
     3 +++ b/gfx/cairo/cairo/src/cairo-win32-font.c
     4 @@ -986,6 +986,19 @@ _cairo_win32_scaled_font_init_glyph_metr
     5  			      &metrics, 0, NULL, &matrix) == GDI_ERROR) {
     6  	  status = _cairo_win32_print_gdi_error ("_cairo_win32_scaled_font_init_glyph_metrics:GetGlyphOutlineW");
     7  	  memset (&metrics, 0, sizeof (GLYPHMETRICS));
     8 +	} else {
     9 +	    if (metrics.gmBlackBoxX > 0 && scaled_font->base.options.antialias != CAIRO_ANTIALIAS_NONE) {
    10 +		/* The bounding box reported by Windows supposedly contains the glyph's "black" area;
    11 +		 * however, antialiasing (especially with ClearType) means that the actual image that
    12 +		 * needs to be rendered may "bleed" into the adjacent pixels, mainly on the right side.
    13 +		 * To avoid clipping the glyphs when drawn by _cairo_surface_fallback_show_glyphs,
    14 +		 * for example, or other code that uses glyph extents to determine the area to update,
    15 +		 * we add a pixel of "slop" to left side of the nominal "black" area returned by GDI,
    16 +		 * and two pixels to the right (as tests show some glyphs bleed into this column).
    17 +		 */
    18 +		metrics.gmptGlyphOrigin.x -= 1;
    19 +		metrics.gmBlackBoxX += 3;
    20 +	    }
    21  	}
    22  	cairo_win32_scaled_font_done_font (&scaled_font->base);
    23  	if (status)

mercurial