How should we handle custom fonts?
See original GitHub issueHello š
Iām a but stuck on deciding how we should handle our custom fonts.
At the moment, Iām bundling them within Radix itself. But it seems that in total weāll have about 4 different font families. Bundling them as base64 will increase the bundle size quite a bit - Iām not sure this is a good idea.
Another option is instead of bundling the as base64, I can copy them over to the dist folder and load them in?
Oooor, have some sort of āFont serverā? We can then load the fonts in async, just like Google fonts.
What are your thoughts?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Best practices for fonts - web.dev
This article discusses performance best practices for fonts. There are a variety of ways in which web fonts impact performance:.
Read more >The Easy Way to Add Fonts to Your Website (Including ...
In this article, I will walk you through the step-by-step process for adding any ... Find the custom font you want to use...
Read more >Web fonts - Learn web development - MDN Web Docs - Mozilla
Make sure you have satisfied any licensing requirement if you are going to use this in a commercial and/or Web project. Ā· Go...
Read more >The performance cost of custom web fonts, and how to solve it
Custom web fonts are an essential part of most web design, but they come at a performance cost. This post looks at addressing...
Read more >How To Load and Use Custom Fonts with CSS | DigitalOcean
In this tutorial, you will try out examples of loading fonts onto your website. You will use the font stack, a rank ordering...
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 Free
Top 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

Seems fine ā and weād just add instructions to add the fonts in our āGetting Startedā page in the docs?
Not sure if increasing bundle size is a concern if they have to load the fonts either way. The decrease in bundle size is equal to the increase in the CDN http requests, right? And these fonts arenāt likely to be cached already like a Google font.
So Iād say we should do whatever supports flexibility and the best, smoothest font loading experience for the actual page viewer.
Just wanted to suggest not using base64. Browsers are smart and only download the font file (woff, etc) when some part of the page depends on it (an element on the page has css that sets that specific font family -> file). So you can theoretically define 10+ fonts, but if your page only uses a couple then only those ones get downloaded by the browser. By using base64 you force the download and increase page initialization time. Hosting fonts on a CDN is a great idea; I think of fonts as I would any known static asset.