-
-
Notifications
You must be signed in to change notification settings - Fork 11.4k
feat: subset font glyphs for SVG export #8384
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
80c5a91 to
25c3256
Compare
45de767 to
d9a45dc
Compare
e2574c1 to
20db406
Compare
20db406 to
4cd46c0
Compare
dwelle
approved these changes
Aug 30, 2024
|
Let's rock and roll! ❤️ 🚀 |
clarencechaan
pushed a commit
to clarencechaan/excalidraw
that referenced
this pull request
Oct 3, 2024
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
This was referenced Oct 16, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Glyphs subsetting powered by wasm-based
harfbuzzjsandwoff2encoder & decoder.Follow-up of #8345 due to the mentioned limitations, mainly the inability to handle kerning (
GPOS) and ligatures (GSUB) subsetting, resulting in layout shifts. Instead, relying on Harfbuzz seems as the only viable solution (used in browser and server-side) that performs subsetting also on these tables.Business value
Decreases size of each inlined font by up to 95% (dependening on the used characters).
Closes #8300
TODO
Consider adding loading WASM from URLCacheFirst, so subsequent visits won't fetch it again). Loading all WASM from binary buffer will also keep us consistent with the server-side and other use cases and avoids issues with network restrictions. In the future we might consider another wasmloader based onWebAssembly.instantiateStreaming, which might be worth for bigger modules also due to perf. @dwelle thoughts?Also, all the lazy loaded chunks add just about 750kB (gzipped), mainly as we use just a harfbuzz subset.

Consider adding a cache for fonts so they are not loaded for each library item (might be another PR)