summaryrefslogtreecommitdiff
path: root/opentype-gx/samples/random-instance-demo.sh
blob: dc7931e4386ba2f663fae0d9bfdbb4212dc4dab1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash

if test $# -lt 2; then
	echo "usage: $0 font.ttf text" >&2
	exit 2
fi
font=$1
outfont=${font%.ttf}-instance.ttf
outimg=${outfont%.ttf}.svg
text=$2

python list-axes.py $font |
while read tag min default max; do
	rnd=`python -c "print $((RANDOM%(100*(max-min))+min))/100."`
	echo "$tag=$rnd"
done | tee | (
	xargs python varLib/mutator.py "$font" &&
	hb-view "$outfont" "$text" --font-size 300 --output-file "$outimg" &&
	(display "$outimg" &)
)