Fontconfig

From Alpine Linux

Fontconfig is a library for configuring and customizing font access. This page documents how to change default font for most applications using fontconfig. Fonts page lists all the font packages available in Alpine Linux.

Installation

Install the fontconfig package.

Configuration

A list of installed can be obtained with fonts with the command:

fc-list

The below example changes the default fonts for sans-serif, serif and monospace fonts to dejavu-fonts, a font family based on the Bitstream Vera Fonts with a wider range of characters. So Install the font-dejavu package, if not available already.

To change default font selection for a single user, create a file $HOME/.config/fontconfig/conf.d/52-my-default-fonts.conf as shown:

Contents of $HOME/.config/fontconfig/conf.d/52-my-default-fonts.conf

<?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 for system wide, copy the above contents to the file /etc/fonts/conf.d/52-my-default-fonts.conf.

See man 5 fonts-conf for more details.

See also

Fonts