Skip to content
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

[skrifa] tthint: use cvar table #839

Merged
merged 2 commits into from
Mar 15, 2024
Merged

[skrifa] tthint: use cvar table #839

merged 2 commits into from
Mar 15, 2024

Conversation

dfrg
Copy link
Member

@dfrg dfrg commented Mar 15, 2024

Applies cvar deltas to the cvt.

Applies cvar deltas to the cvt.
Copy link
Member

@cmyr cmyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -171,13 +171,40 @@ impl HintInstance {
Definition::default(),
);
self.cvt.clear();
if let Some(cvar) = outlines.cvar.as_ref() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure it's useful here, but something that I have found helpful for the idea of "I need both of these optional things to exist" is,

if let Some((one, two)) = opt1.zip(opt2) {
...
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, hadn't seen this before. I don't see how I'd use it here but will definitely add it to the toolbox!

Comment on lines 177 to 186
if let Ok(var_data) = cvar.variation_data(axis_count) {
for (tuple, scalar) in var_data.active_tuples_at(coords) {
for delta in tuple.deltas() {
let ix = delta.position as usize;
if let Some(value) = self.cvt.get_mut(ix) {
*value += delta.apply_scalar(scalar).to_bits();
}
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's easy to imagine a little helper method that handles accumulating the deltas?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call. I'll add this to the cvar table

helper method in cvar for delta accumulation
@dfrg dfrg merged commit 487f565 into main Mar 15, 2024
9 checks passed
@dfrg dfrg deleted the use-cvar branch March 15, 2024 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants