-
Notifications
You must be signed in to change notification settings - Fork 493
[designspaceLib] Adjust spec for public.skipExportGlyphs
#3936
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
base: main
Are you sure you want to change the base?
Conversation
Will it be simpler to actually specify that the inheritance logic should be the same for
Yes, for an optional key in a dictionary-like data structure, the absence of this key should be analyzed as having a different meaning from the value being falsy ( |
that's actually a good idea. E.g. one may want to define different skipExportGlyphs for different VF or instance targets. |
Is there specific language you might suggest adding/adjusting in this PR? I’m not super familiar with the inheritance logic of public.fontInfo, offhand. I suppose you mean that it treats some fields as applying to everything, but lets other fields apply on to individual instances? Is there a record of what goes where? There must be...
YES, this would be handy. It’s pretty frequent that static exports end up with unreachable glyphs that are there simply because they are required for the variable font’s font variations glyph substitution, such as an alt /Q or barless /dollar. Would this automatically be covered by specifying that “the inheritance logic should be the same for public.skipExportGlyphs and public.fontInfo”? |
To be clear, my intention is more about reducing special cases in the spec rather than expanding the functionality.
I’m still pondering over this idea. I’m not familiar with this spec either (I didn’t even know about its existence before, as I thought everything was in the source code…), but will try drafting something later.
Oh I meant the inheritance chain specified for public.fontInfo, for example: InstanceDescriptor.lib["public.fontInfo"]["familyName"] # Only applicable to `InstanceDescriptor` and `VariableFontDescriptor`
InstanceDescriptor.familyName # Only applicable to `InstanceDescriptor`
DesignSpaceDocument.lib["public.fontInfo"]["familyName"]
DesignSpaceDocument.default.font.info.familyName Conceptually I guess public.skipExportGlyphs should actually be treated as one of the font info keys instead of the whole public.fontInfo, as each key of the latter has its value inherited separately. |
I wasn’t familiar with / hadn’t remembered this explicit hierarchy, but that is so helpful to see again. Thanks! I wonder if we might specify something like...
Would item 1 be a reasonable way to specify functionality to “define different skipExportGlyphs for different VF or instance targets”? Is this something we can reasonably add to the spec? |
@arrowtype yes, sounds good to me |
Okay, added! The previous information still seemed to provide useful detail, but felt a bit hard to easily read, especially when placed before the hierarchy. So, I moved the previous information to bullets that follow. It’s possible that this now provides more information than needed, but I do think it helps clarify potential areas of uncertainty. @anthrotype what are your thoughts on this? |
5b827cb
to
3fffcdd
Compare
(I’ve just rebased this branch to update it.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for drafting this.
Apart from the two changes I’m suggesting here, please consider adding cross-references to https://fonttools.readthedocs.io/en/latest/designspaceLib/index.html#common-lib-key-registry from all the affected .lib
’s (as well as InstanceDescriptor.familyName
and .styleName
’s) docstrings. For example, for:
fonttools/Lib/fontTools/designspaceLib/__init__.py
Lines 2727 to 2732 in 5850dfd
self.lib: Dict = {} | |
"""User defined, custom data associated with the whole document. | |
Use reverse-DNS notation to identify your own data. | |
Respect the data stored by others. | |
""" |
Add:
For common keys and their inheritance behavior, see:
https://fonttools.readthedocs.io/en/latest/designspaceLib/index.html#common-lib-key-registry
Probably need to link with the :doc:
syntax though.
@lianghai Thanks so much for your edits!
Seems like a good idea. I’ll have to come back to this aspect, hopefully over the weekend. |
@arrowtype would you like to also work on updating ufo2ft to match this? 😛 |
Co-authored-by: Cosimo Lupo <cosimo@anthrotype.com>
Co-authored-by: Cosimo Lupo <cosimo@anthrotype.com>
Co-authored-by: Cosimo Lupo <cosimo@anthrotype.com>
acabd7c
to
8cae5a9
Compare
@lianghai I’ve implemented you specific example, but I’m not familiar enough with this library’s structure to know where all affected libs would be, and why it might make sense to link from @anthrotype I would like to help further if I can, but I’d have to ask how this might fit into the priorities at The Type Founders. Also, I probably wouldn’t be particularly efficient at making such changes. Of course, I also understand if this isn’t a high priority on anyone’s docket, and I very much appreciate the expertise being lent in this PR, even just as a way I’m learning more about the designspaceLib. |
Uh I thought the spec itself you’re editing now is supposed to explain which exactly attributes across the DesignSpaceDoc hierarchy participate in this inheritance logic? Then I expect all participating Python attributes need to also point back to the spec, otherwise whoever using the Python API doesn’t know how to interpret the attributes properly. I, for one, didn’t realize there was explicitly documented inheritance logic that has no reference in designspaceLib/init.py. But I’m quite confused by how https://fonttools.readthedocs.io/en/latest/designspaceLib/ is organized, with the Python API and XML API documented separately… @anthrotype, who’s supposed to be the owner of this chapter of documentation https://fonttools.readthedocs.io/en/latest/designspaceLib/? We need the owner to make a decision about how to document such info properly.
If docstrings of Now I’m thinking such an inheritance logic should actually captured in a function… Btw, if you add me as a collaborator, I can try drafting something. |
@lianghai Thanks, sounds good! Done: https://github.com/arrowtype/fonttools/invitations |
This proposal is described further at #3935, as well as the earlier issue thread at googlefonts/ufo2ft#854.
In this PR, I am slightly more confident in the first commit and slightly less confident about the second commit, so I left them deliberately separate. However, I think this arrangement probably makes sense, assuming others agree that an empty lib key should be treated as significant data.
I am open to critique of language or formatting here, and direct edits from maintainers. I’m also happy to answer questions, if there are any that I can speak to.
Thank you for your consideration here!