How to disable bitmap fonts?

Solution 1:

Aside answer by @Candy Gumdrop, it's good to disable embedded bitmap, some fonts (like Calibri) will look terrible in some resolutions (see image bellow) if this setting stills enabled. Calibri fonts and other cleartype fonts have bitmap versions embedded in them which activate at small sizes, which makes it look bad.

You can disable by doing this:

cd /etc/fonts/conf.d

cat << END | sudo tee ../conf.avail/99-no-embeddedbitmap.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <description>Disable embedded bitmap</description>
  <match target="font" >
    <edit name="embeddedbitmap" mode="assign">
        <bool>false</bool>
    </edit>
  </match>
</fontconfig>
END

sudo ln -s ../conf.avail/99-no-embeddedbitmap.conf ./

sudo dpkg-reconfigure fontconfig

enter image description here

Solution 2:

The directory /etc/fonts/conf.d/ contains symbolic links to configuration files within /etc/fonts/conf.avail/. These symlinks can be added and removed to customize the configuration of fontconfig.

The commands you previously ran disabled all 10-* configuration options, as well as disabling 70-no-bitmaps and enabling 70-yes-bitmaps. To reverse the latter part specifically, you can run the following:

cd /etc/fonts/conf.d
sudo rm 70-yes-bitmaps.conf
sudo ln -s ../conf.avail/70-no-bitmaps.conf ./

To reverse the effect of disabling the 10-* configuration files depends on which config files you had enabled to begin with. Here are the 10-* config files I have enabled on my machine:

cd /etc/fonts/conf.d
sudo ln -s ../conf.avail/10-hinting-slight.conf ./
sudo ln -s ../conf.avail/10-scale-bitmap-fonts.conf ./
sudo ln -s ../conf.avail/10-sub-pixel-rgb.conf ./

Alternatively, here is how you can enable the default 10-* options for Ubuntu Bionic:

cd /etc/fonts/conf.d
sudo ln -s ../conf.avail/10-hinting-slight.conf ./
sudo ln -s ../conf.avail/10-scale-bitmap-fonts.conf ./
sudo ln -s ../conf.avail/10-antialias.conf ./

I would personally recommend however, that you opt for sub-pixel-rgb instead of antialias unless you don't have a standard LCD monitor.

You may find however that the strange font rendering you're getting in Chrome is because you disabled these 10-* config files and not because you enabled bitmap fonts. You may want to try only re-enabling just these config files without swapping back from 70-yes-bitmaps to 70-no-bitmaps before reverting completely to having no bitmap fonts. Enabling 70-yes-bitmaps should not affect any other fonts besides allowing bitmap fonts to be used. It is also possible that you have some missing fonts and may get better results than you had originally by running:

sudo apt install ttf-mscorefonts-installer

Finally, after you have altered your fontconfig configuration, you should run:

sudo dpkg-reconfigure fontconfig

This will update your fontconfig cache so your changes can take effect. You may also need to restart your programs / log out and back in / reboot your computer to see the changes take effect.