about summary refs log tree commit diff
path: root/pkgs/data/fonts
diff options
context:
space:
mode:
authorrnhmjoj <rnhmjoj@inventati.org>2020-02-17 01:07:00 +0100
committerrnhmjoj <rnhmjoj@inventati.org>2020-02-17 01:08:47 +0100
commitc23db52a657c0be17fd53a3c0386c10e3c253336 (patch)
tree3b44d862f9f66b013a402198e99614f1cf2aff84 /pkgs/data/fonts
parent27006fcb4d09808c1a5fe5e1b67c8c5f31f311ca (diff)
downloadnixlib-c23db52a657c0be17fd53a3c0386c10e3c253336.tar
nixlib-c23db52a657c0be17fd53a3c0386c10e3c253336.tar.gz
nixlib-c23db52a657c0be17fd53a3c0386c10e3c253336.tar.bz2
nixlib-c23db52a657c0be17fd53a3c0386c10e3c253336.tar.lz
nixlib-c23db52a657c0be17fd53a3c0386c10e3c253336.tar.xz
nixlib-c23db52a657c0be17fd53a3c0386c10e3c253336.tar.zst
nixlib-c23db52a657c0be17fd53a3c0386c10e3c253336.zip
unifont: generate otb and split output
Diffstat (limited to 'pkgs/data/fonts')
-rw-r--r--pkgs/data/fonts/unifont/default.nix31
1 files changed, 21 insertions, 10 deletions
diff --git a/pkgs/data/fonts/unifont/default.nix b/pkgs/data/fonts/unifont/default.nix
index a80beee342b3..fc41263fee7e 100644
--- a/pkgs/data/fonts/unifont/default.nix
+++ b/pkgs/data/fonts/unifont/default.nix
@@ -1,4 +1,6 @@
-{ stdenv, fetchurl, mkfontscale, mkfontdir }:
+{ stdenv, fetchurl, mkfontscale
+, libfaketime, fonttosfnt
+}:
 
 stdenv.mkDerivation rec {
   pname = "unifont";
@@ -14,23 +16,32 @@ stdenv.mkDerivation rec {
     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 =
     ''
-      mkdir -p $out/share/fonts $out/share/fonts/truetype
-      cp -v ${pcf} $out/share/fonts/unifont.pcf.gz
-      cp -v ${ttf} $out/share/fonts/truetype/unifont.ttf
-      cd $out/share/fonts
+      # install otb fonts
+      install -m 644 -D unifont.otb "$otb/share/fonts/unifont.otb"
+      mkfontdir "$otb/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
       mkfontscale
     '';
 
-  outputHashAlgo = "sha256";
-  outputHashMode = "recursive";
-  outputHash = "0n3ms2k2mk7j6144l05c45smggwf3j5cwkaxhw93wf9hd1lhpwq1";
+  outputs = [ "out" "otb" ];
 
   meta = with stdenv.lib; {
     description = "Unicode font for Base Multilingual Plane";