Manjaro Difference between revisions of "Improve Font Rendering"

Difference between revisions of "Improve Font Rendering"

From Manjaro
m (added languages and translate tags)
(Marked this version for translation)
Line 2: Line 2:
__TOC__
__TOC__
<translate>
<translate>
===How to improve font rendering with your installed fonts===
===How to improve font rendering with your installed fonts=== <!--T:1-->


<!--T:2-->
A little configuration maybe required to render the fonts in an optimal manner. Follow the steps illustrated below.
A little configuration maybe required to render the fonts in an optimal manner. Follow the steps illustrated below.




<!--T:3-->
''1. Create the global fontconfig setting file /etc/fonts/local.conf''
''1. Create the global fontconfig setting file /etc/fonts/local.conf''


  sudo nano /etc/fonts/local.conf
  <!--T:4-->
sudo nano /etc/fonts/local.conf


<!--T:5-->
Paste the following content in the file
Paste the following content in the file


  <?xml version="1.0"?>
  <!--T:6-->
<?xml version="1.0"?>
  <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
  <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
  <fontconfig>
  <fontconfig>
Line 39: Line 44:




<!--T:7-->
After that save the file.
After that save the file.




<!--T:8-->
''2. Create backup of ~/.Xresources file:''
''2. Create backup of ~/.Xresources file:''
  cp ~/.Xresources ~/.Xresources.bak
  cp ~/.Xresources ~/.Xresources.bak


<!--T:9-->
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


<!--T:10-->
'''''"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.




<!--T:11-->
''3. Open/Create ~/.Xresources file in text editor:''
''3. Open/Create ~/.Xresources file in text editor:''
  nano ~/.Xresources
  nano ~/.Xresources


<!--T:12-->
If the following is not already present, paste at the end of the file or edit existing values:
If the following is not already present, paste at the end of the file or edit existing values:


  Xft.antialias: 1
  <!--T:13-->
Xft.antialias: 1
  Xft.hinting: 1
  Xft.hinting: 1
  Xft.autohint: 0
  Xft.autohint: 0
Line 62: Line 74:
  Xft.lcdfilter: lcddefault
  Xft.lcdfilter: lcddefault


<!--T:14-->
Save changes to the file.
Save changes to the file.




<!--T:15-->
''4. Run the following command in terminal:''
''4. Run the following command in terminal:''
  xrdb -merge ~/.Xresources
  xrdb -merge ~/.Xresources




<!--T:16-->
''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).''
''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).''




<!--T:17-->
''6. Create symbolic links with some available presets from /usr/share/fontconfig/conf.avail/ to /etc/fonts/conf.d/''
''6. Create symbolic links with some available presets from /usr/share/fontconfig/conf.avail/ to /etc/fonts/conf.d/''


  sudo ln -s  /usr/share/fontconfig/conf.avail/10-sub-pixel-rgb.conf /etc/fonts/conf.d/
  <!--T:18-->
sudo ln -s  /usr/share/fontconfig/conf.avail/10-sub-pixel-rgb.conf /etc/fonts/conf.d/


  sudo ln -s  /usr/share/fontconfig/conf.avail/11-lcdfilter-default.conf /etc/fonts/conf.d/
  <!--T:19-->
sudo ln -s  /usr/share/fontconfig/conf.avail/11-lcdfilter-default.conf /etc/fonts/conf.d/




<!--T:20-->
''7. Set preferred serif, sans-serif and monospace fonts (optional)''
''7. Set preferred serif, sans-serif and monospace fonts (optional)''


<!--T:21-->
Create local fontconfig folder and setting file
Create local fontconfig folder and setting file


  mkdir -p ~/.config/fontconfig/
  <!--T:22-->
mkdir -p ~/.config/fontconfig/


  nano ~/.config/fontconfig/fonts.conf
  <!--T:23-->
nano ~/.config/fontconfig/fonts.conf


<!--T:24-->
Paste the following content in the file
Paste the following content in the file


  <?xml version="1.0"?>
  <!--T:25-->
<?xml version="1.0"?>
  <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
  <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
  <fontconfig>
  <fontconfig>
Line 132: Line 156:




<!--T:26-->
''8. Finally rebuild fontconfig cache and reboot your computer to apply the settings.''
''8. Finally rebuild fontconfig cache and reboot your computer to apply the settings.''


  sudo fc-cache -fv
  <!--T:27-->
sudo fc-cache -fv


=See Also=
=See Also= <!--T:28-->




<!--T:29-->
[https://wiki.archlinux.org/index.php/Font_Configuration The Arch Wiki]
[https://wiki.archlinux.org/index.php/Font_Configuration The Arch Wiki]


</translate>
</translate>
[[Category:Contents Page{{#translation:}}]]
[[Category:Contents Page{{#translation:}}]]

Revision as of 17:36, 7 September 2021

Other languages:
English • ‎Türkçe • ‎русский

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 global fontconfig setting file /etc/fonts/local.conf

sudo nano /etc/fonts/local.conf

Paste the following content in the file

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <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>
</fontconfig>


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.antialias: 1
Xft.hinting: 1
Xft.autohint: 0
Xft.rgba: rgb
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 /usr/share/fontconfig/conf.avail/ to /etc/fonts/conf.d/

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


7. Set preferred serif, sans-serif and monospace fonts (optional)

Create local fontconfig folder and setting file

mkdir -p ~/.config/fontconfig/
nano ~/.config/fontconfig/fonts.conf

Paste the following content in the file

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <alias>
    <family>serif</family>
    <prefer>
      <family>Liberation Serif</family>
    </prefer>
  </alias>
  <alias>
    <family>sans-serif</family>
    <prefer>
      <family>Liberation Sans</family>
    </prefer>
  </alias>
  <alias>
    <family>sans</family>
    <prefer>
      <family>Liberation Sans</family>
    </prefer>
  </alias>
  <alias>
    <family>monospace</family>
    <prefer>
      <family>Liberation Mono</family>
    </prefer>
  </alias>
  <alias>
    <family>mono</family>
    <prefer>
      <family>Liberation Mono</family>
    </prefer>
  </alias>
  <alias>
    <family>system-ui</family>
    <prefer>
      <family>Liberation Sans</family>
    </prefer>
  </alias>
</fontconfig>


8. Finally rebuild fontconfig cache and reboot your computer to apply the settings.

sudo fc-cache -fv

See Also

The Arch Wiki

Cookies help us deliver our services. By using our services, you agree to our use of cookies.