blob: 96dc5cf4a7463fbd33158879d4664de27a9a81dd [file] [log] [blame]
Just6cc58871999-12-16 22:04:30 +00001#! /usr/bin/env python
2
3"""\
4usage: %s [-h] [-v] [-i TrueType-input-file] XML-file [TrueType-file]
5 -i TrueType-input-file: specify a TT file to be merged with the XML file
6 -v verbose: messages will be written to stdout about what is being done
7 -h help: print this message
8"""
9import sys, os, getopt
10from fontTools import ttLib
11
12options, args = getopt.getopt(sys.argv[1:], "hvi:")
13
14verbose = 0
15tt_infile = None
16for option, value in options:
17 if option == "-i":
18 tt_infile = value
19 elif option == "-v":
20 verbose = 1
21 elif option == "-h":
22 print __doc__ % sys.argv[0]
23 sys.exit(0)
24
25
26if len(args) == 1:
27 xmlpath = args[0]
28 name, ext = os.path.splitext(xmlpath)
29 ttpath = name + '.ttf'
30elif len(args) == 2:
31 xmlpath, ttpath = args
32else:
33 print __doc__ % sys.argv[0]
34 sys.exit(2)
35
36tt = ttLib.TTFont(tt_infile, verbose=verbose)
37tt.importXML(xmlpath)
38tt.save(ttpath)