Skip to content

Set FontFace weight ranges based on Typr info #7727

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

Merged
merged 3 commits into from
Apr 12, 2025

Conversation

davepagurek
Copy link
Contributor

Resolves #7725

Previously, animating variable fonts in Firefox would be jerky or would not happen at all for some fonts. It turns out this is because, while the font supports variables, the FontFace we were creating out of the Typr-parsed data did not include a range of values for the weight (it was just normal).

To fix this, we can grab the range of values per axis from Typr and pass them in to the new FontFace as descriptors.

Live: https://editor.p5js.org/davepagurek/sketches/dXMFTL1Fs

PR Checklist

@dhowe
Copy link
Contributor

dhowe commented Apr 12, 2025

@davepagurek is this what was causing the firefox issue you mentioned earlier? and if so, how was chromium getting this data?

@davepagurek
Copy link
Contributor Author

I think Chrome was just ignoring the descriptor and using the data from the font itself. The behaviour between them is also a little different from each other when you request a value outside of the specified range: Chrome clamps, and Firefox kinda jitters

@davepagurek davepagurek merged commit db236e6 into dev-2.0 Apr 12, 2025
2 checks passed
@davepagurek davepagurek deleted the fix/variable-font-firefox branch April 12, 2025 20:50
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