question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Discovery] Custom Fonts: support `woff2`

See original GitHub issue

Feature 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:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:7

github_iconTop GitHub Comments

1reaction
miinacommented, Feb 1, 2022

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.

1reaction
merapicommented, Feb 1, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found