[Discovery] Custom Fonts: support `woff2`
See original GitHub issueFeature Description
Currently we’re using opentype.js
for getting the information about the font from the font file URL, however, this library doesn’t support woff2
.
There are some libraries that support woff2
: opentype
and fontkit
. Both of these mention also having browser support, however, apparently both modules require fs
module by default in various places which causes the editor to crash.
There are a few GitHub issues in the repos of both modules stating the concern of not being able to use these in the browser with a bunch of suggested solutions for webpack
, however, many of those didn’t work when trying / were quite outdated and caused more issues.
We should take another look to figure out a way to support woff2
.
Alternatives Considered
Additional Context
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:7
Top Results From Across the Web
Best practices for fonts - web.dev
Use WOFF2 # Of the modern font fonts, WOFF2 is the newest, has the widest browser support, and offers the best compression. Because...
Read more >Add support for WOFF2 · Issue #183 · opentypejs/opentype.js
Is it time to add support for it to opentype.js? ... [Discovery] Custom Fonts: support woff2 GoogleForCreators/web-stories-wp#10020.
Read more >Upload custom fonts | Webflow University
If you want to use custom fonts on your site, open Site settings > Fonts tab, scroll down to Custom fonts, and upload...
Read more >How to load your custom fonts in a smart way · In the Mist
1. Use modern font type (woff and woff2). First, review your css files which defined font-face. It should be something like this: /*...
Read more >How to use web fonts in CSS: A tutorial with examples
Reliable custom font use was only possible with image replacement or plugins such as Flash. Basic support for web fonts was introduced in ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Let’s not close this issue before we actually decide what to do and if we need a follow-up implementation issue or not 😃 Moving to Review instead.
Bottom line: most of those libraries aren’t written with the browser in mind and would require some modifications to work either by switching out the dependencies (forking or patching with upstream PRs?) or implementing woff2 support.
We don’t need most of the features that libraries like
fontkit
offer (consider bundle size), we don’t need writing to font files (includes Brotli compression), we just need to read some of the font metrics. So it makes some sense to develop our tailor-made solution, but it will take time (days). On the other hand, woff2 fonts can be easily converted to woff1 by the end-user.Depending on the demand, we should decide what to do next.