dina-font: use fonttosfnt instead of fontforge
This commit is contained in:
parent
b5a9df01ab
commit
00bda76bc7
1 changed files with 26 additions and 20 deletions
|
@ -1,53 +1,59 @@
|
|||
{ lib, stdenv, fetchurl, unzip
|
||||
, bdftopcf, mkfontscale, fontforge
|
||||
, bdftopcf, mkfontscale, fonttosfnt
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "dina-font";
|
||||
version = "2.92";
|
||||
|
||||
outputs = [ "out" "bdf" ];
|
||||
|
||||
src = fetchurl {
|
||||
url = "http://www.donationcoder.com/Software/Jibz/Dina/downloads/Dina.zip";
|
||||
sha256 = "1kq86lbxxgik82aywwhawmj80vsbz3hfhdyhicnlv9km7yjvnl8z";
|
||||
};
|
||||
|
||||
nativeBuildInputs =
|
||||
[ unzip bdftopcf mkfontscale fontforge ];
|
||||
[ unzip bdftopcf mkfontscale fonttosfnt ];
|
||||
|
||||
patchPhase = "sed -i 's/microsoft-cp1252/ISO8859-1/' *.bdf";
|
||||
postPatch = ''
|
||||
sed -i 's/microsoft-cp1252/ISO8859-1/' *.bdf
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
newName() {
|
||||
test "''${1:5:1}" = i && _it=Italic || _it=
|
||||
case ''${1:6:3} in
|
||||
400) test -z $it && _weight=Medium ;;
|
||||
700) _weight=Bold ;;
|
||||
esac
|
||||
_pt=''${1%.bdf}
|
||||
_pt=''${_pt#*-}
|
||||
echo "Dina$_weight$_it$_pt"
|
||||
test "''${1:5:1}" = i && _it=Italic || _it=
|
||||
case ''${1:6:3} in
|
||||
400) test -z $it && _weight=Medium ;;
|
||||
700) _weight=Bold ;;
|
||||
esac
|
||||
_pt=''${1%.bdf}
|
||||
_pt=''${_pt#*-}
|
||||
echo "Dina$_weight$_it$_pt"
|
||||
}
|
||||
|
||||
# convert bdf fonts to pcf
|
||||
for i in *.bdf; do
|
||||
bdftopcf -t -o $(newName "$i").pcf "$i"
|
||||
for f in *.bdf; do
|
||||
name=$(newName "$f")
|
||||
bdftopcf -t -o "$name.pcf" "$f"
|
||||
fonttosfnt -v -o "$name.otb" "$f"
|
||||
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
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
install -D -m 644 -t "$out/share/fonts/misc" *.pcf.gz *.otb
|
||||
install -D -m 644 -t "$bdf/share/fonts/misc" *.bdf
|
||||
mkfontdir "$out/share/fonts/misc"
|
||||
mkfontdir "$bdf/share/fonts/misc"
|
||||
'';
|
||||
|
||||
outputs = [ "out" "bdf" ];
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "A monospace bitmap font aimed at programmers";
|
||||
|
|
Loading…
Reference in a new issue