michael@0: # HG changeset patch michael@0: # Parent 31c7eac3de3de324cb5c93bd19c4e16a693f1101 michael@0: # User Karl Tomlinson michael@0: b=929451 don't use subpixel aa for ft fonts on surfaces that don't support it r?roc michael@0: michael@0: Also: michael@0: * Prefer subpixel order provided by the surface over that from the font face. michael@0: * Allow font face options to turn off subpixel aa. michael@0: michael@0: diff --git a/gfx/cairo/cairo/src/cairo-ft-font.c b/gfx/cairo/cairo/src/cairo-ft-font.c michael@0: --- a/gfx/cairo/cairo/src/cairo-ft-font.c michael@0: +++ b/gfx/cairo/cairo/src/cairo-ft-font.c michael@0: @@ -1759,23 +1759,26 @@ static void michael@0: michael@0: if (load_flags & FT_LOAD_NO_HINTING) michael@0: other->base.hint_style = CAIRO_HINT_STYLE_NONE; michael@0: michael@0: if (other->base.antialias == CAIRO_ANTIALIAS_NONE || michael@0: options->base.antialias == CAIRO_ANTIALIAS_NONE) { michael@0: options->base.antialias = CAIRO_ANTIALIAS_NONE; michael@0: options->base.subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT; michael@0: - } michael@0: - michael@0: - if (other->base.antialias == CAIRO_ANTIALIAS_SUBPIXEL && michael@0: - (options->base.antialias == CAIRO_ANTIALIAS_DEFAULT || michael@0: - options->base.antialias == CAIRO_ANTIALIAS_GRAY)) { michael@0: - options->base.antialias = CAIRO_ANTIALIAS_SUBPIXEL; michael@0: - options->base.subpixel_order = other->base.subpixel_order; michael@0: + } else if (options->base.antialias != CAIRO_ANTIALIAS_GRAY) { michael@0: + /* The surface supports subpixel aa, so let the font face options michael@0: + * choose whether to use subpixel aa. If the surface has michael@0: + * CAIRO_ANTIALIAS_GRAY (e.g. PS, PDF, SVG, translucent part of a michael@0: + * CONTENT_COLOR_ALPHA surface), then don't accept subpixel aa. */ michael@0: + if (other->base.antialias != CAIRO_ANTIALIAS_DEFAULT) michael@0: + options->base.antialias = other->base.antialias; michael@0: + /* If the surface knows the subpixel order then use that. */ michael@0: + if (options->base.subpixel_order == CAIRO_SUBPIXEL_ORDER_DEFAULT) michael@0: + options->base.subpixel_order = other->base.subpixel_order; michael@0: } michael@0: michael@0: if (options->base.hint_style == CAIRO_HINT_STYLE_DEFAULT) michael@0: options->base.hint_style = other->base.hint_style; michael@0: michael@0: if (other->base.hint_style == CAIRO_HINT_STYLE_NONE) michael@0: options->base.hint_style = CAIRO_HINT_STYLE_NONE; michael@0: