[agl] ensure AGL glyph names are 'str' type

We are using unicode_literals in this module since 329261b.
Because of that, on py27 sometimes a TTFont glyphOrder may end up with
a mix of `str` and `unicode` glyph names.
While I'd love to change every single 'text' string to unicode, maybe
in this case it makes sense to use the native `str` type (`bytes` on
py2, unicode string on py3) for the UV2AGL and AGL2UV dictionaries, as
glyph names can only contain ascii characters anyway.

See https://github.com/fonttools/fonttools/pull/774#discussion_r98327429
This commit is contained in:
Cosimo Lupo 2017-01-28 11:48:51 +00:00
parent 93b97510bc
commit d8c40583d1
No known key found for this signature in database
GPG Key ID: B61AAAD0B53A6419

View File

@ -731,7 +731,7 @@ def _builddicts():
unicode = m.group(1) unicode = m.group(1)
assert len(unicode) == 4 assert len(unicode) == 4
unicode = int(unicode, 16) unicode = int(unicode, 16)
glyphName = m.group(2) glyphName = tostr(m.group(2))
if glyphName in AGL2UV: if glyphName in AGL2UV:
# the above table contains identical duplicates # the above table contains identical duplicates
assert AGL2UV[glyphName] == unicode assert AGL2UV[glyphName] == unicode