upgrade misc/tools/fontinfo.py
This commit is contained in:
parent
4cba11837b
commit
11435926ba
1 changed files with 9 additions and 4 deletions
|
|
@ -3,8 +3,13 @@
|
||||||
#
|
#
|
||||||
# Generates JSON-encoded information about fonts
|
# Generates JSON-encoded information about fonts
|
||||||
#
|
#
|
||||||
import os
|
from __future__ import print_function
|
||||||
import sys
|
|
||||||
|
import os, sys
|
||||||
|
from os.path import dirname, basename, abspath, relpath, join as pjoin
|
||||||
|
sys.path.append(abspath(pjoin(dirname(__file__), 'tools')))
|
||||||
|
import common # for the side effeects
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
|
|
@ -272,7 +277,7 @@ def genFontInfo(fontpath, outputType, withGlyphs=True):
|
||||||
}
|
}
|
||||||
|
|
||||||
# for tableName in tt.keys():
|
# for tableName in tt.keys():
|
||||||
# print 'table', tableName
|
# print('table', tableName)
|
||||||
|
|
||||||
nameDict = {}
|
nameDict = {}
|
||||||
if 'name' in tt:
|
if 'name' in tt:
|
||||||
|
|
@ -394,7 +399,7 @@ def genFontInfo(fontpath, outputType, withGlyphs=True):
|
||||||
addCFFFontInfo(tt, info, cffTable)
|
addCFFFontInfo(tt, info, cffTable)
|
||||||
elif glyphsType is GLYPHS_TYPE_TT:
|
elif glyphsType is GLYPHS_TYPE_TT:
|
||||||
glyphsTable = tt["glyf"]
|
glyphsTable = tt["glyf"]
|
||||||
# print 'glyphs type:', glyphsType, 'flavor:', tt.flavor, 'sfntVersion:', tt.sfntVersion
|
# print('glyphs type:', glyphsType, 'flavor:', tt.flavor, 'sfntVersion:', tt.sfntVersion)
|
||||||
|
|
||||||
if (withGlyphs is not False or outputType is OUTPUT_TYPE_GLYPHLIST) and withGlyphs is not '':
|
if (withGlyphs is not False or outputType is OUTPUT_TYPE_GLYPHLIST) and withGlyphs is not '':
|
||||||
info['glyphs'] = genGlyphsInfo(tt, outputType, glyphsType, glyphsTable, withGlyphs)
|
info['glyphs'] = genGlyphsInfo(tt, outputType, glyphsType, glyphsTable, withGlyphs)
|
||||||
|
|
|
||||||
Reference in a new issue