From d8c40583d14ad3a36bd877f7bfed629d72ee9028 Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Sat, 28 Jan 2017 11:48:51 +0000 Subject: [PATCH] [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 --- Lib/fontTools/agl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/fontTools/agl.py b/Lib/fontTools/agl.py index 320f79982..ec1a1b07e 100644 --- a/Lib/fontTools/agl.py +++ b/Lib/fontTools/agl.py @@ -731,7 +731,7 @@ def _builddicts(): unicode = m.group(1) assert len(unicode) == 4 unicode = int(unicode, 16) - glyphName = m.group(2) + glyphName = tostr(m.group(2)) if glyphName in AGL2UV: # the above table contains identical duplicates assert AGL2UV[glyphName] == unicode