Smooth font rendering

Hi,

Some Linux distributions seem to have a smoother font rendering in their default setup. I can think of all the Ubuntus and spinoffs like KDE Neon, then also Gecko Linux, and some others.

Does anybody know how what this is exactly under the hood, how it is achieved and if I can have the same configuration on my Rocky Linux 8 + KDE desktop ?

Thanks,

Niki

Some people have had luck with the qt5ct package. Another option would be to create a “.fonts.conf” file in their home folder and defining stuff like seek and rgba to get their desired outcome. Body of the file would contain:

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
 <dir>~/.fonts</dir>
 
  <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="autohint">
   <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="lcdfilter">
   <int>2</int>
  </edit> 
 </match>
 
</fontconfig>

Good luck!

1 Like

Even if you get it working generally, any Java apps using Swing are likely to give you grief.

I got/have Netbeans to a reasonable state on 8.4 but can’t find/remember some piece of the puzzle to get it completely right on new instance of 8.6

Java - “Write once run anywhere” … as long as its on Windows. (Sun ****** ****ers)

I gave this a try, but I don’t see any noticeable difference.

D’you run fc-cache after you made the changes ?

There is no great difference between them. But if you get it working generally, any Java apps using Swing are likely to give you grief. I got/have Net beans to a reasonable state on 8.4 but can’t find/remember some piece of the puzzle to get it completely right on new instance of 8.6

I’ve moved from 8.4 / KDE 5.18 (LTS) to 8.6 / KDE 5.23 (only version on the 8.6 epel repo) so that might explain some of my font woes … AND 5.23 ain’t supported / waiting for KDE 5.24 (LTS) in epel or I get around to building my own “extras”…

Anyhow, not using any Microsoft fonts in my 8.6 instance. I found this font useful and use Liberation Sans for desktop:

which I think looks reasonable

I do it with:

kdeglobals='/usr/share/kde-settings/kde-profile/default/xdg/kdeglobals'

kwriteconfig5 --file "$kdeglobals" --group KDE --key ShowDeleteCommand true   # dolphin delete menu option
kwriteconfig5 --file "$kdeglobals" --group KDE --key SingleClick       false  # do not launch on single click
kwriteconfig5 --file "$kdeglobals" --group KDE --key widgetStyle       Breeze  

kwriteconfig5 --file "$kdeglobals" --group WM      --key activeFont           'Liberation Sans,10,-1,5,50,0,0,0,0,0' 
kwriteconfig5 --file "$kdeglobals" --group General --key ColorScheme          BreezeLight 
kwriteconfig5 --file "$kdeglobals" --group General --key XftHintStyle         hintslight 
kwriteconfig5 --file "$kdeglobals" --group General --key XftSubPixel          rgb 
kwriteconfig5 --file "$kdeglobals" --group General --key fixed                'Liberation Mono,10,-1,5,50,0,0,0,0,0' 
kwriteconfig5 --file "$kdeglobals" --group General --key font                 'Liberation Sans,10,-1,5,50,0,0,0,0,0' 
kwriteconfig5 --file "$kdeglobals" --group General --key menuFont             'Liberation Sans,10,-1,5,50,0,0,0,0,0' 
kwriteconfig5 --file "$kdeglobals" --group General --key smallestReadableFont 'Liberation Sans,8,-1,5,50,0,0,0,0,0' 
kwriteconfig5 --file "$kdeglobals" --group General --key toolBarFont          'Liberation Sans,10,-1,5,50,0,0,0,0,0'

RHEL 8 does not turn on freetype’s lcdfilter by default. You can try this with

sudo ln -s /usr/share/fontconfig/conf.avail/11-lcdfilter-default.conf /etc/fonts/conf.d/

Then log out of KDE and in again.

1 Like

Another option would be to use the “fonts-tweak-tool” as it offers stuff like antialiasing and the like.