b=929451 don't use subpixel aa for ft fonts on surfaces that don't support it r=roc

Also:
* Prefer subpixel order provided by the surface over that from the font face.
* Allow font face options to turn off subpixel aa.

--HG--
extra : transplant_source : %02bD%22G%CE%95%C9%8D%86%8A%B9u%23_nHA%C4%11
This commit is contained in:
Karl Tomlinson 2014-01-28 18:14:23 +13:00
parent 58b73ce9c7
commit c97641060a
3 changed files with 58 additions and 7 deletions

View File

@ -210,6 +210,8 @@ dasharray-zero-gap.patch: bug 885585, ensure strokes get painted when the gaps i
cairo-mask-extends-bug.patch: bug 918671, sometimes when building a mask we wouldn't clear it properly. This is fixed in cairo 1.12
ft-no-subpixel-if-surface-disables.patch: bug 929451, don't use subpixel aa for ft fonts on surfaces that don't support it
==== pixman patches ====
pixman-android-cpu-detect.patch: Add CPU detection support for Android, where we can't reliably access /proc/self/auxv.

View File

@ -1764,13 +1764,16 @@ _cairo_ft_options_merge (cairo_ft_options_t *options,
options->base.antialias == CAIRO_ANTIALIAS_NONE) {
options->base.antialias = CAIRO_ANTIALIAS_NONE;
options->base.subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT;
}
if (other->base.antialias == CAIRO_ANTIALIAS_SUBPIXEL &&
(options->base.antialias == CAIRO_ANTIALIAS_DEFAULT ||
options->base.antialias == CAIRO_ANTIALIAS_GRAY)) {
options->base.antialias = CAIRO_ANTIALIAS_SUBPIXEL;
options->base.subpixel_order = other->base.subpixel_order;
} else if (options->base.antialias != CAIRO_ANTIALIAS_GRAY) {
/* The surface supports subpixel aa, so let the font face options
* choose whether to use subpixel aa. If the surface has
* CAIRO_ANTIALIAS_GRAY (e.g. PS, PDF, SVG, translucent part of a
* CONTENT_COLOR_ALPHA surface), then don't accept subpixel aa. */
if (other->base.antialias != CAIRO_ANTIALIAS_DEFAULT)
options->base.antialias = other->base.antialias;
/* If the surface knows the subpixel order then use that. */
if (options->base.subpixel_order == CAIRO_SUBPIXEL_ORDER_DEFAULT)
options->base.subpixel_order = other->base.subpixel_order;
}
if (options->base.hint_style == CAIRO_HINT_STYLE_DEFAULT)

View File

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