Fontconfig: Difference between revisions

From Alpine Linux
(New article: extracted from sway)
 
(Add category desktop)
 
Line 34: Line 34:


A list of installed can be obtained with fonts with <code>fc-list</code>.
A list of installed can be obtained with fonts with <code>fc-list</code>.
[[Category:Desktop]]

Latest revision as of 21:09, 2 June 2024

The default font for most applications is configured via fontconfig. See man 5 fonts-conf for details.

The following example changes the default sans-serif, serif and monospace fonts:

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'urn:fontconfig:fonts.dtd'>
<fontconfig>
  <!-- Default fonts -->
  <alias binding="same">
    <family>sans-serif</family>
    <prefer>
      <family>DejaVu Sans</family>
    </prefer>
  </alias>
  <alias binding="same">
    <family>serif</family>
    <prefer>
      <family>DejaVu Serif</family>
    </prefer>
  </alias>
  <alias binding="same">
    <family>monospace</family>
    <prefer>
      <family>DejaVu Sans Mono</family>
    </prefer>
  </alias>
</fontconfig>

To change default font selection system wide, copy the above into /etc/fonts/conf.d/52-my-default-fonts.conf.

To change default font selection for a single user, copy the above into $HOME/.config/fontconfig/conf.d/52-my-default-fonts.conf.

A list of installed can be obtained with fonts with fc-list.