* Use a small XSLT script that copies the original fonts.conf from the
fontconfig distribution, but replaces all <dir> entries with the directories specified in the $fontDirectories parameter. This way we get all the font mapping rules from the original fonts.conf (e.g., aliases like "serif") and some other nice things. svn path=/nixos/trunk/; revision=7749
This commit is contained in:
parent
eddd3a7e11
commit
6cb01a0b22
@ -79,29 +79,28 @@ import ../helpers/make-etc.nix {
|
|||||||
|
|
||||||
{ # Configuration file for fontconfig used to locate
|
{ # Configuration file for fontconfig used to locate
|
||||||
# (X11) client-rendered fonts.
|
# (X11) client-rendered fonts.
|
||||||
source = pkgs.substituteAll {
|
source = pkgs.runCommand "fonts.conf"
|
||||||
src = ./etc/fonts/fonts.conf;
|
{
|
||||||
fontDirectories =
|
fontDirectories = [
|
||||||
let
|
# - the user's .fonts directory
|
||||||
# Search for fonts in...
|
"~/.fonts"
|
||||||
runtimeDirs = [
|
# - the user's current profile
|
||||||
# - the user's .fonts directory
|
"~/.nix-profile/lib/X11/fonts"
|
||||||
"~/.fonts"
|
# - the default profile
|
||||||
# - the user's current profile
|
"/nix/var/nix/profiles/default/lib/X11/fonts"
|
||||||
"~/.nix-profile/lib/X11/fonts"
|
# - a few statically built locations
|
||||||
# - the default profile
|
pkgs.xorg.fontbhttf
|
||||||
"/nix/var/nix/profiles/default/lib/X11/fonts"
|
pkgs.xorg.fontbh100dpi
|
||||||
];
|
pkgs.xorg.fontbhlucidatypewriter100dpi
|
||||||
systemFonts = [
|
pkgs.freefont_ttf
|
||||||
# - a few statically built locations
|
];
|
||||||
pkgs.xorg.fontbhttf
|
buildInputs = [pkgs.libxslt];
|
||||||
pkgs.xorg.fontbh100dpi
|
inherit (pkgs) fontconfig;
|
||||||
pkgs.xorg.fontbhlucidatypewriter100dpi
|
}
|
||||||
pkgs.freefont_ttf
|
"xsltproc --stringparam fontDirectories \"$fontDirectories\" \\
|
||||||
];
|
${./etc/fonts/make-fonts-conf.xsl} $fontconfig/etc/fonts/fonts.conf \\
|
||||||
in
|
> $out
|
||||||
map (dir: "<dir>${dir}</dir>") (runtimeDirs ++ systemFonts);
|
";
|
||||||
};
|
|
||||||
target = "fonts/fonts.conf";
|
target = "fonts/fonts.conf";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
|
|
||||||
|
|
||||||
<fontconfig>
|
|
||||||
|
|
||||||
@fontDirectories@
|
|
||||||
|
|
||||||
</fontconfig>
|
|
32
system/etc/fonts/make-fonts-conf.xsl
Normal file
32
system/etc/fonts/make-fonts-conf.xsl
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
This script copies the original fonts.conf from the fontconfig
|
||||||
|
distribution, but replaces all <dir> entries with the directories
|
||||||
|
specified in the $fontDirectories parameter.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<xsl:stylesheet version="1.0"
|
||||||
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
xmlns:str="http://exslt.org/strings"
|
||||||
|
extension-element-prefixes="str"
|
||||||
|
>
|
||||||
|
|
||||||
|
<xsl:output method='xml' encoding="UTF-8" doctype-system="fonts.dtd" />
|
||||||
|
|
||||||
|
<xsl:param name="fontDirectories" />
|
||||||
|
|
||||||
|
<xsl:template match="/fontconfig">
|
||||||
|
|
||||||
|
<fontconfig>
|
||||||
|
<xsl:copy-of select="child::node()[name() != 'dir']" />
|
||||||
|
|
||||||
|
<xsl:for-each select="str:tokenize($fontDirectories)">
|
||||||
|
<dir><xsl:value-of select="." /></dir>
|
||||||
|
</xsl:for-each>
|
||||||
|
|
||||||
|
</fontconfig>
|
||||||
|
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
</xsl:stylesheet>
|
Loading…
x
Reference in New Issue
Block a user