-
Notifications
You must be signed in to change notification settings - Fork 487
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
Variable Fonts support: GVAR and CVAR table parsing #698
Conversation
I like the idea of lazy-parsing to save memory/CPU |
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.
excellent.
always happy to see more table support !
Sure, everything that doesn't need to be there directly after loading could be parsed at runtime, especially if it's as much data as there is in the gvar table. I didn't do it for the COLR/CPAL implementation, because there isn't that much data involved. We could definitely move towards more runtime parsing in the future, but I think what's more important is adding caching mechanisms for the path calculations with added complexity due to added features like SVG and cpal/colr emojis support. I already have something in mind that I will explore when tackling the font variation rendering. |
Description
This PR adds parsing capability for the gvar and cvar tables, as these share a common format and adding cvar was practically free. It does not implement any actual variation/transformation functionality, but with this the groundwork for variable font support should be finished. Similar to glyph paths, delta values are not directly added to the table during parsing, for performance and memory saving reasons. They are only parsed when accessed.
TODOs for future PRs:
Motivation and Context
With this table data parsed, we finally "only" need to add the actual glyph transformation process.
How Has This Been Tested?
Loaded all the GVAR/CVAR test fonts from the Unicode test suite (even the ones we can't ship due to unclear licenses) and randomly cross-checked the parsed results with other parsing implementations. Added several tests.
Types of changes
Checklist:
npm run test
and all tests passed green (including code styling checks).