Skip to content

Commit

Permalink
Merge pull request #386 from googlefonts/i385
Browse files Browse the repository at this point in the history
Fix lack of sort on glyph id for bitmap tables
  • Loading branch information
anthrotype authored Feb 21, 2022
2 parents 5504a18 + ad952c1 commit cba0561
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/nanoemoji/bitmap_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,10 @@ def make_cbdt_table(
color_glyphs: Sequence[ColorGlyph],
):

min_gid, max_gid = reduce(
lambda a, c: (min(a[0], c.glyph_id), max(a[1], c.glyph_id)),
color_glyphs,
(sys.maxsize, -1),
)
# bitmap tables don't like it when we're out of order
color_glyphs = sorted(color_glyphs, key=lambda c: c.glyph_id)

min_gid, max_gid = color_glyphs[0].glyph_id, color_glyphs[-1].glyph_id
assert max_gid - min_gid + 1 == len(
color_glyphs
), "Below assumes color gyphs gids are consecutive"
Expand Down

0 comments on commit cba0561

Please sign in to comment.