summaryrefslogtreecommitdiffstats
path: root/examples/gdl/makeGdl.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2024-11-21 15:00:40 +0100
committerDaniel Baumann <daniel@debian.org>2024-11-21 15:00:40 +0100
commit012d9cb5faed22cb9b4151569d30cc08563b02d1 (patch)
treefd901b9c231aeb8afa713851f23369fa4a1af2b3 /examples/gdl/makeGdl.py
parentInitial commit. (diff)
downloadpysilfont-012d9cb5faed22cb9b4151569d30cc08563b02d1.tar.xz
pysilfont-012d9cb5faed22cb9b4151569d30cc08563b02d1.zip
Adding upstream version 1.8.0.upstream/1.8.0upstream
Signed-off-by: Daniel Baumann <daniel@debian.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..e3c2720
--- /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__ = 'https://github.com/silnrsi/pysilfont'
+__copyright__ = 'Copyright (c) 2015 SIL International (https://www.sil.org)'
+__license__ = 'Released under the MIT License (https://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()
+