How to activate subpixel font hinting for the text inside Firefox, Chrome and evince?

6,407

Solution 1

Firefox seems not to read the GTK configuration, but it does will honor your ~/.fonts.conf which basically contains the font configuration, including the sub-pixel order.

This is an example .fonts.conf which comes from a 2005 blog post which may help out, what you most likely want to change is the rgba value (sub-pixel order) to match your LCD and maybe the antialias value.

<?xml version='1.0'?> <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> <fontconfig>
<match target="font">
    <edit mode="assign" name="autohint">
        <bool>false</bool>
    </edit>
</match>
<match target="font">
    <edit mode="assign" name="rgba">
        <const>rgb</const>
    </edit>
</match>
<match target="font">
    <edit mode="assign" name="hinting">
        <bool>true</bool>
    </edit>
</match>
<match target="font">
    <edit mode="assign" name="hintstyle">
        <const>hintfull</const>
    </edit>
</match>
<match target="font">
    <edit mode="assign" name="antialias">
        <bool>true</bool>
    </edit>
</match> </fontconfig>

Solution 2

There are two places where you can alter the fonts appearance:

1. Run dconf and find org.gnome.settings-daemon.plugins.xsettings schema. Hinting, antialiasing and RGBA order can be set there. These settings affect GTK and Unity applications.
2. Take a look at /etc/fonts/conf.d folder. It actually contains symlinks from /etc/fonts/conf.avail. For example, if you want to change your hinting style from slight to full, remove one symlink and add another.

sudo rm /etc/fonts/conf.d/10-hinting-slight.conf
sudo ln -s /etc/fonts/conf.avail/10-hinting-full.conf /etc/fonts/conf.d/

In your case check whether 10-no-sub-pixel.conf symlink exists in /etc/fonts/conf.d folder. If yes, remove it and add 10-sub-pixel-rgb.conf symlink as described earlier.
These settings affect non-GTK applications like Firefox and some other.

If you need some proven resources about fonts configuration you can look at https://wiki.ubuntu.com/Fonts (mostly consists of custom ~/.fonts.conf and quite old). Another great resource is https://wiki.archlinux.org/index.php/Font_Configuration (contains multiple hints and up to date).

BTW Direct editing of /etc/fonts/fonts.conf is not recommended. You'd better add /etc/fonts/local.conf or ~/.fonts.conf with your custom settings which will prevail over the settings in /etc/fonts/fonts.conf.

Share:
6,407

Related videos on Youtube

alecail
Author by

alecail

Updated on September 18, 2022

Comments

  • alecail
    alecail over 1 year

    I used the answers to this question to tune the subpixel font hinting in the Unity interface. However, the text rendered inside Firefox , Chrome or evince doesn't use subpixel anti-aliasing. Sadly these three applications are the one which need it the most.

    Subpixel font hinting is enabled almost everywhere else.

    How to activate it for these applications ?

  • alecail
    alecail over 10 years
    There was already a .fonts.config with some minor differences, especially on the autohint key which was not set. It's now working with autohint=false. Not sure why.. but it's working.