From 22612774683739c1cb85a231741285d4c1bff2d7 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 10 May 2016 12:19:23 +0200 Subject: [opentype-gx] Add support files --- opentype-gx/samples/list-axes.py | 12 ++++++++++++ opentype-gx/samples/random-instance-demo.sh | 20 ++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100755 opentype-gx/samples/list-axes.py create mode 100755 opentype-gx/samples/random-instance-demo.sh diff --git a/opentype-gx/samples/list-axes.py b/opentype-gx/samples/list-axes.py new file mode 100755 index 0000000..b979c97 --- /dev/null +++ b/opentype-gx/samples/list-axes.py @@ -0,0 +1,12 @@ +#!/usr/bin/python + +from fontTools.ttLib import TTFont +import sys + +font = TTFont(sys.argv[1]) +axes = font['fvar'].axes +for axis in axes: + print "%s %g %g %g" % (axis.axisTag, + axis.minValue, + axis.defaultValue, + axis.maxValue) diff --git a/opentype-gx/samples/random-instance-demo.sh b/opentype-gx/samples/random-instance-demo.sh new file mode 100755 index 0000000..7f52612 --- /dev/null +++ b/opentype-gx/samples/random-instance-demo.sh @@ -0,0 +1,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 +outpng=${outfont%.ttf}.png +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" > "$outpng" && + (display "$outpng" &) +) -- cgit v1.2.3