-
Notifications
You must be signed in to change notification settings - Fork 449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error while subsetting Bungee COLR #2461
Comments
A bit of context is required. The font contains a COLR version 0 table. The subsetter does a series of "glyph closures" to progressively extend the intial set and determine a final subset. These are done in a specific order that takes care of inter-table dependencies. It first intersects the requesed unicodes with the cmap tables to find the respective glyph names, then processes the GSUB table extending the set to include the glyphs that are reachable via substitutions from these. Now the problem in this particular case is that the subsetter is using the final subset to subset the COLR table's base glyph records, this also including the glyph set extended by the glyf closure that follows the COLR glyph closure; instead of only including the set resulting from the COLR glyph closure. For this reason, it's retaining the "grave" COLR base record because glyf's glyph "Agrave" uses "A" and "grave" as components, so "grave" happens to be in the final subset. The fix is not to do another round of closures and include the missing "grave.alt001". We don't actually need the COLR "grave" color glyph, the initial request was to retain the glyph "Agrave", which in COLR table doesn't refer to or make use of the COLR glyph "grave" at all; "Agrave" only refers to glyf glyph "grave", via The fix is to subset COLR base glyphs only based on the gyphs subset that results after the COLR glyph closure but before the glyf closure. This way we don't include "grave" as COLR base record, and neither we need to include any layer glyphs referenced by it, because it was not requesed to begin with. The subsetter uses a pattern to do similar thing, e.g. for GSUB, the current subset is not the final |
Nice writeup, ty. A clearer error message would be nice too if possible. The struct complaint is not tremendously informative wrt what went wrong. |
yes, especially the fact that the error message mentions 'str', but the type of the offending value is None, not 'str'.. that's just the result of the too clever exception chaining in otTables |
And the reason it does not error when --no-glyph-names (default) option is used with the same font and input is because |
Ouch. Well this'll be nice to have fixed! Is there a point it would be appropriate to validate color does not reference fantasy glyphs? |
maybe, but that's tangential and better tackled as separate feature request. here we just want to exclude glyphs that are only added after glyf closure from the set used to subset COLR, to avoid including more color glyphs than requested. |
this currently fails with struct.error. Fix will ensue shortly
…excluding glyf closure Fixes #2461
Correct. |
Take this font from https://github.com/google/fonts/blob/17fd8411fad0c1fb14e4c8bd18c87f45f65454f8/ofl/bungeecolor/BungeeColor-Regular.ttf
and do
you get this struct.error:
The text was updated successfully, but these errors were encountered: