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" />
18 <xsl:param name=
"impureFontDirectories" />
19 <xsl:param name=
"includes" />
21 <xsl:template match=
"/fontconfig">
24 <xsl:apply-templates select=
"child::node()[name() != 'dir' and name() != 'cachedir' and name() != 'include']" />
26 <!-- the first cachedir will be used to store the cache -->
27 <cachedir prefix=
"xdg">fontconfig
</cachedir>
28 <xsl:text>
</xsl:text>
29 <!-- /var/cache/fontconfig is useful for non-nixos systems -->
30 <cachedir>/var/cache/fontconfig
</cachedir>
31 <xsl:text>
</xsl:text>
33 <!-- system-wide config -->
34 <xsl:for-each select=
"str:tokenize($includes)">
35 <include ignore_missing=
"yes"><xsl:value-of select=
"." /></include>
36 <xsl:text>
</xsl:text>
39 <dir prefix=
"xdg">fonts
</dir>
40 <xsl:text>
</xsl:text>
41 <xsl:for-each select=
"str:tokenize($fontDirectories)">
42 <dir><xsl:value-of select=
"." /></dir>
43 <xsl:text>
</xsl:text>
46 <xsl:for-each select=
"str:tokenize($impureFontDirectories)">
47 <dir><xsl:value-of select=
"." /></dir>
48 <xsl:text>
</xsl:text>
56 <!-- New fontconfig >=2.11 doesn't like xml:space added by xsl:copy-of -->
57 <xsl:template match=
"node()|@*">
59 <xsl:apply-templates select=
"node()|@*[name() != 'xml:space']"/>