2013-11-27 21:47:39 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
basename=$1
|
|
|
|
ttf="${basename}.ttf"
|
|
|
|
otf="OTF/${basename}.otf"
|
2013-11-30 21:29:09 +01:00
|
|
|
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
|
|
|
|
|
2013-11-30 21:29:09 +01:00
|
|
|
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");
|
2013-11-30 21:29:09 +01:00
|
|
|
|
|
|
|
# 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
|