Compare commits

...

2 commits

25 changed files with 22 additions and 7 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -22,8 +22,13 @@
sLen = stringLength str;
in sufLen <= sLen && suffix == substring (sLen - sufLen) sufLen str;
buildFont = { name, files, license, author, }:
buildFont = { name, files ? [ ], dir ? null, license, author }:
let
types = {
ttf = "truetype";
otf = "opentype";
};
copyType = extension: pathName:
let
filteredFiles = filter (pathEndsWith ("." + extension)) files;
@ -34,14 +39,19 @@
'') + concatStringsSep "\n" (map (file:
"cp -v ${file} $out/share/fonts/${pathName}/${filename file}")
filteredFiles);
copyTypeDir = extension: pathName: ''
if [ -n "$(shopt -s nullglob; echo ${dir}/*.${extension})" ]; then
mkdir -p $out/share/fonts/${pathName}
cp -v -t $out/share/fonts/${pathName} ${dir}/*.${extension}
fi
'';
in pkgs.stdenvNoCC.mkDerivation {
inherit name;
dontUnpack = true;
installPhase = ''
${copyType "ttf" "truetype"}
${copyType "otf" "opentype"}
'';
installPhase = mapAttrsToList copyType types
++ optional (dir != null) (mapAttrsToList copyTypeDir types);
meta = {
inherit license;
@ -59,11 +69,16 @@
}
{
name = "gg sans";
files =
[ ./ggsans/ggsans-Normal.ttf ./ggsans/ggsans-Medium.ttf ./ggsans/ggsans-SemiBold.ttf ];
dir = ./ggsans;
license = licenses.unfree;
author = "Colophon Foundry";
}
{
name = "P22 Underground";
dir = ./P22-Underground;
license = licenses.unfree;
author = "P22 Type Foundry";
}
{
name = "Caveat";
files = [ ./Caveat.ttf ];