dina-font: fix encoding

The provided BDF files are encoded as CP1252, but they claim to be
ISO8859-1. This causes a few glyphs (like `œ`) to be unused.

Use fontforge to re-encode from CP1252 to Unicode, but keep doing the
conversion with other tools because fontforge introduces spacing issues.

+28 -20
+28 -20
pkgs/data/fonts/dina/default.nix
··· 1 - { lib, stdenv, fetchurl, unzip 2 , bdftopcf, xorg 3 }: 4 ··· 8 9 outputs = [ "out" "bdf" ]; 10 11 - src = fetchurl { 12 - url = "http://www.donationcoder.com/Software/Jibz/Dina/downloads/Dina.zip"; 13 - sha256 = "1kq86lbxxgik82aywwhawmj80vsbz3hfhdyhicnlv9km7yjvnl8z"; 14 }; 15 16 nativeBuildInputs = 17 - [ unzip bdftopcf xorg.mkfontscale xorg.fonttosfnt ]; 18 - 19 - postPatch = '' 20 - sed -i 's/microsoft-cp1252/ISO8859-1/' *.bdf 21 - ''; 22 23 buildPhase = '' 24 runHook preBuild 25 26 newName() { 27 - test "''${1:5:1}" = i && _it=Italic || _it= 28 - case ''${1:6:3} in 29 - 400) test -z $it && _weight=Medium ;; 30 - 700) _weight=Bold ;; 31 - esac 32 - _pt=''${1%.bdf} 33 - _pt=''${_pt#*-} 34 - echo "Dina$_weight$_it$_pt" 35 } 36 37 for f in *.bdf; do 38 name=$(newName "$f") ··· 62 relatively compact to allow a lot of code on screen, while (hopefully) 63 clear enough to remain readable even at high resolutions. 64 ''; 65 - homepage = "https://www.donationcoder.com/Software/Jibz/Dina/"; 66 - downloadPage = "https://www.donationcoder.com/Software/Jibz/Dina/"; 67 license = licenses.free; 68 - maintainers = [ maintainers.prikhi ]; 69 }; 70 }
··· 1 + { lib, stdenv, fetchzip, fontforge 2 , bdftopcf, xorg 3 }: 4 ··· 8 9 outputs = [ "out" "bdf" ]; 10 11 + src = fetchzip { 12 + url = "https://www.dcmembers.com/jibsen/download/61/?wpdmdl=61"; 13 + hash = "sha256-JK+vnOyhAbwT825S+WKbQuWgRrfZZHfyhaMQ/6ljO8s="; 14 + extension = "zip"; 15 + stripRoot = false; 16 }; 17 18 nativeBuildInputs = 19 + [ fontforge bdftopcf xorg.mkfontscale xorg.fonttosfnt ]; 20 21 buildPhase = '' 22 runHook preBuild 23 24 newName() { 25 + local name=''${1##*/} 26 + test "''${name:5:1}" = i && _it=Italic || _it= 27 + case ''${name:6:3} in 28 + 400) _weight=Medium ;; 29 + 700) _weight=Bold ;; 30 + esac 31 + _pt=''${1%.bdf} 32 + _pt=''${_pt#*-} 33 + echo "Dina$_weight$_it$_pt" 34 } 35 + 36 + # Re-encode the provided BDF files from CP1252 to Unicode as fonttosfnt does 37 + # not support the former. 38 + # We could generate the PCF and OTB files with fontforge directly, but that 39 + # results in incorrect spacing in various places. 40 + for f in BDF/*.bdf; do 41 + basename=''${f##*/} basename=''${basename%.*} 42 + fontforge -lang=ff -c "Open(\"$f\"); Reencode(\"win\", 1); Reencode(\"unicode\"); Generate(\"$basename.bdf\")" 43 + mv "$basename"-*.bdf "$basename".bdf # remove the superfluous added size suffix 44 + done 45 46 for f in *.bdf; do 47 name=$(newName "$f") ··· 71 relatively compact to allow a lot of code on screen, while (hopefully) 72 clear enough to remain readable even at high resolutions. 73 ''; 74 + homepage = "https://www.dcmembers.com/jibsen/download/61/"; 75 license = licenses.free; 76 + maintainers = with maintainers; [ prikhi ncfavier ]; 77 }; 78 }