A little extra help for styling your text
I recently learned about a little known corner of the Flutter world: Font Features. I’ll share that with you today. Keep it in the back of your mind and when you need it, just do a search for Flutter Font Features. You’ll probably end up back here because there isn’t much out there about Font Features except for the documentation, and even that is a little sparse.
Changing the font
This article isn’t primarily about changing the font family, but since it is related to fonts, I’ll start by briefly reviewing how to use different fonts in your app.
System fonts
The default font on Android is Roboto
and on iOS it is .SF UI Display
or .SF UI Text
(SF meaning San Francisco). If you want to use a different font, then you will need to add it to your app.
They look the same to me.
Your own custom fonts
I’ve written before about how to add your own custom font to your project, so I won’t go into detail, but the basic process is the following:
- Add a font to your assets folder.
2. Register the font in pubspec.yaml.
flutter:
fonts:
- family: MyFont
fonts:
…