[ttFont] Apply review comments
This commit is contained in:
parent
7a22c0fb07
commit
e5bf2a7f1a
@ -16,7 +16,6 @@ def _make_map(font, chars, gids):
|
||||
assert len(chars) == len(gids)
|
||||
glyphNames = font.getGlyphNameMany(gids)
|
||||
cmap = {}
|
||||
glyphOrder = font.getGlyphOrder()
|
||||
for char,gid,name in zip(chars,gids,glyphNames):
|
||||
if gid == 0:
|
||||
continue
|
||||
|
@ -920,13 +920,14 @@ class ClassDef(FormatSwitchingBaseTable):
|
||||
elif self.Format == 2:
|
||||
records = rawTable["ClassRangeRecord"]
|
||||
for rec in records:
|
||||
cls = rec.Class
|
||||
if not cls:
|
||||
continue
|
||||
start = rec.Start
|
||||
end = rec.End
|
||||
cls = rec.Class
|
||||
startID = font.getGlyphID(start)
|
||||
endID = font.getGlyphID(end) + 1
|
||||
glyphNames = font.getGlyphNameMany(range(startID, endID))
|
||||
if cls:
|
||||
for glyphName in glyphNames:
|
||||
classDefs[glyphName] = cls
|
||||
else:
|
||||
|
@ -569,6 +569,7 @@ class TTFont(object):
|
||||
glyphIDs = [d.get(glyphName) for glyphName in lst]
|
||||
|
||||
if any(glyphID is None for glyphID in glyphIDs):
|
||||
# TODO Add something faster
|
||||
getGlyphID = self.getGlyphID
|
||||
return [getGlyphID(glyphName) for glyphName in lst]
|
||||
|
||||
@ -581,7 +582,6 @@ class TTFont(object):
|
||||
|
||||
def _buildReverseGlyphOrderDict(self):
|
||||
self._reverseGlyphOrderDict = d = {}
|
||||
glyphOrder = self.getGlyphOrder()
|
||||
for glyphID,glyphName in enumerate(self.getGlyphOrder()):
|
||||
d[glyphName] = glyphID
|
||||
return d
|
||||
|
Loading…
x
Reference in New Issue
Block a user