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/psfsetdummydsig.py | |
parent | Initial commit. (diff) | |
download | pysilfont-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 'src/silfont/scripts/psfsetdummydsig.py')
-rw-r--r-- | src/silfont/scripts/psfsetdummydsig.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/silfont/scripts/psfsetdummydsig.py b/src/silfont/scripts/psfsetdummydsig.py new file mode 100644 index 0000000..bf7973c --- /dev/null +++ b/src/silfont/scripts/psfsetdummydsig.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python3 + +__doc__ = 'Put a dummy DSIG table into a ttf font' +__url__ = 'https://github.com/silnrsi/pysilfont' +__copyright__ = 'Copyright (c) 2019 SIL International (https://www.sil.org)' +__license__ = 'Released under the MIT License (https://opensource.org/licenses/MIT)' +__author__ = 'Nicolas Spalinger' + +from silfont.core import execute +from fontTools import ttLib + +argspec = [ + ('-i', '--ifont', {'help': 'Input ttf font file'}, {}), + ('-o', '--ofont', {'help': 'Output font file'}, {}), + ('-l', '--log', {'help': 'Optional log file'}, {'type': 'outfile', 'def': 'dummydsig.log', 'optlog': True})] + + +def doit(args): + + ttf = ttLib.TTFont(args.ifont) + + newDSIG = ttLib.newTable("DSIG") + newDSIG.ulVersion = 1 + newDSIG.usFlag = 0 + newDSIG.usNumSigs = 0 + newDSIG.signatureRecords = [] + ttf.tables["DSIG"] = newDSIG + + args.logger.log('Saving the output ttf file with dummy DSIG table', 'P') + ttf.save(args.ofont) + + args.logger.log('Done', 'P') + + +def cmd(): execute("FT", doit, argspec) +if __name__ == '__main__': cmd() |