summaryrefslogtreecommitdiffstats
path: root/examples/ffremovealloverlaps.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/ffremovealloverlaps.py')
-rwxr-xr-xexamples/ffremovealloverlaps.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/examples/ffremovealloverlaps.py b/examples/ffremovealloverlaps.py
new file mode 100755
index 0000000..d5fe178
--- /dev/null
+++ b/examples/ffremovealloverlaps.py
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+from __future__ import unicode_literals
+'FontForge: Remove overlap on all glyphs in font'
+__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)'
+__author__ = 'Victor Gaultney'
+
+from silfont.core import execute
+
+
+''' This will need updating, since FontForge is no longer supported as a tool by execute() So:
+- ifont and ofont will need to be changed to have type 'filename'
+- ifont will then need to be opened using fontforge.open
+- The font will need to be saved with font.save
+- execute will need to be called with the tool set to None instead of "FF"
+'''
+
+
+argspec = [
+ ('ifont',{'help': 'Input font file'}, {'type': 'infont'}),
+ ('ofont',{'help': 'Output font file','nargs': '?' }, {'type': 'outfont', 'def': 'new'})]
+
+def doit(args) :
+ font = args.ifont
+ for glyph in font:
+ font[glyph].removeOverlap()
+ return font
+
+def cmd() : execute("FF",doit,argspec)
+if __name__ == "__main__": cmd()