Fontconfig

From Alpine Linux
Revision as of 21:09, 2 June 2024 by WhyNotHugo (talk | contribs) (Add category desktop)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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.