dejavu-fonts/dejavu-fonts-makedefault.xsl

52 lines
2.2 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="UTF-8"?>
<!-- Makes DejaVu fonts the fontconfig defaults
© 2003-2006 Nicolas Mailhot <nicolas.mailhot at laposte.net>
This file is distributed under the terms of the GNU General
Public License (GPL) version 2. Copies of the GPL can be obtained from:
http://www.gnu.org/licenses/gpl.html
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:strip-space elements="*"/>
<xsl:output method="xml" indent="yes" encoding="UTF-8" doctype-system="fonts.dtd"/>
<!-- Preserve most nodes -->
<xsl:template match="*" priority="0">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates select="*|text()|comment()"/>
</xsl:copy>
</xsl:template>
<!-- Preserve attributes and comments -->
<xsl:template match="@*|comment()">
<xsl:copy/>
</xsl:template>
<!-- Take care of alias priorities -->
<!-- Remove old priorities if they exist -->
<xsl:template match="fontconfig/alias[family = 'serif']/prefer/family[.='DejaVu Serif']" priority="1"/>
<xsl:template match="fontconfig/alias[family = 'sans-serif']/prefer/family[.='DejaVu Sans']" priority="1"/>
<xsl:template match="fontconfig/alias[family = 'monospace']/prefer/family[.='DejaVu Sans Mono']" priority="1"/>
<!-- Register serif alias -->
<xsl:template match="fontconfig/alias[family = 'serif']/prefer/family[1]" priority="1">
<family>DejaVu Serif</family>
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates select="*|text()|comment()"/>
</xsl:copy>
</xsl:template>
<!-- Register sans-serif alias -->
<xsl:template match="fontconfig/alias[family = 'sans-serif']/prefer/family[1]" priority="1">
<family>DejaVu Sans</family>
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates select="*|text()|comment()"/>
</xsl:copy>
</xsl:template>
<!-- Register monospace alias -->
<xsl:template match="fontconfig/alias[family = 'monospace']/prefer/family[1]" priority="1">
<family>DejaVu Sans Mono</family>
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates select="*|text()|comment()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>