Ugly fonts in Mozilla Firefox and Thunderbird under Linux (skia and cairo)

Recently, after updating to Mozilla Firefox to version 52 or later (55.0.2, in my case), and Mozilla Thunderbird to version 52 or later (52.3.0, in my case), I found that fonts were rendering horribly under Linux. It looked essentially like there was no anti-aliasing or hinting at all.

Come to find out, this was due to a change in the content rendering engine, which is briefly mentioned in the release notes for Firefox 52 (but it also applies to Thunderbird). Basically, in Linux, the default engine changed from cairo to Google’s Skia.

Ugly fonts in Firefox and Thunderbird under Linux - skia and cairo

For each application, the easiest method for getting the fonts to render nicely again is to make two changes directly in the configuration editor. To do so in Firefox, simply go to the address bar and type about:config. Within Thunderbird, it can be launched by going to Menu > Preferences > Advanced > Config Editor. Once there, the two keys that need to change are:

gfx.canvas.azure.backends
gfx.content.azure.backends

They likely have values of “skia” or a comma-separated list with “skia” being the first value. On my Linux hosts, I changed the value from skia back to cairo, restarted the applications, and all was again right in the world (or at least in the Mozilla font world ๐Ÿ˜› ).

Hope that helps.

Cheers,
Zach

24 comments

Skip to comment form

    • Chris Elvidge on Sunday, 17 February 2019 at 09:26
    • Reply

    Thank you for fixing my Thunderbird v 52.2.1

      • Zach on Monday, 18 February 2019 at 12:01
        Author
      • Reply

      Hi Chris,

      I’m glad that the article helped you with the problem in Thunderbird!

      Cheers,
      Zach

  1. Thank you for this post. This is a solution of firefox mac but how to disable Java in Google Chrome because I do not disable this so what is the solution of this query

      • Zach on Monday, 27 November 2017 at 13:51
        Author
      • Reply

      That question is not really related to this post at all, but disabling Java within Google Chrome on Mac can generally be done following these instructions:
      https://www.podfeet.com/blog/tutorials-5/how-to-disable-java-in-chrome/

    • VT on Tuesday, 3 October 2017 at 07:11
    • Reply

    Hi,
    as I suspected this were a cryptic problem, I have unmerged gentoo Firefox and installed 57.0b3 in /usr/local. Looks are good again, plus other benefits.
    VT

      • Zach on Tuesday, 3 October 2017 at 12:18
        Author
      • Reply

      Very interesting findings. Have you filed a bug for the Mozilla Team within Gentoo with details?

      Cheers,
      Zach

        • VT on Wednesday, 4 October 2017 at 01:52
        • Reply

        No, because I found this bug were reported, and 57.0b3, being quite a radical rewrite, was certainly supposed to be free of this bug.
        VT

    • Lars on Saturday, 30 September 2017 at 03:07
    • Reply

    Haha,

    I halso had this problem.
    Saw this post while i just had fired off a emerge -uDav @world and not seen the list of changes yet.
    Made the workaround and the problem was gone.
    Got back to my emerge console and saw a new version of freetype.
    Emerged it and changed the settings back to skia in Firefox. Solved again ๐Ÿ˜‰

      • Zach on Monday, 2 October 2017 at 11:24
        Author
      • Reply

      Can you let me know the versions of Firefox and freetype that you’re using where you don’t need this workaround? I’m on freetype-2.8.1 and Firefox 55.0.2, and the workaround is still needed. I don’t see an available update to freetype, but I do see one to Firefox (to 56.0), and I’m wondering if that fixes it (however, that wouldn’t fix it in Thunderbird).

      Cheers,
      Zach

        • Lars on Friday, 6 October 2017 at 03:31
        • Reply

        I’m on firefox-55.0.2 and freetype-2.8 and all is good.
        I’m on a full ~amd64 profile. Maybe something else is also chipping in. Or it’s some USE flag.
        I’m doing a full emerge now so I will also be on freetype-2.8.1 soon (and a newer firefox). Maybe the problem resurfaces. I’ll let you know.

          • Lars on Friday, 6 October 2017 at 04:51
          • Reply

          And now the problem is back.
          firefox-55.0.2 and freetype-2.8.1.

            • Lars on Friday, 6 October 2017 at 09:53

            And now when my emerge is finished with firefox updated to v56 everything’s fine again. ๐Ÿ™‚
            So Firefox-56 + freetype-2.8.1 is all right here.

  2. Actually, this looks like the freetype-2.8.1 font rendering problem: https://bugs.gentoo.org/631502

      • Zach on Thursday, 28 September 2017 at 09:45
        Author
      • Reply

      Indeed, this is related to that bug. Falling back to Cairo is a workaround until a better fix is in place.

      Cheers,
      Zach

    • Evi1M4chine on Thursday, 28 September 2017 at 05:28
    • Reply

    I have the same problem, but it results in several characters being underscored all the time. E.g. all the โ€œtโ€s in these comments, and all dashes and slashes in the URL bar.

      • Evi1M4chine on Thursday, 28 September 2017 at 05:32
      • Reply

      BTW: Wonโ€™t changing the config values like that result in problems in the long run? E.g. when the cairo backend will be removed, or something like that.
      Because I sure as hell wonโ€™t remember any of this when that happens. I would love there to be an automatic trigger in that case.

        • Zach on Thursday, 28 September 2017 at 09:46
          Author
        • Reply

        It could if Cairo is removed, and there isn’t a check for modified configurations. However, this is a workaround for now.

    • Szymon on Thursday, 28 September 2017 at 01:24
    • Reply

    It may be related to latest freetype upgrade – https://bugs.gentoo.org/631502.

      • Zach on Thursday, 28 September 2017 at 09:45
        Author
      • Reply

      Indeed, this is related to that bug. Falling back to Cairo is a workaround until a better fix is in place.

      Cheers,
      Zach

    • Anton on Wednesday, 27 September 2017 at 22:12
    • Reply

    Both values are “skia” for me, but I have no problem with rendering (under KDE).

      • Zach on Wednesday, 27 September 2017 at 22:41
        Author
      • Reply

      Thanks for letting me know, Anton. It must be something related to my particular environment, then. I use Openbox, but I don’t think that the WM should matter. It’s probably more an issue with the graphics driver that is being used, or possibly the X server version. It may require some further investigation, but for now, it is an option for those having trouble with Skia.

      Cheers,
      Zach

        • Gabriele Svelto on Thursday, 28 September 2017 at 03:39
        • Reply

        Same here, I have no font rendering issues in either Firefox and Thunderbird. I haven’t tweaked Firefox configuration nor its use flags aside from disabling the cleartype_hinting USE flag in freetype which is one of the dependencies. You might want to check your fontconfig configuration because that’s often the cause of ugly/weird font rendering. Try seeing if something is amiss with ‘eselect fontconfig list’.

          • Zach on Thursday, 28 September 2017 at 09:47
            Author
          • Reply

          Yes, this is a workaround regarding fontconfig, and more importantly, freetype: https://bugs.gentoo.org/631502

          Cheers,
          Zach

Leave a Reply

Your email address will not be published.