-
Notifications
You must be signed in to change notification settings - Fork 23
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
[write-fonts/gvar] add axis_count param to Gvar::new #919
Conversation
this ensures that we (e.g. fontc) can make valid empty gvar tables where the axis_count matches the expected fvar's axis_count Will fix googlefonts/fontc#815 once fontc is updated to use the new API. This is a breaking changes which warrants minor write-fonts version bump.
Fixes #815 Untested as it requires googlefonts/fontations#919 (and write-fonts dependency bump) to work...
Okay so to understand the situation here: sometimes we would like to have an empty gvar table, but set an explicit axis_count? If yes: is it true that there are basically two ways we expect the new API to be called:
If yes, my one nit with this PR is that it introduces a new error and possible error condition that we might be able to avoid. For instance, we could have a separate constructor That does push the responsibility down to the caller, to ensure that they call a different constructor to get an empty table, so there is that downside. What do you think? |
yes, because some old apps expect gvar to always be present in a VF even if empty, and the spec wants gvar's axis_count == fvar.axis_count no matter what (e.g. fonttools fails to decompile an empty gvar with axis_count of 0 where fvar.axis_count != 0)
technically it would still be possible for the caller to construct a gvar table where all the provided variations have the same, consistent axis_count, but the latter turns out not to match the global fvar's axis_count, but you could argue that's not write-font's fault. But I'm not opposed to the proposed additional |
My preference is just for simpler code and fewer error conditions, but agree it's not a big deal. |
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.
minor preference for the alternative version I think but merge this if you prefer!
I think I can wait until tomorrow to let @rsheeter chime in. Feel free to cut a release without this or wait |
#919 contains a backward incompatible change (new axis_count parameter added to Gvar::new constructor)
this ensures that we (e.g. fontc) can make valid empty gvar tables where the axis_count matches the expected (fvar's) axis_count as per OT spec.
Will eventually fix googlefonts/fontc#815 once fontc is updated to use the new API.
This is a breaking changes which warrants minor write-fonts version bump.