14
0
mirror of https://github.com/belluzj/fantasque-sans.git synced 2024-11-15 21:51:31 +01:00
fantasque-sans/validate-generate.sh

43 lines
871 B
Bash
Raw Normal View History

2013-11-27 21:47:39 +01:00
#!/bin/bash
basename=$1
ttf="${basename}.ttf"
otf="OTF/${basename}.otf"
texFamily="cm" # arbitrary two letters out of the font's name
texCut="r" # Regular
if [[ "${basename,,}" == *bold* ]]; then
texCut="b" # Bold
2013-11-27 21:47:39 +01:00
fi
echo -e "\e[1;37mGenerating ${basename}... \e[0m"
2013-11-27 21:47:39 +01:00
fontforge -lang=py -script - <<EOF
import fontforge;
font = fontforge.open("Sources/${basename}.sfd");
bitmask = font.validate();
if bitmask != 0:
exit(42);
font.generate("${basename}.ttf");
font.generate("OTF/${basename}.otf");
# TeX stuff
font.encoding = "AdobeStandard";
font.generate("TeX/f${texFamily}${texCut}8a.pfb",
flags=("afm", "tfm", "pfm"));
2013-11-27 21:47:39 +01:00
EOF
error=$?
if [ "x$error" != "x0" ]; then
echo -e "\e[1;31mError in ${basename}.\e[0m"
if [ "x$error" = "x42" ]; then
echo "Font ${basename}.sfd is not valid"
fi
else
echo -e "\e[1;32m${basename} OK.\e[0m"
fi
exit $error