«

»

Sep 27 2017

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

22 comments

Skip to comment form

  1. Anton

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

    1. Zach

      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

      1. Gabriele Svelto

        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’.

        1. Zach

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

          Cheers,
          Zach

  2. Szymon

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

    1. Zach

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

      Cheers,
      Zach

  3. Evi1M4chine

    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.

    1. Evi1M4chine

      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.

      1. Zach

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

  4. stefantalpalaru

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

    1. Zach

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

      Cheers,
      Zach

  5. Lars

    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 ๐Ÿ˜‰

    1. Zach

      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

      1. Lars

        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.

        1. Lars

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

          1. Lars

            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.

  6. VT

    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

    1. Zach

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

      Cheers,
      Zach

      1. VT

        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

  7. firefox keeps freezing

    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

    1. Zach

      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/

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>