Merge pull request #80322 from rnhmjoj/unifont

unifont: generate otb and split output
This commit is contained in:
Michele Guerini Rocco 2020-02-17 20:50:10 +01:00 committed by GitHub
commit 5798b04cce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 11 deletions

View File

@ -1,4 +1,6 @@
{ stdenv, fetchurl, mkfontscale, mkfontdir }: { stdenv, fetchurl, mkfontscale
, libfaketime, fonttosfnt
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "unifont"; pname = "unifont";
@ -14,23 +16,32 @@ stdenv.mkDerivation rec {
sha256 = "1cd1fnk3m7giqp099kynnjj4m7q00lqm4ybqb1vzd2wi3j4a1awf"; sha256 = "1cd1fnk3m7giqp099kynnjj4m7q00lqm4ybqb1vzd2wi3j4a1awf";
}; };
nativeBuildInputs = [ mkfontscale mkfontdir ]; nativeBuildInputs = [ libfaketime fonttosfnt mkfontscale ];
phases = "installPhase"; phases = [ "buildPhase" "installPhase" ];
buildPhase =
''
# convert pcf font to otb
faketime -f "1970-01-01 00:00:01" \
fonttosfnt -g 2 -m 2 -v -o "unifont.otb" "${pcf}"
'';
installPhase = installPhase =
'' ''
mkdir -p $out/share/fonts $out/share/fonts/truetype # install otb fonts
cp -v ${pcf} $out/share/fonts/unifont.pcf.gz install -m 644 -D unifont.otb "$otb/share/fonts/unifont.otb"
cp -v ${ttf} $out/share/fonts/truetype/unifont.ttf mkfontdir "$otb/share/fonts"
cd $out/share/fonts
# install pcf and ttf fonts
install -m 644 -D ${pcf} $out/share/fonts/unifont.pcf.gz
install -m 644 -D ${ttf} $out/share/fonts/truetype/unifont.ttf
cd "$out/share/fonts"
mkfontdir mkfontdir
mkfontscale mkfontscale
''; '';
outputHashAlgo = "sha256"; outputs = [ "out" "otb" ];
outputHashMode = "recursive";
outputHash = "0n3ms2k2mk7j6144l05c45smggwf3j5cwkaxhw93wf9hd1lhpwq1";
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "Unicode font for Base Multilingual Plane"; description = "Unicode font for Base Multilingual Plane";

View File

@ -18028,7 +18028,8 @@ in
unihan-database = callPackage ../data/misc/unihan-database { }; unihan-database = callPackage ../data/misc/unihan-database { };
unifont = callPackage ../data/fonts/unifont { }; unifont = callPackage ../data/fonts/unifont
{ inherit (buildPackages.xorg) fonttosfnt mkfontscale; };
unifont_upper = callPackage ../data/fonts/unifont_upper { }; unifont_upper = callPackage ../data/fonts/unifont_upper { };