gfx/cairo/ft-no-subpixel-if-surface-disables.patch

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 # HG changeset patch
     2 # Parent 31c7eac3de3de324cb5c93bd19c4e16a693f1101
     3 # User Karl Tomlinson <karlt+@karlt.net>
     4 b=929451 don't use subpixel aa for ft fonts on surfaces that don't support it r?roc
     6 Also:
     7 * Prefer subpixel order provided by the surface over that from the font face.
     8 * Allow font face options to turn off subpixel aa.
    10 diff --git a/gfx/cairo/cairo/src/cairo-ft-font.c b/gfx/cairo/cairo/src/cairo-ft-font.c
    11 --- a/gfx/cairo/cairo/src/cairo-ft-font.c
    12 +++ b/gfx/cairo/cairo/src/cairo-ft-font.c
    13 @@ -1759,23 +1759,26 @@ static void
    15      if (load_flags & FT_LOAD_NO_HINTING)
    16  	other->base.hint_style = CAIRO_HINT_STYLE_NONE;
    18      if (other->base.antialias == CAIRO_ANTIALIAS_NONE ||
    19  	options->base.antialias == CAIRO_ANTIALIAS_NONE) {
    20  	options->base.antialias = CAIRO_ANTIALIAS_NONE;
    21  	options->base.subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT;
    22 -    }
    23 -
    24 -    if (other->base.antialias == CAIRO_ANTIALIAS_SUBPIXEL &&
    25 -	(options->base.antialias == CAIRO_ANTIALIAS_DEFAULT ||
    26 -	 options->base.antialias == CAIRO_ANTIALIAS_GRAY)) {
    27 -	options->base.antialias = CAIRO_ANTIALIAS_SUBPIXEL;
    28 -	options->base.subpixel_order = other->base.subpixel_order;
    29 +    } else if (options->base.antialias != CAIRO_ANTIALIAS_GRAY) {
    30 +	/* The surface supports subpixel aa, so let the font face options
    31 +	 * choose whether to use subpixel aa.  If the surface has
    32 +	 * CAIRO_ANTIALIAS_GRAY (e.g. PS, PDF, SVG, translucent part of a
    33 +	 * CONTENT_COLOR_ALPHA surface), then don't accept subpixel aa. */
    34 +	if (other->base.antialias != CAIRO_ANTIALIAS_DEFAULT)
    35 +	    options->base.antialias = other->base.antialias;
    36 +	/* If the surface knows the subpixel order then use that. */
    37 +	if (options->base.subpixel_order == CAIRO_SUBPIXEL_ORDER_DEFAULT)
    38 +	    options->base.subpixel_order = other->base.subpixel_order;
    39      }
    41      if (options->base.hint_style == CAIRO_HINT_STYLE_DEFAULT)
    42  	options->base.hint_style = other->base.hint_style;
    44      if (other->base.hint_style == CAIRO_HINT_STYLE_NONE)
    45  	options->base.hint_style = CAIRO_HINT_STYLE_NONE;

mercurial