Skip to content

Commit

Permalink
dina: generate otb files with fontforge
Browse files Browse the repository at this point in the history
Note: the encoding of the Dina BDF fonts is not unicode and
apparently fonttosfnt can't handle them.
  • Loading branch information
rnhmjoj committed Feb 15, 2020
1 parent 7f7c944 commit 36ca91e
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions pkgs/data/fonts/dina/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ stdenv, fetchurl, unzip
, bdftopcf, mkfontscale
, bdftopcf, mkfontscale, fontforge
}:

stdenv.mkDerivation {
Expand All @@ -12,7 +12,7 @@ stdenv.mkDerivation {
};

nativeBuildInputs =
[ unzip bdftopcf mkfontscale ];
[ unzip bdftopcf mkfontscale fontforge ];

patchPhase = "sed -i 's/microsoft-cp1252/ISO8859-1/' *.bdf";

Expand All @@ -33,15 +33,23 @@ stdenv.mkDerivation {
bdftopcf -t -o $(newName "$i").pcf "$i"
done
gzip -n -9 *.pcf
# convert bdf fonts to otb
for i in *.bdf; do
fontforge -lang=ff -c "Open(\"$i\"); Generate(\"$(newName $i).otb\")"
done
'';

installPhase = ''
install -D -m 644 -t "$out/share/fonts/misc" *.pcf.gz
install -D -m 644 -t "$bdf/share/fonts/misc" *.bdf
install -D -m 644 -t "$otb/share/fonts/misc" *.otb
mkfontdir "$out/share/fonts/misc"
mkfontdir "$bdf/share/fonts/misc"
mkfontdir "$otb/share/fonts/misc"
'';

outputs = [ "out" "bdf" ];
outputs = [ "out" "bdf" "otb" ];

meta = with stdenv.lib; {
description = "A monospace bitmap font aimed at programmers";
Expand Down

0 comments on commit 36ca91e

Please sign in to comment.