summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2016-05-10 12:19:23 +0200
committerBehdad Esfahbod <behdad@behdad.org>2016-05-10 12:19:23 +0200
commit22612774683739c1cb85a231741285d4c1bff2d7 (patch)
tree71440d7efbed5e159808fe5743d09edb127c829c
parenta2ba8a8688546b428fa59e91de44ef881bcf03c4 (diff)
[opentype-gx] Add support files
-rwxr-xr-xopentype-gx/samples/list-axes.py12
-rwxr-xr-xopentype-gx/samples/random-instance-demo.sh20
2 files changed, 32 insertions, 0 deletions
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" &)
+)