utility script for generating groff fonts

This commit is contained in:
lieuwe B. Leene 2024-11-10 14:29:58 +01:00
parent 930f8a83c6
commit 4ed6c9fcf1

17
Fonts/groff_font.sh Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
for font_file in $(find . -regextype posix-extended -iregex ".*-(italic|bold|regular)+.ttf");
do fontforge -lang=ff -c "Open(\"$font_file\");Generate(\"${font_file/ttf/pfa}\")";
done
MAP_FILE="/usr/share/groff/current/font/devps/generate/textmap"
ENC_FILE="/usr/share/groff/current/font/devps/text.enc"
FONT_FAMILY="${PWD##*/}"
for afm_file in ./*afm; do
FONT_TYPE="R"
if [[ "${afm_file,,}" == *"italic"* ]] ; then FONT_TYPE="I" ; fi
if [[ "${afm_file,,}" == *"bold"* ]] ; then FONT_TYPE="B" ; fi
if [[ "${afm_file,,}" == *"bolditalic"* ]] ; then FONT_TYPE="BI" ; fi
afmtodit -e $ENC_FILE $afm_file $MAP_FILE "${FONT_FAMILY}${FONT_TYPE}"
done