[suggestion] Enhance font rendering

I would suggest adding the following into ~/.config/fontconfig/fonts.conf or in the corresponding place for all users:

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

<!-- Set preferred serif, sans serif, and monospace fonts. -->
    <alias>
        <family>serif</family>
        <prefer>
            <family>Droid Serif</family>
        </prefer>
    </alias>
    <alias>
        <family>sans-serif</family>
        <prefer>
            <family>Droid Sans</family>
        </prefer>
    </alias>
    <alias>
        <family>sans</family>
        <prefer>
            <family>Droid Sans</family>
        </prefer>
    </alias>
    <alias>
        <family>monospace</family>
        <prefer>
            <family>Droid Sans Mono</family>
        </prefer>
    </alias>
    <alias>
        <family>mono</family>
        <prefer>
            <family>Droid Sans Mono</family>
        </prefer>
    </alias>

</fontconfig>

This greatly improved font rendering of my fresh EndeavourOS XFCE install so I thought it may benefit more users.

1 Like

those font rendering settings heavily depend on the individual screen.
What looks great on your screen might look broken on another screen. That’s why I think that its best to not set a config as default. Most DE’s have their own default and GUI to change those settings. (For me, KDE’s default works best on most screens)

2 Likes

As far as fonts go, here are some things that most users would probably like:

  • Remove opendesktop-fonts from the base install; this package overrides the CJK fonts from Noto, and they look fine at larger sizes, but pixelated at smaller sizes.
  • Configure Noto Color Emoji or Twemoji or Joypixel in /etc/fonts/local.conf, so that emojis look consistent.
  • Maybe for the offline XFCE install, just maybe, set the font to something like Roboto or Cantarell. Very opinionated this is.
1 Like

Recently I stumbled upon the “Better fonts for Fedora” project on GitHub[1] and I thought putting my notes here to help folks interested in enhancing default font rendering even more.

So, I installed libertinus-font , ttf-croscore, noto-fonts-emoji, and ttf-ubuntu-font-family, then replaced the above ~/.config/fontconfig/fonts.conf with the following one:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>

<!-- 19-enhanced-defaults.conf  -->
    <match target="font">
        <edit name="antialias" mode="assign">
            <bool>true</bool>
        </edit>
        <edit name="autohint" mode="assign">
            <bool>false</bool>
        </edit>
        <edit name="hinting" mode="assign">
            <bool>true</bool>
        </edit>
        <edit name="hintstyle" mode="assign">
            <const>hintslight</const>
        </edit>
        <edit name="lcdfilter" mode="assign">
            <const>lcddefault</const>
        </edit>
        <edit name="rgba" mode="assign">
            <const>rgb</const>
        </edit>
    </match>

<!-- 36-repl-liberation-fonts.conf -->
  <!-- Replace Liberation fonts with ChromeOS fonts since Fedora
       ships with very outdated version of Liberation fonts that
       doesn't render well.
       ChromiumOS fonts are basically updated versions of Liberation
       fonts so there should be no visual difference -->

  <!-- Liberation Mono => Cousine -->
  <match target="font">
    <test name="family">
      <string>Liberation Mono</string>
    </test>
    <edit name="family" mode="assign">
      <string>Cousine</string>
    </edit>
  </match>
  <match target="pattern">
    <test name="family">
      <string>Liberation Mono</string>
    </test>
    <edit name="family" mode="prepend" binding="strong">
      <string>Cousine</string>
    </edit>
  </match>

  <!-- Liberation Sans => Arimo -->
  <match target="font">
    <test name="family">
      <string>Liberation Sans</string>
    </test>
    <edit name="family" mode="assign">
      <string>Arimo</string>
    </edit>
  </match>
  <match target="pattern">
    <test name="family">
      <string>Liberation Sans</string>
    </test>
    <edit name="family" mode="prepend" binding="strong">
      <string>Arimo</string>
    </edit>
  </match>

  <!-- Liberation Serif => Tinos -->
  <match target="font">
    <test name="family">
      <string>Liberation Serif</string>
    </test>
    <edit name="family" mode="assign">
      <string>Tinos</string>
    </edit>
  </match>
  <match target="pattern">
    <test name="family">
      <string>Liberation Serif</string>
    </test>
    <edit name="family" mode="prepend" binding="strong">
      <string>Tinos</string>
    </edit>
  </match>

<!-- 52-latin-free.conf -->
  <!-- ## Free default Latin type-faces. ## -->

  <!-- ## serif ## -->
  <alias>
    <family>serif</family>
    <prefer>
      <family>Noto Serif</family>
      <family>DejaVu Serif</family>
      <family>Tinos</family>
      <family>Liberation Serif</family>
      <family>Nimbus Roman</family>
    </prefer>
  </alias>
  <!-- ## sans-serif ## -->
  <alias>
    <family>sans-serif</family>
    <prefer>
      <family>Noto Sans</family>
      <family>Arimo</family>
      <family>Liberation Sans</family>
      <family>DejaVu Sans</family>
      <family>Nimbus Sans</family>
      <family>Open Sans</family>
    </prefer>
  </alias>
  <!-- ## monospace ## -->
  <alias>
    <family>monospace</family>
    <prefer>
      <family>Cousine</family>
      <family>DejaVu Sans Mono</family>
      <family>Noto Mono</family>
      <family>Nimbus Mono</family>
      <family>Liberation Mono</family>
      <family>Courier</family>
    </prefer>
  </alias>
  <!-- ## fantasy ## -->
  <alias>
    <family>fantasy</family>
    <prefer>
      <family>Passion One</family>
    </prefer>
  </alias>
  <!-- ## cursive ## -->
  <alias>
    <family>cursive</family>
    <prefer>
      <family>Komika Sans</family>
      <family>Signika</family>
    </prefer>
  </alias>

</fontconfig>

Now I am much more pleased by the font rendering in EndeavourOS :slight_smile:

Cheers!

[1] https://github.com/silenc3r/fedora-better-fonts

1 Like