-
Notifications
You must be signed in to change notification settings - Fork 43
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
Implement public.skipExportGlyphs
handling to exclude glyphs from final font
#318
Conversation
Thanks, I’ll take a look soon. What about the feature file? |
Feature file subsetting would need your proposed feaLib changes. Probably not worth hacking something up here. |
I wonder if Glyphs.app subsets the feature file for non-Export glyphs? |
In a test file, I have to go to the features pane and hit refresh for Glyphs to add previously non-exported glyphs 🤔 |
Did you sneakingly run black to reformat everything? Why did init module changed? |
Argh! That was by accident. And I just realized I didn't finish the documentation for the groups/kerning pruning. Edit: Yet another CRLF -> LF thing. Grrrr! |
(Glyphs does not seem to automatically subset the feature file, you have to update the code.) |
Specification PR at unified-font-object/ufo-spec#84. |
what about, instead of modifying the groups/kerning in place, we pass the skipExportGlyphs list to the feature compiler so that the filtering is applied only when the feature writers access the groups/kerning from the input UFO, thus without needing to modify the input UFO? |
sorry didn't mean to close the PR |
Hm. That might be a better idea because we don't have to copy anything to avoid source object modification. |
So we can reuse it in upcoming commits. Also extend it to be able to decompose just some components.
The necessary information can be inferred from the ttFont.
The font object is not touched anymore.
Implement unified-font-object/ufo-spec#68 (comment).
The idea is that we want functionality like Glyphs' "Export" flag on glyphs, giving the designer control over what ends up in the final font file. The crucial difference to fontmake's subsetting functionality is that removing non-export glyphs is done before they reach the actual compiler -- this allows e.g. the exclusion of non-compatible glyphs in the early stages of variable font work, which would otherwise crash the compiler. If the non-export glyphs are used as components, just those components will be decomposed, which matches Glyphs' behavior.
This PR adds handling of a
public.skipExportGlyphs
lib key on two levels:compile*
functions that take one or more UFOs take a newskipExportGlyphs
parameter, which is a list or set of glyph names to be excluded from the final font file. If the parameter is not explicitly passed in, the UFO(s)public.skipExportGlyphs
lib key(s) will be consulted. In the case of multiple UFOs, the union of all those lib keys is used. If the UFOs do not have such a key, all glyphs are exported.compile*FromDS
functions that take a Designspace also take a newskipExportGlyphs
parameter, which is also a list or set of glyph names to be excluded from the final font file. If the parameter is not explicitly passed in, the Designspace'spublic.skipExportGlyphs
lib key is consulted. If the Designspace does not have such a key, all glyphs are exported (the keys in the UFOs are ignored).The feature file is not touched. If you reference glyphs that are excluded, the feature compiler will crash.
TODO: