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.

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

mercurial