14
0
mirror of https://github.com/belluzj/fantasque-sans.git synced 2024-11-17 22:51:31 +01:00
fantasque-sans/Scripts/validate-font

34 lines
642 B
Plaintext
Raw Permalink Normal View History

#!/usr/bin/env bash
# Validate a font file with FontForge.
if ! type fontforge &> /dev/null; then echo "ERROR: Missing dependency: fontforge" 1>&2; exit 1; fi
name=$1
basename=$(basename "$name" .sfdir)
echo -e "\e[1;37mValidating ${basename}... \e[0m"
output=$(fontforge --quiet -lang=py -script - "$name" <<EOF
import fontforge;
import sys;
font = fontforge.open(sys.argv[1]);
bitmask = font.validate();
2018-07-22 23:31:08 +02:00
if bitmask != 0:
exit(42);
EOF
2017-07-12 20:15:48 +02:00
)
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
fi
2018-07-22 21:11:04 +02:00
exit 0
exit $error