Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Howto: Improve font rendering

Share your HowTo, Documentation, Tips and Tricks. Not for support questions!.
Post Reply
Message
Author
User avatar
Hallvor
Global Moderator
Global Moderator
Posts: 2029
Joined: 2009-04-16 18:35
Location: Kristiansand, Norway
Has thanked: 139 times
Been thanked: 206 times

Howto: Improve font rendering

#1 Post by Hallvor »

What's wrong with the default font rendering?
If you like the default one, then nothing. But people have different preferences... For those of you than have been around for a while, there is probably not much to learn here. This is mainly targeted at beginners.

Fonts.conf
We will make a hidden .fonts.conf configuration file in the home directory. These settings will be loaded on each boot. (To remove these configurations, simply delete the file.)

Create the file as regular user in your home directory:

Code: Select all

nano .fonts.conf
Copy and paste the following content:

Code: Select all

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
 <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>hintslight</const>
  </edit>
 </match>
 <match target="font">
  <edit mode="assign" name="antialias">
   <bool>true</bool>
  </edit>
 </match>
  <match target="font">
  <edit mode="assign" name="lcdfilter">
    <const>lcddefault</const>
  </edit>
  </match>
</fontconfig> 
Save with Ctrl + X, and then Y to exit.

Better font rendering in the web browser
Your web browser may be configured to let all web pages use their own fonts. Some pages may render very well, while others may look pretty bad.

In order to fix this issue, you may want to install the following fonts (as root):

Code: Select all

apt-get install ttf-freefont ttf-mscorefonts-installer ttf-bitstream-vera ttf-dejavu ttf-liberation
All done! After a reboot, you should have better font rendering.

The image below is enlarged, so the fonts look sharper on my screen:
Image
Last edited by Hallvor on 2018-02-03 09:06, edited 2 times in total.
[HowTo] Install and configure Debian bookworm
Debian 12 | KDE Plasma | ThinkPad T440s | 4 × Intel® Core™ i7-4600U CPU @ 2.10GHz | 12 GiB RAM | Mesa Intel® HD Graphics 4400 | 1 TB SSD

Bulkley
Posts: 6383
Joined: 2006-02-11 18:35
Has thanked: 2 times
Been thanked: 39 times

Re: Howto: Improve font rendering

#2 Post by Bulkley »

Question, should it be .fonts.conf or .config/fontconfig/fonts.conf ?

User avatar
Hallvor
Global Moderator
Global Moderator
Posts: 2029
Joined: 2009-04-16 18:35
Location: Kristiansand, Norway
Has thanked: 139 times
Been thanked: 206 times

Re: Howto: Improve font rendering

#3 Post by Hallvor »

All of these should work:

/etc/fonts/fonts.conf
/etc/fonts/fonts.dtd
/etc/fonts/conf.d
$XDG_CONFIG_HOME/fontconfig/conf.d
$XDG_CONFIG_HOME/fontconfig/fonts.conf
~/.fonts.conf.d
~/.fonts.conf

Source: https://www.freedesktop.org/software/fo ... -user.html
[HowTo] Install and configure Debian bookworm
Debian 12 | KDE Plasma | ThinkPad T440s | 4 × Intel® Core™ i7-4600U CPU @ 2.10GHz | 12 GiB RAM | Mesa Intel® HD Graphics 4400 | 1 TB SSD

User avatar
pawRoot
Posts: 603
Joined: 2016-12-28 18:26
Has thanked: 1 time
Been thanked: 1 time

Re: Howto: Improve font rendering

#4 Post by pawRoot »

Didn't test your config but i just FINALLY discovered a way for perfect fonts, a bit different
than yours but anyway...

Code: Select all

apt install -y fontconfig fonts-noto ttf-dejavu ttf-liberation
create /etc/fonts/local.conf

Code: Select all

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
    <match>
        <edit mode="prepend" name="family"><string>Noto Sans</string></edit>
    </match>
    <match target="pattern">
        <test qual="any" name="family"><string>serif</string></test>
        <edit name="family" mode="assign" binding="same"><string>Noto Serif</string></edit>
    </match>
    <match target="pattern">
        <test qual="any" name="family"><string>sans-serif</string></test>
        <edit name="family" mode="assign" binding="same"><string>Noto Sans</string></edit>
    </match>
    <match target="pattern">
        <test qual="any" name="family"><string>monospace</string></test>
        <edit name="family" mode="assign" binding="same"><string>Noto Mono</string></edit>
    </match>
</fontconfig>
create .gtkrc-2.0 in your home directory or just modify it if it exist:

Code: Select all

gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle="hintslight"
gtk-xft-rgba="rgb"
same about .config/gtk-3.0/settings.ini

Code: Select all

gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle=hintslight
gtk-xft-rgba=rgb
and my ~/.Xresources

Code: Select all

Xft.autohint: 1
Xft.antialias: 1
Xft.hinting: true
Xft.hintstyle: hintslight
Xft.rgba: rgb
Xft.lcdfilter: lcddefault

Code: Select all

sudo ln -s /etc/fonts/conf.avail/10-sub-pixel-rgb.conf /etc/fonts/conf.d
Although i am not sure if you need to edit those 3 files above if you have fontconfig,
so would be nice if someone experienced could confirm.

I will post screenshot soon
Last edited by pawRoot on 2018-02-03 13:14, edited 1 time in total.

User avatar
pawRoot
Posts: 603
Joined: 2016-12-28 18:26
Has thanked: 1 time
Been thanked: 1 time

Re: Howto: Improve font rendering

#5 Post by pawRoot »

Here is how they look:

Image

Post Reply