googlefonts / nanoemoji

A wee tool to build color fonts.
Apache License 2.0
239 stars 19 forks source link

Order glyphs to minimize ClipRecords #358

Open rsheeter opened 2 years ago

rsheeter commented 2 years ago

As comment in write_font.py suggests:

    # TODO: Optimize glyphOrder so that color glyphs sharing the same clip box
    # values are placed next to one another in continuous ranges, to minimize number
    # of COLRv1 ClipRecords
anthrotype commented 2 years ago

I have a hunch the file size savings won't be huge, as the actual ClipBox subtables are already shared by offset. Also, bear in mind glyph order is a global thing affecting every other sfnt table that deals with glyphs, not just COLR. E.g. GPOS/GSUB Coverage table format 2 similarly uses glyph ID ranges. What may be optimal for reducing the number of clipbox range records, may not also be optimal overall. Worth trying, but not huge priority IMO