New package: dynamic_fonts, like google_fonts but for arbitrary fonts hosted anywhere
I recently released dynamic_fonts: a package that lets you load fonts dynamically just like google_fonts, but from any arbitrary web host.
It's really just a fork of google_fonts with more of the API exposed and with some hooks to allow registering your own fonts.
Why would you use this?
If there is a font that you know you're going to use in your app, just bundle it normally. Don't bother with this package.
But if your app e.g. offers users multiple choices of fonts, and
- Some fonts may not be used at all, depending on user preferences
- Bundling all of the fonts would bloat your app too much
then this package gives you a convenient way to load your fonts dynamically and keep your initial download slim.
I am using the package in production right now in my app Orgro, an org-mode file viewer for iOS and Android. I wanted to offer a font not included in Google Fonts, and this seemed like the best way to do so without actually bundling it.
Posted Aug 1, 2020, 1:50 PM UTC