From 5ba59b3f4bd37fea6c68a5a9c0976f7e6c7b1a2b Mon Sep 17 00:00:00 2001 From: Sascha Brawer Date: Mon, 1 Jun 2015 11:02:41 +0200 Subject: [PATCH] [gvar] Take glyphs from gvar.variations When compiling the set of shared coordinates, walk over glyphs in self.variations instead of retrieving them in glyph order. This addresses a code review comment: https://github.com/brawer/fonttools/commit/0f86c1c0d352d3513c8e0c4b2f153f84782a32af#commitcomment-11375190 --- Lib/fontTools/ttLib/tables/_g_v_a_r.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Lib/fontTools/ttLib/tables/_g_v_a_r.py b/Lib/fontTools/ttLib/tables/_g_v_a_r.py index 3f1d1dd8b..8db8c41d8 100644 --- a/Lib/fontTools/ttLib/tables/_g_v_a_r.py +++ b/Lib/fontTools/ttLib/tables/_g_v_a_r.py @@ -86,11 +86,10 @@ class table__g_v_a_r(DefaultTable.DefaultTable): def compileSharedCoords_(self, ttFont, axisTags): coordCount = {} - for glyph in ttFont.getGlyphOrder(): - if glyph in self.variations: - for gvar in self.variations[glyph]: - coord = gvar.compileCoord(axisTags) - coordCount[coord] = coordCount.get(coord, 0) + 1 + for glyph, variations in self.variations.items(): + for gvar in variations: + coord = gvar.compileCoord(axisTags) + coordCount[coord] = coordCount.get(coord, 0) + 1 sharedCoords = [(count, coord) for (coord, count) in coordCount.items() if count > 1] sharedCoords.sort(reverse=True) MAX_NUM_SHARED_COORDS = TUPLE_INDEX_MASK + 1