-
Notifications
You must be signed in to change notification settings - Fork 41
Only write explicit tuple min/maxes if there is an intermediate tent #1345
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
Only write explicit tuple min/maxes if there is an intermediate tent #1345
Conversation
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.
I think this is a good direction, would be happy to get this in after a bit of polish.
Moved from original implementation in googlefonts/fontc#1225, see discussion. This optimisation is also implemented in fontTools, and reduced `gvar` table size by ~50% when testing locally on a large variable font.
Unfortunately we lose some of the simplicity of the prior approach, as there is no Option `collect()` for `any()`, and we need to make the implied intermediates available outside of the coordinates struct.
c13a50d
to
0aad38f
Compare
I've now added an upstream fontc PR to follow the new API, and unit tests for the new logic; we'll probably want to feed a font all the way through a ttx-diff pipeline before merging |
We should be good to undraft here - ready for review! |
Fewer types and fewer code paths.
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.
I can't really have any complaints about this now then, can I? @Hoolean I'm happy to merge unless you are aware of any blockers.
I'll do a ttx_diff run-through of a large font through the whole shebang (googlefonts/fontc#1253) just to check we're still capturing everything, but after that I'm confident we're ready to go :) |
Identical 💪 Let's merge! |
peak: F2Dot14, | ||
min: F2Dot14, |
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.
this is probably just cosmetic, as this isn't really a tuple but a struct with named fields, but I'm used to seeing a "tent" as a { min, peak, max } in this particular order, where peak is between min and max, by definition. I wonder if we should reoder.
Also about min/max.. I believe the spec prefers to call them start and end respectively, though the meaning is clear anyway.
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.
we're using min/max elsewhere, so I'm happy to just keep it consistent. ordering is an internal detail so we can change that later, I think it makes sense to get this merged. :)
Moved from original implementation in googlefonts/fontc#1225.
Motivation for moving:
This PR roughly sketches how the optimisation could look in a new home here instead. In general I think it has reduced the complexity of the code in the original PR, at the cost of some additional
Vec
s that could be targeted later if we end up in the hot path, and some boilerplate when we already know we do not have intermediate regions in the test cases.If we are happy with this direction then we can polish the types and tidy the PR, and I will look to furnish it with unit tests too.