-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add variable-aware ValueRecord and Anchor types to fea-rs #598
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.
Looks good, with minor comments
fea-rs/src/compile/lookups.rs
Outdated
// the var_store is only used in GPOS, but we pass it everywhere | ||
fn build(self, var_store: &mut VariationStoreBuilder) -> Self::Output; |
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.
it's feels a bit strange that one has to pass down a VariationStoreBuilder that is only used in some cases and not others (e.g. if only building GSUB table). Can this be avoided e.g. make it optional or add a different method to construct a lookup builder that has a VariationStoreBuilder?
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.
agree this is annoying, and unfortunately Option<&mut T>
is annoying to work with, because it doesn't implement Copy
, which means you need to do a dance to get the inner reference anywhere you need it, so I found this to be the best compromise.
I agree that this is confusing, though, and I will expand the comment to explain what's going on.
e9a1388
to
132e2b7
Compare
These types store their deltas inline, which means that we don't need to have access to an ItemVariationStore in orderto create them. This, in turn, lets us move all of the concern over deltas to the end of the compile pass, and also lets us provide a nicer feature writer API.
This also tweaks the visibility of some fields.
132e2b7
to
b24324b
Compare
This does the minimum to get us compiling again; there's a larger patch to write that skips the intermediate step and just creates these types directly.
b24324b
to
9957f9a
Compare
Previously we used the
ValueRecord
andAnchorTable
types in write-fonts. This had the complication that anytime you needed to include deltas you had to have access to aVariationStoreBuilder
, which was a bottleneck for fontc.With this change, we now just store the deltas inline in the record/anchor type, and only go and turn them into actual
write-fonts
types at the very end, after merging anything we've received from feature writers.This patch makes the fewest changes outside fea-rs that were possible in order to get things working again; as follow up we can go and figure out how best to update the kerning/marks code to take advantage of this new model.
This requires googlefonts/fontations#719; this includes a commit that patches Cargo.toml to point at that for the time being.