Last active
October 19, 2023 14:00
-
-
Save damieng/b2e279c72146ee469731acbadbeaae4a to your computer and use it in GitHub Desktop.
ZX Spectrum font conversion script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
fl5reg="HKCU\Software\FontLab\Studio 5\Directories" | |
for i in "$@" | |
do | |
name="${i%.*}" | |
echo Processing $name | |
mkdir -p PC | |
psf="PC/${name}.psf" | |
vfb="PC/${name}.vfb" | |
zx2psf "$i" "${psf}" --mode=move1 --graphics=none | |
descent=`awk -F, -v pat="^$name", '$0~pat { print $2 }' ../Metrics.csv` | |
descent=${descent:-'1'} # Default descender size | |
echo Using a descent of $descent | |
psf2bdf "${psf}" "${name}.bdf" --fontname="${name}" --descent=$descent --first=32 | |
sed -i 's/STARTCHAR C/STARTCHAR U+/' "${name}.bdf" | |
mv *.bdf PC/ 2> /dev/null | |
mv *.psf PC/ 2> /dev/null | |
cp /mnt/d/zxo/_Templates/Template.vfb "${vfb}" | |
cd PC | |
wincur="$(wslpath -w "`pwd`")" | |
cd .. | |
reg.exe add "${fl5reg}" /f /v "BitmapFonts" /t REG_SZ /d "${wincur}" >> /dev/null | |
cmd.exe /c studio5.exe "${vfb}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment