Fontconfig: Difference between revisions

From Alpine Linux
(Add category desktop)
(changed category, added wikilinks, headings, wikitags)
 
Line 1: Line 1:
The default font for most applications is configured via {{Pkg|fontconfig}}. See <code>man 5 fonts-conf</code> for details.
[https://www.freedesktop.org/wiki/Software/fontconfig/ 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.


The following example changes the default <code>sans-serif</code>, <code>serif</code> and <code>monospace</code> fonts:
== Installation ==


<pre>
[[Install]] the {{Pkg|fontconfig}} package.
<?xml version='1.0'?>
 
== Configuration ==
 
A list of installed can be obtained with fonts with the command:{{Cmd|fc-list}}
 
The below example changes the default fonts for <code>sans-serif</code>, <code>serif</code> and <code>monospace</code> fonts to [https://dejavu-fonts.github.io/ dejavu-fonts], a font family based on the Bitstream Vera Fonts with a wider range of characters. So [[Install]] the {{Pkg|font-dejavu}} package, if not available already.
 
To change default font selection for a single user, create a file {{Path|$HOME/.config/fontconfig/conf.d/52-my-default-fonts.conf}} as shown:{{Cat|$HOME/.config/fontconfig/conf.d/52-my-default-fonts.conf|<nowiki><?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'urn:fontconfig:fonts.dtd'>
<!DOCTYPE fontconfig SYSTEM 'urn:fontconfig:fonts.dtd'>
<fontconfig>
<fontconfig>
Line 26: Line 33:
     </prefer>
     </prefer>
   </alias>
   </alias>
</fontconfig>
</fontconfig></nowiki>}}
</pre>
 
 
To change default font selection for system wide, copy the above contents to the file {{Path|/etc/fonts/conf.d/52-my-default-fonts.conf}}.


To change default font selection system wide, copy the above into <code>/etc/fonts/conf.d/52-my-default-fonts.conf</code>.
See <code>man 5 fonts-conf</code> for more details.


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


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


[[Category:Desktop]]
[[Category:Infographics]]

Latest revision as of 05:51, 19 March 2025

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