Fix post table glyph name dedup logic for edge case

This is a followup fix to 85be2e0a9773acec3c6d14c345b1fd94ab3aa5c3
Before this change, if some glyph names had a "#-number" suffix in
the post table, we could generate duplicate glyph names.  Fix that,
even though "#" is NOT a valid character in PS glyph names.
This commit is contained in:
Behdad Esfahbod 2014-06-02 18:03:35 -04:00
parent 62dd7b2a0e
commit 4ff0d4b192

View File

@ -113,12 +113,13 @@ class table__p_o_s_t(DefaultTable.DefaultTable):
if glyphName in allNames:
# make up a new glyphName that's unique
n = allNames[glyphName]
while allNames.has_key(glyphName + "#" + str(n)):
n += 1
allNames[glyphName] = n + 1
glyphName = glyphName + "#" + repr(n)
glyphName = glyphName + "#" + str(n)
self.glyphOrder[i] = glyphName
mapping[glyphName] = psName
else:
allNames[glyphName] = 1
allNames[glyphName] = 1
self.mapping = mapping
def decode_format_3_0(self, data, ttFont):