Force grayscale font AA with Cairo on Windows (bug #21648)

Cairo on Windows (at least the latest available version from gtk.org
as of 2014-02-22, version 1.10.2) has issues with ClearType resulting
in glitchy anti-aliasing with CAIRO_ANTIALIAS_SUBPIXEL or
CAIRO_ANTIALIAS_DEFAULT, but not CAIRO_ANTIALIAS_GRAY, so we should
use that as a workaround until the Windows package is updated to use
a newer version of Cairo.
This commit is contained in:
Ignacio R. Morelle 2014-02-22 06:08:01 -03:00
parent 2abf696ef4
commit cdab0f2e84
3 changed files with 13 additions and 0 deletions

View file

@ -51,6 +51,8 @@ Version 1.11.9+dev:
screenshot was successfully saved to disk, including options to open it
in an external application, copy the path to clipboard, or browse the
screenshots folder.
* Force grayscale antialiasing for text rendered using Cairo/Pango (e.g. by
GUI2) on Windows to work around ClearType-induced glitches (bug #21648).
* Fixed bug #21584: Properly redraw the minimap when the minimap is
resized.
* Fixed: Enable blurring in the title screen.

View file

@ -33,6 +33,8 @@ Version 1.11.9+dev:
screenshot was successfully saved to disk, including options to open it
in an external application, copy the path to clipboard, or browse the
screenshots folder.
* Force grayscale antialiasing for text rendered using Cairo/Pango (e.g. by
GUI2) on Windows to work around ClearType-induced glitches (bug #21648).
* Added descriptions to the options in Preferences -> Display -> Themes.
* Miscellaneous and bug fixes:

View file

@ -122,6 +122,15 @@ ttext::ttext() :
cairo_font_options_t *fo = cairo_font_options_create();
cairo_font_options_set_hint_style(fo, CAIRO_HINT_STYLE_FULL);
cairo_font_options_set_hint_metrics(fo, CAIRO_HINT_METRICS_ON);
#ifdef _WIN32
// Cairo on Windows (at least the latest available version from gtk.org
// as of 2014-02-22, version 1.10.2) has issues with ClearType resulting
// in glitchy anti-aliasing with CAIRO_ANTIALIAS_SUBPIXEL or
// CAIRO_ANTIALIAS_DEFAULT, but not CAIRO_ANTIALIAS_GRAY, so we use that
// as a workaround until the Windows package is updated to use a newer
// version of Cairo (see Wesnoth bug #21648).
cairo_font_options_set_antialias(fo, CAIRO_ANTIALIAS_GRAY);
#endif
pango_cairo_context_set_font_options(context_, fo);
cairo_font_options_destroy(fo);
}