Thursday, September 6, 2018

Make Font Rendering in Fedora 28 Great Again

While I am a mostly openSUSE user, due to some work requirements, I found myself in need of a Fedora installation. Bought a wonderfully refurbished Dell Latitude E5450 with an i5 CPU, 16GB RAM and 1TB HDD online and installed the latest Fedora Workstation  on it - since I use UK English and US English keyboard layout - I had to reconfigure the keyboard mapping post installation by localectl set-keymap us 

However the font rendering is still relatively inferior compared to openSUSE and Ubuntu (and its clones) - perhaps Fedora's insistence on sticking closely to vanilla upstream could be the issue.

Since I will be spending a lot of time working on this Fedora notebook, something needs to be done.

Grab the webcore-fonts and webcore-fonts-vista (with Microsoft TTF + Callibri, Consolas etc) packages from here and here - just download the RPMs meant for openSUSE Leap 15 and install them.

Install the adobe-source-code-pro-fonts RPM

Enable the rpmfusion-free repo and install the freetype-freeworld package.

Create /etc/fonts/local.conf and put in the following:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <match target="pattern">
    <test compare="eq" name="family" qual="any">
      <string>Arial</string>
    </test>
    <edit binding="same" mode="assign" name="family">
      <string>Noto Sans</string>
    </edit>
  </match>
  <match target="pattern">
    <edit name="dpi" mode="assign">96</edit>
  </match>
  <match target="font">
    <edit mode="assign" name="antialias" >
      <bool>true</bool>
    </edit>
  </match>
  <match target="font">
    <edit mode="assign" name="hinting" >
      <bool>true</bool>
    </edit>
  </match>
  <match target="font">
    <edit mode="assign" name="hintstyle" >
      <const>hintslight</const>
    </edit>
  </match>
  <match target="font">
    <edit mode="assign" name="rgba" >
      <const>rgb</const>
    </edit>
  </match>
  <match target="font">
    <edit mode="assign" name="lcdfilter">
      <const>lcddefault</const>
    </edit>
  </match>
  <alias binding="strong">
    <family>sans-serif</family>
    <prefer>
      <family>Open Sans</family>
    </prefer>
  </alias>
  <alias binding="strong">
    <family>serif</family>
    <prefer>
      <family>Bitstream Charter</family>
    </prefer>
  </alias>
  <alias binding="strong">
    <family>monospace</family>
    <prefer>
      <family>Source Code Pro</family>
    </prefer>
  </alias>
</fontconfig>

Reboot the computer and you are good to go.

Some of the details are from https://esc.sh/blog/fix-ugly-fonts-in-fedora/