Merge pull request #275 from anthrotype/unicodecustom
[ttx] add "--unicodedata" option for custom UnicodeData.txt
This commit is contained in:
commit
f724b2415f
@ -58,6 +58,8 @@ usage: ttx [options] inputfile1 [... inputfileN]
|
|||||||
and abort.
|
and abort.
|
||||||
-y <number> Select font number for TrueType Collection,
|
-y <number> Select font number for TrueType Collection,
|
||||||
starting from 0.
|
starting from 0.
|
||||||
|
--unicodedata <UnicodeData.txt> Use custom database file to write
|
||||||
|
character names in the comments of the cmap TTX output.
|
||||||
|
|
||||||
Compile options:
|
Compile options:
|
||||||
-m Merge with TrueType-input-file: specify a TrueType or OpenType
|
-m Merge with TrueType-input-file: specify a TrueType or OpenType
|
||||||
@ -72,6 +74,7 @@ from __future__ import print_function, division, absolute_import
|
|||||||
from fontTools.misc.py23 import *
|
from fontTools.misc.py23 import *
|
||||||
from fontTools.ttLib import TTFont, TTLibError
|
from fontTools.ttLib import TTFont, TTLibError
|
||||||
from fontTools.misc.macCreatorType import getMacCreatorAndType
|
from fontTools.misc.macCreatorType import getMacCreatorAndType
|
||||||
|
from fontTools.unicode import setUnicodeData
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import getopt
|
import getopt
|
||||||
@ -116,6 +119,7 @@ class Options(object):
|
|||||||
allowVID = False
|
allowVID = False
|
||||||
ignoreDecompileErrors = True
|
ignoreDecompileErrors = True
|
||||||
bitmapGlyphDataFormat = 'raw'
|
bitmapGlyphDataFormat = 'raw'
|
||||||
|
unicodedata = None
|
||||||
|
|
||||||
def __init__(self, rawOptions, numFiles):
|
def __init__(self, rawOptions, numFiles):
|
||||||
self.onlyTables = []
|
self.onlyTables = []
|
||||||
@ -168,6 +172,8 @@ class Options(object):
|
|||||||
self.allowVID = True
|
self.allowVID = True
|
||||||
elif option == "-e":
|
elif option == "-e":
|
||||||
self.ignoreDecompileErrors = False
|
self.ignoreDecompileErrors = False
|
||||||
|
elif option == "--unicodedata":
|
||||||
|
self.unicodedata = value
|
||||||
if self.onlyTables and self.skipTables:
|
if self.onlyTables and self.skipTables:
|
||||||
print("-t and -x options are mutually exclusive")
|
print("-t and -x options are mutually exclusive")
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
@ -198,6 +204,8 @@ def ttList(input, output, options):
|
|||||||
def ttDump(input, output, options):
|
def ttDump(input, output, options):
|
||||||
if not options.quiet:
|
if not options.quiet:
|
||||||
print('Dumping "%s" to "%s"...' % (input, output))
|
print('Dumping "%s" to "%s"...' % (input, output))
|
||||||
|
if options.unicodedata:
|
||||||
|
setUnicodeData(options.unicodedata)
|
||||||
ttf = TTFont(input, 0, verbose=options.verbose, allowVID=options.allowVID,
|
ttf = TTFont(input, 0, verbose=options.verbose, allowVID=options.allowVID,
|
||||||
quiet=options.quiet,
|
quiet=options.quiet,
|
||||||
ignoreDecompileErrors=options.ignoreDecompileErrors,
|
ignoreDecompileErrors=options.ignoreDecompileErrors,
|
||||||
@ -259,7 +267,8 @@ def guessFileType(fileName):
|
|||||||
|
|
||||||
def parseOptions(args):
|
def parseOptions(args):
|
||||||
try:
|
try:
|
||||||
rawOptions, files = getopt.getopt(args, "ld:o:fvqht:x:sim:z:baey:")
|
rawOptions, files = getopt.getopt(args, "ld:o:fvqht:x:sim:z:baey:",
|
||||||
|
['unicodedata='])
|
||||||
except getopt.GetoptError:
|
except getopt.GetoptError:
|
||||||
usage()
|
usage()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user