diff options
author | Daniel Baumann <daniel@debian.org> | 2024-11-21 15:00:40 +0100 |
---|---|---|
committer | Daniel Baumann <daniel@debian.org> | 2024-11-21 15:00:40 +0100 |
commit | 012d9cb5faed22cb9b4151569d30cc08563b02d1 (patch) | |
tree | fd901b9c231aeb8afa713851f23369fa4a1af2b3 /src/silfont/scripts/psfnormalize.py | |
parent | Initial commit. (diff) | |
download | pysilfont-upstream.tar.xz pysilfont-upstream.zip |
Adding upstream version 1.8.0.upstream/1.8.0upstream
Signed-off-by: Daniel Baumann <daniel@debian.org>
Diffstat (limited to 'src/silfont/scripts/psfnormalize.py')
-rw-r--r-- | src/silfont/scripts/psfnormalize.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/silfont/scripts/psfnormalize.py b/src/silfont/scripts/psfnormalize.py new file mode 100644 index 0000000..fa86dbf --- /dev/null +++ b/src/silfont/scripts/psfnormalize.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 +__doc__ = '''Normalize a UFO and optionally convert between UFO2 and UFO3''' +__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)' +__author__ = 'David Raymond' + +from silfont.core import execute + +argspec = [ + ('ifont',{'help': 'Input font file'}, {'type': 'infont'}), + ('ofont',{'help': 'Output font file','nargs': '?' }, {'type': 'outfont'}), + ('-l','--log',{'help': 'Log file'}, {'type': 'outfile', 'def': '_normalize.log'}), + ('-v','--version',{'help': 'UFO version to convert to (2, 3 or 3ff)'},{})] + +def doit(args) : + + if args.version is not None : + v = args.version.lower() + if v in ("2","3","3ff") : + if v == "3ff": # Special action for testing with FontForge import + v = "3" + args.ifont.outparams['format1Glifs'] = True + args.ifont.outparams['UFOversion'] = v + else: + args.logger.log("-v, --version must be one of 2,3 or 3ff", "S") + + return args.ifont + +def cmd() : execute("UFO",doit, argspec) +if __name__ == "__main__": cmd() |