shithub: neatmkfn

Download patch

ref: 5126cc6f5d8455cded60d001a2ddb0c2fb0762d6
parent: 00b9b4736f1ee8bf19a143f3eb8f4811c60e78cd
author: Ali Gholami Rudi <ali@rudi.ir>
date: Thu Oct 15 21:16:59 EDT 2020

gen.sh: warn if Fontforge is missing when converting OTF to TTF

--- a/gen.sh
+++ b/gen.sh
@@ -19,8 +19,7 @@
 echo "unitwidth 10" >>$TP/DESC
 
 # afmconv troff_name font_path extra_mktrfn_options
-afmconv()
-{
+afmconv() {
 	echo $1
 	T1="`dirname $2`/`basename $2 .afm`.t1"
 	test -f "$T1" || T1="`dirname $2`/`basename $2 .afm`.pfa"
@@ -30,8 +29,7 @@
 }
 
 # ttfconv troff_name font_path extra_mktrfn_options
-ttfconv()
-{
+ttfconv() {
 	echo $1
 	cat $2 | ./mkfn -b -l -o -r$RES $SCR -t$1 -f "$2" $3 $4 $5 $6 $7 | \
 		sed "/^ligatures /s/ $LIGIGN//g" >$TP/$1
@@ -38,10 +36,12 @@
 }
 
 # otfconv troff_name font_path extra_mktrfn_options
-otfconv()
-{
+otfconv() {
 	TTF="/tmp/.neatmkfn.ttf"
-	# convert the OTF file to TTF using fontforge
+	if ! command -v fontforge >/dev/null; then
+		echo "Fontforge is needed to convert OTF files to TTF!"
+		return 1
+	fi
 	fontforge -lang=ff -c "Open(\"$2\"); Generate(\"$TTF\");" >/dev/null 2>&1
 	ttfconv $1 $TTF $3 $4 $5 $6 $7
 	rm $TTF
@@ -48,8 +48,7 @@
 }
 
 # stdfont troff_name gs_font urw_font extra_mktrfn_options
-stdfont()
-{
+stdfont() {
 	FN="$2"
 	test -f "$FN" || FN="$3"
 	test -f "$FN" || echo "$0: Font <$3> not found!" >&2