Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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.
  • Loading branch information...
commit cdab0f2e842a68acea9227c87783d11ce8f4d23a 1 parent 2abf696
@shikadilord shikadilord authored
Showing with 13 additions and 0 deletions.
  1. +2 −0  changelog
  2. +2 −0  players_changelog
  3. +9 −0 src/text.cpp
View
2  changelog
@@ -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
2  players_changelog
@@ -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
9 src/text.cpp
@@ -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);
}
Please sign in to comment.
Something went wrong with that request. Please try again.