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: FixedPrivacy: 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.

 

(Jump to the original submission Jump to the original submission)

Mon 08 Aug 2016 12:40:02 PM UTC, comment #10:

Big improvement. I think this can be marked as fixed/done. Thanks.

Wedge009 <wedge009>
Sun 07 Aug 2016 06:29:05 PM UTC, comment #9:

I committed https://github.com/wesnoth/wesnoth/commit/c91b200b7a10bf82fb13417a1267fcdf0fc4b2c1 which reduces the number of rendering passes on Windows to 1 and uses CAIRO_ANTIALIAS_DEFAULT. JyrkiVesterinen reported this now makes Wesnoth respect Window's font smoothing settings, so I consider this an improvement.

Charles Dang <vultraz>
Project Member
Wed 22 Jun 2016 10:03:18 AM UTC, comment #8:

> To me, images 2, 3, and 4 look the same (in terms of fonts)


Hmm yes its eaiser to see when you see those images like a gif.

> while image 1 looks like it's using CAIRO_ANTIALIAS_DEFAULT


Liek i said, only image 4 uses CAIRO_ANTIALIAS_GRAY.

Daniel <gfgtdf>
Project Member
Wed 22 Jun 2016 10:00:12 AM UTC, comment #7:

Well, shadown gave a link to his patch in comment 3, it changes sets anitalasing to CAIRO_ANTIALIAS_GRAY

Daniel <gfgtdf>
Project Member
Wed 22 Jun 2016 12:42:04 AM UTC, comment #6:

Not sure what shadowm's patch involves. To me, images 2, 3, and 4 look the same (in terms of fonts) while image 1 looks like it's using CAIRO_ANTIALIAS_DEFAULT in Windows. I've uploaded updated screenshots with the Lato font, both are taken with current master aside from changing the anti-aliasing mode for Cairo (as previously). Default AA continues to look like the hinting is applied twice as much as the grey-scale AA.

Wedge009 <wedge009>
Tue 21 Jun 2016 07:36:26 PM UTC, comment #5:

I just dis some testing on latest master:
https://s31.postimg.org/p2maispjt/wesnottext.png
picture 4 is current master.
picture 1 is without shadowms patch.
picture 2 is without shadowms patch decode_pixel() on windows.
picture 3 is without shadowms patch doing a single draw (as opposed to current master which does 3 draws.)

Daniel <gfgtdf>
Project Member
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.

Notes

  • 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):
   
   
Comment:
   

Attached Files
file #27614:  wesnoth-1.13.4+dev-win32-cleartype-cairo-1.14.4-defaults.png added by wedge009 (463kB - image/png - Adding screenshots with Lato font - current master as at 2016-06-22.)
file #27615:  wesnoth-1.13.4+dev-win32-cleartype-cairo-1.14.4-greyscale-aa.png added by wedge009 (470kB - image/png - Adding screenshots with Lato font - current master as at 2016-06-22.)
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 vultraz (Posted a comment)
  • -unavailable- added by gfgtdf (Posted a comment)
  • -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 10 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 08 Aug 2016 12:52:35 PM UTCvultrazStatusIn Progress=>Fixed
    Wed 22 Jun 2016 12:35:18 AM UTCwedge009Attached File-=>Added wesnoth-1.13.4+dev-win32-cleartype-cairo-1.14.4-defaults.png, #27614
      Attached File-=>Added wesnoth-1.13.4+dev-win32-cleartype-cairo-1.14.4-greyscale-aa.png, #27615
    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