Minor optimization

This commit is contained in:
Behdad Esfahbod 2014-05-09 17:05:32 -04:00
parent f09164a0de
commit da223b8fa8

View File

@ -673,7 +673,7 @@ class cmap_format_4(CmapSubtable):
glyphID = charCode + idDelta[i] glyphID = charCode + idDelta[i]
else: else:
# *someone* needs to get killed. # *someone* needs to get killed.
index = idRangeOffset[i] // 2 + (charCode - startCode[i]) + i - len(idRangeOffset) index = rangeOffset // 2 + (charCode - startCode[i]) + i - len(idRangeOffset)
assert (index < lenGIArray), "In format 4 cmap, range (%d), the calculated index (%d) into the glyph index array is not less than the length of the array (%d) !" % (i, index, lenGIArray) assert (index < lenGIArray), "In format 4 cmap, range (%d), the calculated index (%d) into the glyph index array is not less than the length of the array (%d) !" % (i, index, lenGIArray)
if glyphIndexArray[index] != 0: # if not missing glyph if glyphIndexArray[index] != 0: # if not missing glyph
glyphID = glyphIndexArray[index] + idDelta[i] glyphID = glyphIndexArray[index] + idDelta[i]