Difference between revisions of "Improve Font Rendering"

From Manjaro
Jump to navigation Jump to search
m (Clarification)
(Added more context to true type interpreter setting and properly formatted content)
Line 9: Line 9:
 
  sudo nano /etc/fonts/local.conf
 
  sudo nano /etc/fonts/local.conf
  
Paste the following content in the file-
+
Paste the following content in the file
  
 
  <match target="font">
 
  <match target="font">
 
   <edit name="autohint" mode="assign">
 
   <edit name="autohint" mode="assign">
 +
    <bool>false</bool>
 +
  </edit>
 +
  <edit name="hinting" mode="assign">
 
     <bool>true</bool>
 
     <bool>true</bool>
 
   </edit>
 
   </edit>
   <edit name="hinting" mode="assign">
+
   <edit name="antialias" mode="assign">
 
     <bool>true</bool>
 
     <bool>true</bool>
 
   </edit>
 
   </edit>
 
   <edit mode="assign" name="hintstyle">
 
   <edit mode="assign" name="hintstyle">
 
     <const>hintslight</const>
 
     <const>hintslight</const>
 +
  </edit>
 +
  <edit mode="assign" name="rgba">
 +
    <const>rgb</const>
 
   </edit>
 
   </edit>
 
   <edit mode="assign" name="lcdfilter">
 
   <edit mode="assign" name="lcdfilter">
    <const>lcddefault</const>
+
    <const>lcddefault</const>
  </edit>
+
  </edit>
 
  </match>
 
  </match>
  
Line 32: Line 38:
 
  cp ~/.Xresources ~/.Xresources.bak
 
  cp ~/.Xresources ~/.Xresources.bak
  
If the .Xresources file has not been already created and you get the error -
+
If the .Xresources file has not been already created and you get the error
  
 
'''''"cp: cannot stat ‘~/.Xresources’: No such file or directory"''''', then skip to step No. 3.
 
'''''"cp: cannot stat ‘~/.Xresources’: No such file or directory"''''', then skip to step No. 3.
Line 53: Line 59:
  
  
''4.Run the following command in terminal:''
+
''4. Run the following command in terminal:''
 
  xrdb -merge ~/.Xresources
 
  xrdb -merge ~/.Xresources
  
  
5.Make sure that ''Anti aliasing is '''On''', and  Hiting is set to '''Slight''''' in System Settings (Appearence).
+
''5. Make sure that ''Anti aliasing is '''On''', Hinting is set to '''Slight'''''  and RGBA (subpixel) order is set to '''rgb''' in System Settings (Appearence).''
 +
 
 +
 
 +
''6. Create symbolic links with some available presets from /etc/fonts/conf.avail/ to /etc/fonts/conf.d/''
 +
 
 +
sudo ln -s  /etc/fonts/conf.avail/10-sub-pixel-rgb.conf /etc/fonts/conf.d/
 +
 
 +
sudo ln -s  /etc/fonts/conf.avail/11-lcdfilter-default.conf /etc/fonts/conf.d/
 +
 
 +
 
 +
''7. Set truetype interpreter version to infinality mode (optional)''
 +
 
 +
sudo nano /etc/profile.d/freetype2.sh
 +
 
 +
Edit content of the file to reflect setting below
  
 +
# Subpixel hinting mode can be chosen by setting the right TrueType interpreter
 +
# version. The available settings are:
 +
#
 +
# truetype:interpreter-version=35 # Classic mode (default in 2.6)
 +
# truetype:interpreter-version=38 # Infinality mode
 +
# truetype:interpreter-version=40 # Minimal mode (default in 2.7)
 +
#
 +
# There are more properties that can be set, separated by whitespace. Please
 +
# refer to the FreeType documentation for details.
 +
 +
# Uncomment and configure below
 +
 +
export FREETYPE_PROPERTIES="truetype:interpreter-version=38"
  
Finally reboot your computer to apply the settings.
 
  
 +
''8. Finally reboot your computer to apply the settings.''
  
 
=See Also=
 
=See Also=

Revision as of 05:16, 9 April 2021

How to improve font rendering with your installed fonts

A little configuration maybe required to render the fonts in an optimal manner. Follow the steps illustrated below.


1. Create the file /etc/fonts/local.conf

sudo nano /etc/fonts/local.conf

Paste the following content in the file

<match target="font">
  <edit name="autohint" mode="assign">
    <bool>false</bool>
  </edit>
  <edit name="hinting" mode="assign">
    <bool>true</bool>
  </edit>
  <edit name="antialias" mode="assign">
    <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="lcdfilter">
    <const>lcddefault</const>
  </edit>
</match>

After that save the file.


2. Create backup of ~/.Xresources file:

cp ~/.Xresources ~/.Xresources.bak

If the .Xresources file has not been already created and you get the error

"cp: cannot stat ‘~/.Xresources’: No such file or directory", then skip to step No. 3.


3. Open/Create ~/.Xresources file in text editor:

nano ~/.Xresources

If the following is not already present, paste at the end of the file or edit existing values:

Xft.dpi: 96
Xft.antialias: true
Xft.hinting: true
Xft.rgba: rgb
Xft.autohint: false
Xft.hintstyle: hintslight
Xft.lcdfilter: lcddefault

Save changes to the file.


4. Run the following command in terminal:

xrdb -merge ~/.Xresources


5. Make sure that Anti aliasing is On, Hinting is set to Slight and RGBA (subpixel) order is set to rgb in System Settings (Appearence).


6. Create symbolic links with some available presets from /etc/fonts/conf.avail/ to /etc/fonts/conf.d/

sudo ln -s  /etc/fonts/conf.avail/10-sub-pixel-rgb.conf /etc/fonts/conf.d/
sudo ln -s  /etc/fonts/conf.avail/11-lcdfilter-default.conf /etc/fonts/conf.d/


7. Set truetype interpreter version to infinality mode (optional)

sudo nano /etc/profile.d/freetype2.sh

Edit content of the file to reflect setting below

# Subpixel hinting mode can be chosen by setting the right TrueType interpreter
# version. The available settings are:
#
# truetype:interpreter-version=35 # Classic mode (default in 2.6)
# truetype:interpreter-version=38 # Infinality mode
# truetype:interpreter-version=40 # Minimal mode (default in 2.7)
#
# There are more properties that can be set, separated by whitespace. Please
# refer to the FreeType documentation for details.

# Uncomment and configure below

export FREETYPE_PROPERTIES="truetype:interpreter-version=38"


8. Finally reboot your computer to apply the settings.

See Also

The Arch Wiki