89 lines
2.5 KiB
Nix
89 lines
2.5 KiB
Nix
![]() |
{
|
||
|
pkgs,
|
||
|
...
|
||
|
}:
|
||
|
|
||
|
pkgs.stdenv.mkDerivation {
|
||
|
pname = "dina-psfu";
|
||
|
version = "1.0.0";
|
||
|
|
||
|
src = pkgs.fetchzip {
|
||
|
url = "https://www.dcmembers.com/jibsen/download/61/?wpdmdl=61";
|
||
|
hash = "sha256-JK+vnOyhAbwT825S+WKbQuWgRrfZZHfyhaMQ/6ljO8s=";
|
||
|
extension = "zip";
|
||
|
stripRoot = false;
|
||
|
};
|
||
|
|
||
|
buildInputs = with pkgs; [
|
||
|
bdf2psf
|
||
|
fontforge
|
||
|
kbd
|
||
|
];
|
||
|
|
||
|
buildPhase = ''
|
||
|
# Get the base Dina font
|
||
|
# cp ${pkgs.dina-font.bdf}/share/fonts/misc/Dina_r400-9.bdf ./dina.bdf
|
||
|
cp BDF/Dina_r400-9.bdf ./dina.bdf
|
||
|
|
||
|
# Set the AVERAGE_WIDTH property on the font
|
||
|
sed 's/STARTPROPERTIES 16/STARTPROPERTIES 17\
|
||
|
AVERAGE_WIDTH 70/' ./dina.bdf > ./dina-enc.bdf
|
||
|
|
||
|
# # Reencode the font from code page CP1252 (Windows) to unicode
|
||
|
# fontforge -lang=ff -c "Open(\"dina-mod.bdf\"); Reencode(\"win\", 1); Reencode(\"iso10646-1\"); Generate(\"dina-enc.bdf\")"
|
||
|
# mv dina-enc-*.bdf dina-enc.bdf
|
||
|
|
||
|
# Create the fontset
|
||
|
head -n 256 ${pkgs.bdf2psf}/share/bdf2psf/fontsets/Uni1.512 > Uni1.256
|
||
|
|
||
|
# Create the fontset
|
||
|
cp ${./PC437.256} PC437.256
|
||
|
|
||
|
# Create the equivalents file
|
||
|
touch empty.equivalents
|
||
|
|
||
|
# # Convert the bdf to psf
|
||
|
# bdf2psf --fb ./dina-enc.bdf \
|
||
|
# ${pkgs.bdf2psf}/share/bdf2psf/standard.equivalents \
|
||
|
# ${pkgs.bdf2psf}/share/bdf2psf/fontsets/Lat2.256 \
|
||
|
# 256 ./dina-enc.psfu ./dina.sfm
|
||
|
|
||
|
# Convert the bdf to psf
|
||
|
bdf2psf --fb ./dina-enc.bdf \
|
||
|
./empty.equivalents \
|
||
|
./Uni1.256 \
|
||
|
256 ./dina-enc.psfu ./dina.sfm
|
||
|
|
||
|
# Get the font table
|
||
|
psfgettable ./dina-enc.psfu ./dina.table
|
||
|
|
||
|
# Add some entries to the font table
|
||
|
# echo "0x0e U+2518" >> ./dina.table
|
||
|
# echo "0x0f U+2514" >> ./dina.table
|
||
|
# echo "0x10 U+250c" >> ./dina.table
|
||
|
# echo "0x11 U+2510" >> ./dina.table
|
||
|
# echo "0x12 U+2500" >> ./dina.table
|
||
|
# echo "0x13 U+2502" >> ./dina.table
|
||
|
# echo "0x14 U+2524" >> ./dina.table
|
||
|
# echo "0x15 U+2534" >> ./dina.table
|
||
|
# echo "0x16 U+251c" >> ./dina.table
|
||
|
# echo "0x17 U+252c" >> ./dina.table
|
||
|
# echo "0x18 U+253c" >> ./dina.table
|
||
|
# echo "0x19 U+2592" >> ./dina.table
|
||
|
|
||
|
# Rebuild the font
|
||
|
psfstriptable ./dina-enc.psfu ./dina-stripped.psfu
|
||
|
psfaddtable ./dina-stripped.psfu ./dina.table ./dina.psfu
|
||
|
|
||
|
# For debugging, get the table again
|
||
|
psfgettable ./dina.psfu ./dina-final.table
|
||
|
${pkgs.psftools}/bin/psf2bdf ./dina.psfu ./dina-final.bdf
|
||
|
'';
|
||
|
|
||
|
installPhase = ''
|
||
|
install -Dm644 -t $out/debug ./*.*
|
||
|
install -Dm644 -t $out/debug/BDF ./BDF/*.*
|
||
|
install -Dm644 -t $out/share/consolefonts dina.psfu
|
||
|
'';
|
||
|
}
|