Manjaro Difference between revisions of "Improve Font Rendering"

Difference between revisions of "Improve Font Rendering"

From Manjaro
m (Changed path - conf.avail)
m (Fixed mismatched tag in font configuration given in 1st point)
Tags: Mobile web edit Mobile edit
 
(9 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<languages/>
__TOC__
<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.




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


  sudo nano /etc/fonts/local.conf
<!--T:4-->
  {{UserCmd|command=sudo nano /etc/fonts/local.conf}}


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


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


<!--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
  {{UserCmd|command=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
  {{UserCmd|command=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.dpi: 96
<!--T:13-->
  Xft.antialias: true
  Xft.antialias: 1
  Xft.hinting: true
  Xft.hinting: 1
  Xft.rgba: rgb
  Xft.rgba: rgb
Xft.autohint: false
  Xft.hintstyle: hintslight
  Xft.hintstyle: hintslight
  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
  {{UserCmd|command=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).''
<!--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 (Appearance).''




<!--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-->
  {{UserCmd|command=sudo ln -s  /usr/share/fontconfig/conf.avail/10-sub-pixel-rgb.conf /etc/fonts/conf.d/}}
 
<!--T:19-->
{{UserCmd|command=sudo ln -s  /usr/share/fontconfig/conf.avail/10-hinting-slight.conf /etc/fonts/conf.d/}}
 
<!--T:20-->
{{UserCmd|command=sudo ln -s  /usr/share/fontconfig/conf.avail/11-lcdfilter-default.conf /etc/fonts/conf.d/}}
 


sudo ln -s  /usr/share/fontconfig/conf.avail/11-lcdfilter-default.conf /etc/fonts/conf.d/
<!--T:21-->
''7. Set preferred serif, sans-serif and monospace fonts (optional)''


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


''7. Set truetype interpreter version to infinality mode (optional)''
<!--T:23-->
{{UserCmd|command=mkdir -p ~/.config/fontconfig/}}


  sudo nano /etc/profile.d/freetype2.sh
<!--T:24-->
  {{UserCmd|command=nano ~/.config/fontconfig/fonts.conf}}


Edit content of the file to reflect setting below
<!--T:25-->
Paste the following content in the file


# Subpixel hinting mode can be chosen by setting the right TrueType interpreter
<!--T:26-->
  # version. The available settings are:
  <?xml version="1.0"?>
  #
  <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
  # truetype:interpreter-version=35 # Classic mode (default in 2.6)
  <fontconfig>
# truetype:interpreter-version=38 # Infinality mode
  <alias>
# truetype:interpreter-version=40 # Minimal mode (default in 2.7)
    <family>serif</family>
#
    <prefer>
# There are more properties that can be set, separated by whitespace. Please
      <family>Liberation Serif</family>
# refer to the FreeType documentation for details.
    </prefer>
  </alias>
# Uncomment and configure below
  <alias>
    <family>sans-serif</family>
  export FREETYPE_PROPERTIES="truetype:interpreter-version=38"
    <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>
  </fontconfig>




''8. Finally reboot your computer to apply the settings.''


=See Also=
<!--T:27-->
''8. Finally enable freetype2 infinality mode and reboot your computer.''


<!--T:28-->
add line to end of freetype2 config file and then rebuild fontconfig cache


<!--T:29-->
{{UserCmd| command=sudo nano /etc/profile.d/freetype2.sh}}
<!--T:30-->
{{UserCmd| command=export FREETYPE_PROPERTIES="truetype:interpreter-version=38"}}
<!--T:31-->
{{UserCmd|command=sudo fc-cache -fv}}
==See Also== <!--T:32-->
<!--T:33-->
[https://wiki.archlinux.org/index.php/Font_Configuration The Arch Wiki]
[https://wiki.archlinux.org/index.php/Font_Configuration The Arch Wiki]


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

Latest revision as of 09:50, 13 January 2022

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

user $ sudo nano /etc/fonts/local.conf COPY TO CLIPBOARD


Paste the following content in the file

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


After that save the file.


2. Create backup of ~/.Xresources file:

user $ cp ~/.Xresources ~/.Xresources.bak COPY TO CLIPBOARD


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:

user $ nano ~/.Xresources COPY TO CLIPBOARD


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.rgba: rgb
Xft.hintstyle: hintslight
Xft.lcdfilter: lcddefault

Save changes to the file.


4. Run the following command in terminal:

user $ xrdb -merge ~/.Xresources COPY TO CLIPBOARD



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


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

user $ sudo ln -s /usr/share/fontconfig/conf.avail/10-sub-pixel-rgb.conf /etc/fonts/conf.d/ COPY TO CLIPBOARD


user $ sudo ln -s /usr/share/fontconfig/conf.avail/10-hinting-slight.conf /etc/fonts/conf.d/ COPY TO CLIPBOARD


user $ sudo ln -s /usr/share/fontconfig/conf.avail/11-lcdfilter-default.conf /etc/fonts/conf.d/ COPY TO CLIPBOARD



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

Create local fontconfig folder and setting file

user $ mkdir -p ~/.config/fontconfig/ COPY TO CLIPBOARD


user $ nano ~/.config/fontconfig/fonts.conf COPY TO CLIPBOARD


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>
</fontconfig>


8. Finally enable freetype2 infinality mode and reboot your computer.

add line to end of freetype2 config file and then rebuild fontconfig cache

user $ sudo nano /etc/profile.d/freetype2.sh COPY TO CLIPBOARD


user $ export FREETYPE_PROPERTIES="truetype:interpreter-version=38" COPY TO CLIPBOARD


user $ sudo fc-cache -fv COPY TO CLIPBOARD


See Also

The Arch Wiki

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