mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-28 14:22:50 +03:00
* 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
|
||||
# (X11) client-rendered fonts.
|
||||
source = pkgs.substituteAll {
|
||||
src = ./etc/fonts/fonts.conf;
|
||||
fontDirectories =
|
||||
let
|
||||
# Search for fonts in...
|
||||
runtimeDirs = [
|
||||
# - the user's .fonts directory
|
||||
"~/.fonts"
|
||||
# - the user's current profile
|
||||
"~/.nix-profile/lib/X11/fonts"
|
||||
# - the default profile
|
||||
"/nix/var/nix/profiles/default/lib/X11/fonts"
|
||||
];
|
||||
systemFonts = [
|
||||
# - a few statically built locations
|
||||
pkgs.xorg.fontbhttf
|
||||
pkgs.xorg.fontbh100dpi
|
||||
pkgs.xorg.fontbhlucidatypewriter100dpi
|
||||
pkgs.freefont_ttf
|
||||
];
|
||||
in
|
||||
map (dir: "<dir>${dir}</dir>") (runtimeDirs ++ systemFonts);
|
||||
};
|
||||
source = pkgs.runCommand "fonts.conf"
|
||||
{
|
||||
fontDirectories = [
|
||||
# - the user's .fonts directory
|
||||
"~/.fonts"
|
||||
# - the user's current profile
|
||||
"~/.nix-profile/lib/X11/fonts"
|
||||
# - the default profile
|
||||
"/nix/var/nix/profiles/default/lib/X11/fonts"
|
||||
# - a few statically built locations
|
||||
pkgs.xorg.fontbhttf
|
||||
pkgs.xorg.fontbh100dpi
|
||||
pkgs.xorg.fontbhlucidatypewriter100dpi
|
||||
pkgs.freefont_ttf
|
||||
];
|
||||
buildInputs = [pkgs.libxslt];
|
||||
inherit (pkgs) fontconfig;
|
||||
}
|
||||
"xsltproc --stringparam fontDirectories \"$fontDirectories\" \\
|
||||
${./etc/fonts/make-fonts-conf.xsl} $fontconfig/etc/fonts/fonts.conf \\
|
||||
> $out
|
||||
";
|
||||
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…
Reference in New Issue
Block a user