4 This script copies the original fonts.conf from the fontconfig
5 distribution, but replaces all <dir> entries with the directories
6 specified in the $fontDirectories parameter.
9 <xsl:stylesheet version=
"1.0"
10 xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
11 xmlns:
str=
"http://exslt.org/strings"
12 extension-element-prefixes=
"str"
15 <xsl:output method='xml'
encoding=
"UTF-8" doctype-system=
"urn:fontconfig:fonts.dtd" />
17 <xsl:param name=
"fontDirectories" />
19 <xsl:template match=
"/fontconfig">
22 <xsl:apply-templates select=
"child::node()[name() != 'dir' and name() != 'cachedir' and name() != 'include']" />
24 <!-- the first cachedir will be used to store the cache -->
25 <cachedir prefix=
"xdg">fontconfig
</cachedir>
26 <!-- /var/cache/fontconfig is useful for non-nixos systems -->
27 <cachedir>/var/cache/fontconfig
</cachedir>
29 <!-- system-wide config -->
30 <include ignore_missing=
"yes">/etc/fonts/conf.d
</include>
32 <dir prefix=
"xdg">fonts
</dir>
33 <xsl:for-each select=
"str:tokenize($fontDirectories)">
34 <dir><xsl:value-of select=
"." /></dir>
35 <xsl:text>
</xsl:text>
38 <!-- nix user profile -->
39 <dir>~/.nix-profile/lib/X11/fonts
</dir>
40 <dir>~/.nix-profile/share/fonts
</dir>
42 <!-- FHS paths for non-NixOS platforms -->
43 <dir>/usr/share/fonts
</dir>
44 <dir>/usr/local/share/fonts
</dir>
46 <!-- nix default profile -->
47 <dir>/nix/var/nix/profiles/default/lib/X11/fonts
</dir>
48 <dir>/nix/var/nix/profiles/default/share/fonts
</dir>
55 <!-- New fontconfig >=2.11 doesn't like xml:space added by xsl:copy-of -->
56 <xsl:template match=
"node()|@*">
58 <xsl:apply-templates select=
"node()|@*[name() != 'xml:space']"/>