nixpkgs/pkgs/data/fonts/dina/default.nix

65 lines
1.8 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchurl, unzip
, bdftopcf, mkfontscale, fontforge
2020-02-09 22:55:05 +00:00
}:
2014-12-07 23:10:18 +00:00
2020-02-09 22:55:05 +00:00
stdenv.mkDerivation {
pname = "dina-font";
2014-12-07 23:10:18 +00:00
version = "2.92";
2020-02-09 22:55:05 +00:00
src = fetchurl {
url = "http://www.donationcoder.com/Software/Jibz/Dina/downloads/Dina.zip";
sha256 = "1kq86lbxxgik82aywwhawmj80vsbz3hfhdyhicnlv9km7yjvnl8z";
};
nativeBuildInputs =
[ unzip bdftopcf mkfontscale fontforge ];
2020-02-09 22:55:05 +00:00
patchPhase = "sed -i 's/microsoft-cp1252/ISO8859-1/' *.bdf";
buildPhase = ''
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"
}
# convert bdf fonts to pcf
for i in *.bdf; do
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
2020-02-09 22:55:05 +00:00
'';
2014-12-07 23:10:18 +00:00
2020-02-09 22:55:05 +00:00
installPhase = ''
install -D -m 644 -t "$out/share/fonts/misc" *.pcf.gz *.otb
2020-02-09 22:55:05 +00:00
install -D -m 644 -t "$bdf/share/fonts/misc" *.bdf
mkfontdir "$out/share/fonts/misc"
mkfontdir "$bdf/share/fonts/misc"
2014-12-07 23:10:18 +00:00
'';
outputs = [ "out" "bdf" ];
2017-08-10 19:43:49 +00:00
meta = with lib; {
2015-04-28 08:54:58 +00:00
description = "A monospace bitmap font aimed at programmers";
2014-12-07 23:10:18 +00:00
longDescription = ''
Dina is a monospace bitmap font, primarily aimed at programmers. It is
relatively compact to allow a lot of code on screen, while (hopefully)
clear enough to remain readable even at high resolutions.
'';
homepage = "https://www.donationcoder.com/Software/Jibz/Dina/";
downloadPage = "https://www.donationcoder.com/Software/Jibz/Dina/";
2014-12-07 23:10:18 +00:00
license = licenses.free;
maintainers = [ maintainers.prikhi ];
};
}