#!/bin/sh

git clone https://github.com/rbrito/urw-garamond.git
pushd urw-garamond/sfd/

for i in *.sfd; do
	j=${i%.*}
	j=${j#*-}
	j=${j/Med/-Bold}
	j=${j/Ita/-Italic}
	j=${j/Reg/-Regular}
	python2 <<EOF
import sys
import fontforge
f = fontforge.open("$i")
f.mergeFeature("GaramondNo8.fea")
f.selection.all()
f.autoInstr()
f.simplify()
f.round()
f.fontname="GaramondNo8$j"
f.generate(f.fontname+".ttf")
f.close()
EOF
done

install -m 644 *.ttf ~/.fonts/

popd
rm -fr urw-garamond
