1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/cairo/ft-no-subpixel-if-surface-disables.patch Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,46 @@ 1.4 +# HG changeset patch 1.5 +# Parent 31c7eac3de3de324cb5c93bd19c4e16a693f1101 1.6 +# User Karl Tomlinson <karlt+@karlt.net> 1.7 +b=929451 don't use subpixel aa for ft fonts on surfaces that don't support it r?roc 1.8 + 1.9 +Also: 1.10 +* Prefer subpixel order provided by the surface over that from the font face. 1.11 +* Allow font face options to turn off subpixel aa. 1.12 + 1.13 +diff --git a/gfx/cairo/cairo/src/cairo-ft-font.c b/gfx/cairo/cairo/src/cairo-ft-font.c 1.14 +--- a/gfx/cairo/cairo/src/cairo-ft-font.c 1.15 ++++ b/gfx/cairo/cairo/src/cairo-ft-font.c 1.16 +@@ -1759,23 +1759,26 @@ static void 1.17 + 1.18 + if (load_flags & FT_LOAD_NO_HINTING) 1.19 + other->base.hint_style = CAIRO_HINT_STYLE_NONE; 1.20 + 1.21 + if (other->base.antialias == CAIRO_ANTIALIAS_NONE || 1.22 + options->base.antialias == CAIRO_ANTIALIAS_NONE) { 1.23 + options->base.antialias = CAIRO_ANTIALIAS_NONE; 1.24 + options->base.subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT; 1.25 +- } 1.26 +- 1.27 +- if (other->base.antialias == CAIRO_ANTIALIAS_SUBPIXEL && 1.28 +- (options->base.antialias == CAIRO_ANTIALIAS_DEFAULT || 1.29 +- options->base.antialias == CAIRO_ANTIALIAS_GRAY)) { 1.30 +- options->base.antialias = CAIRO_ANTIALIAS_SUBPIXEL; 1.31 +- options->base.subpixel_order = other->base.subpixel_order; 1.32 ++ } else if (options->base.antialias != CAIRO_ANTIALIAS_GRAY) { 1.33 ++ /* The surface supports subpixel aa, so let the font face options 1.34 ++ * choose whether to use subpixel aa. If the surface has 1.35 ++ * CAIRO_ANTIALIAS_GRAY (e.g. PS, PDF, SVG, translucent part of a 1.36 ++ * CONTENT_COLOR_ALPHA surface), then don't accept subpixel aa. */ 1.37 ++ if (other->base.antialias != CAIRO_ANTIALIAS_DEFAULT) 1.38 ++ options->base.antialias = other->base.antialias; 1.39 ++ /* If the surface knows the subpixel order then use that. */ 1.40 ++ if (options->base.subpixel_order == CAIRO_SUBPIXEL_ORDER_DEFAULT) 1.41 ++ options->base.subpixel_order = other->base.subpixel_order; 1.42 + } 1.43 + 1.44 + if (options->base.hint_style == CAIRO_HINT_STYLE_DEFAULT) 1.45 + options->base.hint_style = other->base.hint_style; 1.46 + 1.47 + if (other->base.hint_style == CAIRO_HINT_STYLE_NONE) 1.48 + options->base.hint_style = CAIRO_HINT_STYLE_NONE; 1.49 +