Ubuntu – Firefox doesn’t respect font hinting setting in Gnome? How to fix this

firefoxfontsgnome

I disabled font hinting in Gnome tweaks, but Firefox sometimes (for certain fonts I think) ignores that and tries to align glyphs to pixel grid, resulting in uneven spacing between letters and/or distorted glyphs. I'd like to force Firefox to never use hinting, if possible, are there ways to do so?

Font settings in Gnome tweaks:
Font settings in Gnome tweaks

An example of bad font rendering (this is a line from gmail web interface where it shows the list of threads; there are extra spaces between letters in some places where they should not be, in particular "release" reads as "relea se"):
An example of a problematic line

Same line after changing the zoom a bit (see how the bogus spaces are in different positions):
Same line after changing the zoom a bit

Firefox 64.0, installed from Ubuntu repositories via apt as usual, Ubuntu 18.04, with all recent updates. The display is not HiDPI, it has "regular" pixel density.

I tried to change font hinting by moving fontconfig files as described here https://askubuntu.com/a/29834/351113 (but used the /etc/fonts/conf.avail/10-hinting-none.conf as the source, of course) and it didn't solve this issue (after clearing Firefox cache and reboot)

Just to check it with something really obvious, I tried to disable font antialiasing in Gnome tweaks (which makes fonts obviously hideous) and it doesn't change font appearance in Firefox, so I'm pretty sure Firefox ignores Gnome font settings.

Creating ~/.fonts.conf with the appropriate contents also had no effect in Firefox.

As suggested in comments, I tried Firefox ESR and it is affected too.

Best Answer

Configuration files and directories: ~/.fonts.conf/, ~/.fonts.conf.d/ and ~/.fontconfig/*.cache-* are deprecated since fontconfig 2.10.1 and will not be read by default in the future versions of the package. New paths are $XDG_CONFIG_HOME/fontconfig/fonts.conf, $XDG_CONFIG_HOME/fontconfig/conf.d/NN-name.conf and $XDG_CACHE_HOME/fontconfig/*.cache-* respectively.

Ref: Fontconfig commit

Update: See thread Full font hinting not working in Ubuntu 18.04

Related Question