auto-import dejavu-fonts-2.3-2.fc5 on branch devel from dejavu-fonts-2.3-2.fc5.src.rpm
register fontconfig aliases
This commit is contained in:
parent
05989a1d3f
commit
a286b1431e
148
dejavu-fonts-register.xsl
Normal file
148
dejavu-fonts-register.xsl
Normal file
@ -0,0 +1,148 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Registers DejaVu fonts in fonts.conf
|
||||
© 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 default families -->
|
||||
<!-- sans-serif -->
|
||||
<xsl:template match="fontconfig/alias[default[family = 'sans-serif'] and not(family = 'DejaVu Sans')]/family[1]" priority="1">
|
||||
<family>DejaVu Sans</family>
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="@*"/>
|
||||
<xsl:apply-templates select="*|text()|comment()"/>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
<!-- serif -->
|
||||
<xsl:template match="fontconfig/alias[default[family = 'serif'] and not(family = 'DejaVu Serif')]/family[1]" priority="1">
|
||||
<family>DejaVu Serif</family>
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="@*"/>
|
||||
<xsl:apply-templates select="*|text()|comment()"/>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
<!-- monospace -->
|
||||
<xsl:template match="fontconfig/alias[default[family = 'monospace'] and not(family = 'DejaVu Sans Mono')]/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>
|
||||
<!-- Take care of alias priorities -->
|
||||
<!-- Registers serif alias -->
|
||||
<xsl:template match="fontconfig/alias[family = 'serif']/prefer[not(family='DejaVu Serif') and not(family='Bitstream Vera Serif')]/family[1]" priority="2">
|
||||
<family>DejaVu Serif</family>
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="@*"/>
|
||||
<xsl:apply-templates select="*|text()|comment()"/>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
<xsl:template match="fontconfig/alias[family = 'serif']/prefer[not(family='DejaVu Serif')]/family[text()='Bitstream Vera Serif']" priority="1">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="@*"/>
|
||||
<xsl:apply-templates select="*|text()|comment()"/>
|
||||
</xsl:copy>
|
||||
<family>DejaVu Serif</family>
|
||||
</xsl:template>
|
||||
<!-- Registers sans-serif alias -->
|
||||
<xsl:template match="fontconfig/alias[family = 'sans-serif']/prefer[not(family='DejaVu Sans') and not(family='Bitstream Vera Sans')]/family[1]" priority="2">
|
||||
<family>DejaVu Sans</family>
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="@*"/>
|
||||
<xsl:apply-templates select="*|text()|comment()"/>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
<xsl:template match="fontconfig/alias[family = 'sans-serif']/prefer[not(family='DejaVu Sans')]/family[text()='Bitstream Vera Sans']" priority="1">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="@*"/>
|
||||
<xsl:apply-templates select="*|text()|comment()"/>
|
||||
</xsl:copy>
|
||||
<family>DejaVu Sans</family>
|
||||
</xsl:template>
|
||||
<!-- Registers monospace alias -->
|
||||
<xsl:template match="fontconfig/alias[family = 'monospace']/prefer[not(family='DejaVu Sans Mono') and not(family='Bitstream Vera Sans Mono')]/family[1]" priority="2">
|
||||
<family>DejaVu Sans Mono</family>
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="@*"/>
|
||||
<xsl:apply-templates select="*|text()|comment()"/>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
<xsl:template match="fontconfig/alias[family = 'monospace']/prefer[not(family='DejaVu Sans Mono')]/family[text()='Bitstream Vera Sans Mono']" priority="1">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="@*"/>
|
||||
<xsl:apply-templates select="*|text()|comment()"/>
|
||||
</xsl:copy>
|
||||
<family>DejaVu Sans Mono</family>
|
||||
</xsl:template>
|
||||
<!-- Create Vera aliases -->
|
||||
<xsl:template match="fontconfig/alias[family='Bitstream Vera Sans']/accept[not(family='DejaVu Sans')]/family[position()=last()]" priority="1">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="@*"/>
|
||||
<xsl:apply-templates select="*|text()|comment()"/>
|
||||
</xsl:copy>
|
||||
<family>DejaVu Sans</family>
|
||||
</xsl:template>
|
||||
<xsl:template match="fontconfig/alias[family='Bitstream Vera Serif']/accept[not(family='DejaVu Serif')]/family[position()=last()]" priority="1">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="@*"/>
|
||||
<xsl:apply-templates select="*|text()|comment()"/>
|
||||
</xsl:copy>
|
||||
<family>DejaVu Serif</family>
|
||||
</xsl:template>
|
||||
<xsl:template match="fontconfig/alias[family='Bitstream Vera Sans Mono']/accept[not(family='DejaVu Sans Mono')]/family[position()=last()]" priority="1">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="@*"/>
|
||||
<xsl:apply-templates select="*|text()|comment()"/>
|
||||
</xsl:copy>
|
||||
<family>DejaVu Sans Mono</family>
|
||||
</xsl:template>
|
||||
<xsl:template match="fontconfig/alias[accept][position()=last()]" priority="1">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="@*"/>
|
||||
<xsl:apply-templates select="*|text()|comment()"/>
|
||||
</xsl:copy>
|
||||
<xsl:if test="not(/fontconfig/alias[family='Bitstream Vera Sans']/accept)">
|
||||
<alias>
|
||||
<family>Bitstream Vera Sans</family>
|
||||
<accept>
|
||||
<family>Bitstream Vera Sans</family>
|
||||
<family>DejaVu Sans</family>
|
||||
</accept>
|
||||
</alias>
|
||||
</xsl:if>
|
||||
<xsl:if test="not(/fontconfig/alias[family='Bitstream Vera Serif']/accept)">
|
||||
<alias>
|
||||
<family>Bitstream Vera Serif</family>
|
||||
<accept>
|
||||
<family>Bitstream Vera Serif</family>
|
||||
<family>DejaVu Serif</family>
|
||||
</accept>
|
||||
</alias>
|
||||
</xsl:if>
|
||||
<xsl:if test="not(/fontconfig/alias[family='Bitstream Vera Sans Mono']/accept)">
|
||||
<alias>
|
||||
<family>Bitstream Vera Sans Mono</family>
|
||||
<accept>
|
||||
<family>Bitstream Vera Sans Mono</family>
|
||||
<family>DejaVu Sans Mono</family>
|
||||
</accept>
|
||||
</alias>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
@ -1,7 +1,8 @@
|
||||
%define archivename dejavu-sfd
|
||||
# This macro has the same value as %{version}, except when testing pre-release snapshots
|
||||
%define archiveversion %{version}-1
|
||||
%define fontdir %{_datadir}/fonts/dejavu
|
||||
%define fontdir %{_datadir}/fonts/%{name}
|
||||
%define xsldir %{_datadir}/xml/%{name}
|
||||
|
||||
# Let the perl Maintainer worry about Unicode.org data files (updates, licensing)
|
||||
%define Blocks %(eval "$(%{__perl} -V:privlibexp)"; echo $privlibexp)/unicore/Blocks.txt
|
||||
@ -9,30 +10,36 @@
|
||||
|
||||
Name: dejavu-fonts
|
||||
Version: 2.3
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Summary: DejaVu Fonts
|
||||
Group: User Interface/X
|
||||
License: Redistributable, with restrictions
|
||||
URL: http://dejavu.sf.net/
|
||||
Source: http://prdownloads.sourceforge.net/dejavu/%{archivename}-%{archiveversion}.tar.gz
|
||||
Source1: dejavu-fonts-register.xsl
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
BuildRequires: fontforge
|
||||
# The CPAN sources do not declare perl(Font::TTF)
|
||||
BuildRequires: perl-Font-TTF
|
||||
# Needed to compute unicode coverage
|
||||
BuildRequires: %{Blocks} %{UnicodeData}
|
||||
# Needed for fontconfig alias registration
|
||||
Requires: %{_bindir}/xsltproc, /bin/mktemp
|
||||
BuildArch: noarch
|
||||
Conflicts: fontconfig < 2.3.93
|
||||
|
||||
|
||||
%description
|
||||
The DejaVu fonts are a font family based on the Bitstream Vera Fonts release
|
||||
1.10. Its purpose is to provide a wider range of characters (see Current status
|
||||
page for more information) while maintaining the original look and feel through
|
||||
the process of collaborative develop
|
||||
|
||||
|
||||
%prep
|
||||
%setup -q -n %{archivename}-%{version}
|
||||
|
||||
|
||||
%build
|
||||
./generate.sh
|
||||
./status.pl %{version} status.txt *.sfd > status.txt.new
|
||||
@ -42,11 +49,13 @@ mv status.txt.new status.txt
|
||||
DejaVuSerif.sfd Serif \
|
||||
DejaVuMonoSans.sfd "Sans Mono" > unicover.txt
|
||||
|
||||
|
||||
%check
|
||||
# Current upstream files are full of "problems"
|
||||
# Do not panic if the output is long
|
||||
./problems.pl -l 3 *.sfd
|
||||
|
||||
|
||||
%install
|
||||
/bin/rm -rf %{buildroot}
|
||||
|
||||
@ -54,6 +63,11 @@ mv status.txt.new status.txt
|
||||
install -d -m 0755 %{buildroot}%{fontdir}
|
||||
install -m 0644 generated/*.ttf %{buildroot}%{fontdir}
|
||||
|
||||
#xsl
|
||||
install -d -m 755 %{buildroot}%{xsldir}
|
||||
install -p -m 644 %{SOURCE1} %{buildroot}%{xsldir}/register-%{name}.xsl
|
||||
|
||||
|
||||
%clean
|
||||
/bin/rm -rf %{buildroot}
|
||||
|
||||
@ -63,6 +77,7 @@ if [ -x %{_bindir}/fc-cache ]; then
|
||||
%{_bindir}/fc-cache %{_datadir}/fonts
|
||||
fi
|
||||
|
||||
|
||||
%postun
|
||||
if [ "$1" = "0" ]; then
|
||||
if [ -x %{_bindir}/fc-cache ]; then
|
||||
@ -71,6 +86,16 @@ if [ "$1" = "0" ]; then
|
||||
fi
|
||||
|
||||
|
||||
%triggerin -- fontconfig, %{_sysconfdir}/fonts/fonts.conf
|
||||
|
||||
if [ -x %{_sysconfdir}/fonts/fonts.conf ] ; then
|
||||
TMPFILE=$(/bin/mktemp -q /tmp/fonts.conf.XXXXXX) && \
|
||||
%{_bindir}/xsltproc --novalid --output $TMPFILE \
|
||||
%{xsldir}/register-%{name}.xsl %{_sysconfdir}/fonts/fonts.conf && \
|
||||
/bin/cat $TMPFILE > %{_sysconfdir}/fonts/fonts.conf && /bin/rm $TMPFILE
|
||||
fi
|
||||
|
||||
|
||||
%files
|
||||
%defattr(0644,root,root,0755)
|
||||
%doc *.txt AUTHORS BUGS LICENSE NEWS README
|
||||
@ -78,7 +103,14 @@ fi
|
||||
%dir %{fontdir}
|
||||
%{fontdir}/*.ttf
|
||||
|
||||
%dir %{xsldir}
|
||||
%{xsldir}/register-%{name}.xsl
|
||||
|
||||
|
||||
%changelog
|
||||
* Sat Mar 04 2006 Nicolas Mailhot <nicolas.mailhot at laposte.net> - 2.3-2
|
||||
- register dejavu in fontconfig aliases
|
||||
|
||||
* Mon Feb 20 2006 Nicolas Mailhot <nicolas.mailhot at laposte.net> - 2.3-1
|
||||
- 2.3
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user