nixos/fontdir: gather more font formats

- Fix wrong order in which font indexes are created
mkfontdir requires the file fonts.scale to consider scalable fonts,
thus, mkfontscale should be run before

- Search more font formats, in particular, bit-mapped formats
This commit is contained in:
Emilio Perez 2020-08-30 21:39:27 +01:00
parent e940c41a9c
commit a5618e6187

View File

@ -5,14 +5,16 @@ with lib;
let
x11Fonts = pkgs.runCommand "X11-fonts" { preferLocalBuild = true; } ''
font_formats=('ttf' 'otf' 'pcf' 'pfa' 'pfb' 'bdf')
mkdir -p "$out/share/X11-fonts"
find ${toString config.fonts.fonts} \
\( -name fonts.dir -o -name '*.ttf' -o -name '*.otf' \) \
-exec ln -sf -t "$out/share/X11-fonts" '{}' \;
for fmt in "''${font_formats[@]}"; do
find ${toString config.fonts.fonts} \
\( -name '*.'$fmt -o -name '*.'$fmt'.gz' \) \
-exec ln -sf -t "$out/share/X11-fonts" '{}' \;
done
cd "$out/share/X11-fonts"
rm -f fonts.dir fonts.scale fonts.alias
${pkgs.xorg.mkfontdir}/bin/mkfontdir
${pkgs.xorg.mkfontscale}/bin/mkfontscale
${pkgs.xorg.mkfontdir}/bin/mkfontdir
cat $(find ${pkgs.xorg.fontalias}/ -name fonts.alias) >fonts.alias
'';