bugBattle for Wesnoth - Bugs: bug #21648, Pango/Cairo (GUI2) font rendering...

Show feedback again

bug #21648: Pango/Cairo (GUI2) font rendering with ClearType on Windows

Submitted by:  Ignacio R. Morelle <shadowmaster>
Submitted on:  Fri 14 Feb 2014 05:05:48 AM UTC  
Category: BugSeverity: 4 - Important
Priority: 5 - NormalItem Group: User Interface
Status: In ProgressPrivacy: Public
Assigned to: NoneOpen/Closed: Open
Release: 1.10.x, 1.11.x, earlier too maybeOperating System: Windows XP - 8

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


Sat 01 Aug 2015 01:04:33 PM UTC, comment #4:

After posting those screenshots I also managed to get Pango 1.37.2 compiled and working. Still no change in the text rendering with CAIRO_ANTIALIAS_DEFAULT. ):

Wedge009 <wedge009>
Sun 23 Feb 2014 08:03:38 AM UTC, comment #3:

I committed the workaround from file #20044 in commit cdab0f2e842a68acea9227c87783d11ce8f4d23a, which is in version 1.11.10.

The underlying bug (which may or may not be related to the specific Cairo version we use on Windows) remains unsolved, but I'm marking this as In Progress anyway.

Ignacio R. Morelle <shadowmaster>
Project Administrator
Fri 14 Feb 2014 05:11:12 AM UTC, comment #2:

All that said, I found that forcing the antialiasing mode to be grayscale on Windows in the ttext constructor minimized the issue, although some (literal) rough edges remain; take a close look at the text in italics in the attached screenshot, for example.

I am attaching both the patch (done against current Git master) and a screenshot of its effects.

(file #20043, file #20044)

Ignacio R. Morelle <shadowmaster>
Project Administrator
Fri 14 Feb 2014 05:07:15 AM UTC, comment #1:

GUI1 screenshot for comparison.

(file #20042)

Ignacio R. Morelle <shadowmaster>
Project Administrator
Fri 14 Feb 2014 05:05:48 AM UTC, original submission:

As evidenced by the attached screenshots, the Pango/Cairo font rendering code path used by GUI2 yields considerably different results to the SDL_ttf (freetype) path used by GUI1 when running on Windows XP and later with ClearType enabled (there is no way to disable it from the Windows configuration UI on Vista and later).

In fact, the Cairo rendering with ClearType looks generally inferior due to the way antialiasing bits are overpainted. For instance, consider the rendering of the words "encircling" and "skirmishers" in the titlescreen screenshot: the thinner 'l's and 'i's make the text look poorly-rendered, and the thin 'i' following a thick 'm' in "skirmishers" makes the kerning seem inconsistent.

The overpainting is done on purpose as a Windows-specific hack in ttext::rerender() (src/text.cpp around line 678) because there appears to be a bug with the decode_pixel() function normally used on Linux and other systems; in fact, forcing that rendering method on Windows results in a washed-out text effect.

Because Pango/Cairo and SDL_ttf/freetype-based text rendering still coexist in Wesnoth largely due to the continued usage of GUI1, having these inconsistencies in font rendering within the same application gives the game a significantly less polished overall appearance. Since Windows users comprise a large part of our audience, I consider this to be a rather important issue that might be worth solving before or during Wesnoth 1.12.x.


  • The Cairo version in use appears to be 1.10.2 -- I obtained it from the Windows build-time dependencies dir from the Wesnoth SF.net project for building on Windows.) However, I think this is also the version that is used for our official Windows build. What I don't know for sure if this is actually a bug in Cairo (or possibly Pango?) that is already solved in newer versions; unfortunately, the Gtk+ project site does not have newer Windows builds than 1.10.2.
  • Although the screenshots were made with a 1.11.6+dev build, the issue remains in latest Git master, and as far as I know has been present for a long time, even before 1.10.x.
Ignacio R. Morelle <shadowmaster>
Project Administrator


(Note: upload size limit is set to 1024 kB, after insertion of the required escape characters.)

Attach File(s):

Attached Files
file #24715:  wesnoth-win32-cleartype-cairo-1.14.2-defaults.png added by wedge009 (105kB - image/png - Demonstrating the issue still stands with Cairo 1.14.2 in Windows.)
file #24716:  wesnoth-win32-cleartype-cairo-1.14.2-grayscale-aa.png added by wedge009 (107kB - image/png - Demonstrating the issue still stands with Cairo 1.14.2 in Windows.)
file #20044:  font-render.patch added by shadowmaster (510B - text/x-patch)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by wedge009 (Updated the item)
  • -unavailable- added by shadowmaster (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Error: not logged in



    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 01 Aug 2015 12:02:44 PM UTCwedge009Attached File-=>Added wesnoth-win32-cleartype-cairo-1.14.2-defaults.png, #24715
      Attached File-=>Added wesnoth-win32-cleartype-cairo-1.14.2-grayscale-aa.png, #24716
    Sun 23 Feb 2014 08:03:38 AM UTCshadowmasterStatusNone=>In Progress
    Fri 14 Feb 2014 05:11:12 AM UTCshadowmasterAttached File-=>Added wesnoth-win32-cleartype-cairo-grayscale-aa.png, #20043
      Attached File-=>Added font-render.patch, #20044
    Fri 14 Feb 2014 05:07:15 AM UTCshadowmasterAttached File-=>Added wesnoth-win32-cleartype-freetype.png, #20042
    Fri 14 Feb 2014 05:05:48 AM UTCshadowmasterAttached File-=>Added wesnoth-win32-cleartype-cairo-defaults.png, #20041
    Show feedback again

    Back to the top

    Powered by Savane 3.1-cleanup