From 05950fcbabcf6974f9e0a891a6336c92f6d5fec6 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 27 Dec 2016 18:38:42 -0500 Subject: [PATCH] [cmap] Rewrite loop --- Lib/fontTools/ttLib/tables/_c_m_a_p.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Lib/fontTools/ttLib/tables/_c_m_a_p.py b/Lib/fontTools/ttLib/tables/_c_m_a_p.py index 7f0d750ae..bd167cb3a 100644 --- a/Lib/fontTools/ttLib/tables/_c_m_a_p.py +++ b/Lib/fontTools/ttLib/tables/_c_m_a_p.py @@ -20,12 +20,12 @@ def _make_map(font, chars, gids): cmap = {} lenCmap = len(gids) glyphOrder = font.getGlyphOrder() - try: - names = list(map(operator.getitem, [glyphOrder]*lenCmap, gids )) - except IndexError: - getGlyphName = font.getGlyphName - names = list(map(getGlyphName, gids )) - list(map(operator.setitem, [cmap]*lenCmap, chars, names)) + for char,gid in zip(chars,gids): + try: + name = glyphOrder[gid] + except IndexError: + name = font.getGlyphName(gid) + cmap[char] = gid return cmap class table__c_m_a_p(DefaultTable.DefaultTable):