[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:
0f86c1c0d3 (commitcomment-11375190)
This commit is contained in:
Sascha Brawer 2015-06-01 11:02:41 +02:00
parent 1447730438
commit 5ba59b3f4b

View File

@ -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