FontJit, a tiny utility to lazy load fonts
Roel Nieskens
Posts: 219
For whom it might interest, I just released a tiny little font loader to be used on websites where you want to be in control of loading the font: FontJit.
Because it doesn't make sense to show the text inside a type tester in a fallback font, you can use FontJit to hide everything until the font is loaded.
Or if you're showing a large list of previews, you can use it to only load the fonts in (or close to) the viewport, but not those much further down the page—at least until the user scrolls there.
The interface is pretty easy: just slap some data-attributes on the HTML element you want the font to be applied to, and load and trigger FontJit.
I figured some of you might find it useful. Comments and feedback always welcome!
Because it doesn't make sense to show the text inside a type tester in a fallback font, you can use FontJit to hide everything until the font is loaded.
Or if you're showing a large list of previews, you can use it to only load the fonts in (or close to) the viewport, but not those much further down the page—at least until the user scrolls there.
The interface is pretty easy: just slap some data-attributes on the HTML element you want the font to be applied to, and load and trigger FontJit.
I figured some of you might find it useful. Comments and feedback always welcome!
9
Categories
- All Categories
- 47 Introductions
- 4K Typeface Design
- 497 Type Design Critiques
- 590 Type Design Software
- 1.1K Type Design Technique & Theory
- 674 Type Business
- 904 Font Technology
- 29 Punchcutting
- 543 Typography
- 128 Type Education
- 333 Type History
- 82 Type Resources
- 114 Lettering and Calligraphy
- 33 Lettering Critiques
- 81 Lettering Technique & Theory
- 577 Announcements
- 101 Events
- 116 Job Postings
- 174 Type Releases
- 185 Miscellaneous News
- 270 About TypeDrawers
- 54 TypeDrawers Announcements
- 114 Suggestions and Bug Reports