From 4ed6c9fcf10f90ab0b3e5ab544e1955b6aafd8b9 Mon Sep 17 00:00:00 2001 From: "lieuwe B. Leene" Date: Sun, 10 Nov 2024 14:29:58 +0100 Subject: [PATCH] utility script for generating groff fonts --- Fonts/groff_font.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 Fonts/groff_font.sh diff --git a/Fonts/groff_font.sh b/Fonts/groff_font.sh new file mode 100755 index 0000000..63ca704 --- /dev/null +++ b/Fonts/groff_font.sh @@ -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