summaryrefslogtreecommitdiffstats
path: root/examples/gdl/makeGdl.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-03-02 20:01:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-03-02 20:01:10 +0000
commitda875fcb62c801b8d19b3d4d984ad963574fb356 (patch)
tree3d85503747c56c2a387b291524442946f4bebb73 /examples/gdl/makeGdl.py
parentInitial commit. (diff)
downloadpysilfont-da875fcb62c801b8d19b3d4d984ad963574fb356.tar.xz
pysilfont-da875fcb62c801b8d19b3d4d984ad963574fb356.zip
Adding upstream version 1.6.0.upstream/1.6.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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()
+