summaryrefslogtreecommitdiffstats
path: root/examples/gdl/makeGdl.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/gdl/makeGdl.py')
-rwxr-xr-xexamples/gdl/makeGdl.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/examples/gdl/makeGdl.py b/examples/gdl/makeGdl.py
new file mode 100755
index 0000000..d8eaf78
--- /dev/null
+++ b/examples/gdl/makeGdl.py
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+'Analyse a font and generate GDL to help with the creation of graphite fonts'
+__url__ = 'http://github.com/silnrsi/pysilfont'
+__copyright__ = 'Copyright (c) 2015 SIL International (http://www.sil.org)'
+__license__ = 'Released under the MIT License (http://opensource.org/licenses/MIT)'
+
+from gdl.font import Font
+import gdl.ot
+from argparse import ArgumentParser
+
+parser = ArgumentParser()
+parser.add_argument('infont')
+parser.add_argument('outgdl')
+parser.add_argument('-a','--ap')
+parser.add_argument('-i','--include')
+parser.add_argument('-y','--alias')
+args = parser.parse_args()
+
+f = Font(args.infont)
+if args.alias : f.loadAlias(args.alias)
+if args.ap : f.loadAP(args.ap)
+
+f.createClasses()
+f.calculateOTLookups()
+f.calculatePointClasses()
+f.ligClasses()
+
+outf = open(args.outgdl, "w")
+f.outGDL(outf, args)
+outf.close()
+