summaryrefslogtreecommitdiff
path: root/misc/tools/find-ufo-frac-advance-widths.sh
blob: 5c5c93a7c7154727e660dfcbbc45bc7734254cdc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash
#
# This script finds UFO glyphs with fractional advance width, which is invalid.
# See https://github.com/rsms/inter/issues/508
#
cd "$(dirname "$0")"/../../build/ufo
ADVANCES=$(rg 'advance width'|awk 'BEGIN {FS="  "} {print $2}')
NOTREALLYFLOATS=$((rg '\.0\b'|wc -l) <<< "$ADVANCES")
FLOATS=$((rg '\.\d+'|wc -l) <<< "$ADVANCES")
INTS=$((rg -v '\.'|wc -l) <<< "$ADVANCES")

printf "Total: $((INTS+FLOATS)) (sanity: $(wc -l <<< "$ADVANCES"))\nFloats: $((FLOATS-NOTREALLYFLOATS))\nInts: $((INTS+NOTREALLYFLOATS))\n"

echo "Occurance Fraction"
(rg -o '\.\d{1,12}'|sort|uniq -c) <<< "$ADVANCES"