I have added the font in pubspec.yaml
Any True Type Font
works just fine. But, when I add Open Type Font
it doesn't work.
Here is my how I added font in pubspec.yaml
fonts:
- family: Kufyan
fonts:
- asset: assets/fonts/Kufyan.otf
The flutter recent version v1.12.13 does not support the open type font(otf) directly. You have to convert the otf to true type font(ttf) somehow. You can use this third-party website to covert the font to ttf before using it in your project. You can refer to the guide on how to use custom fonts in flutter for more information.
Flutter matches the font family based on the metadata in the font itself. So defining family: Kufyan
is not required in pubspec.yml
Note: OTF is now officially supported, see supported font types
✔️ Officially works since 24 feb of 2021
Proofs
Since this commit (GitHub)
Current docs state look here (Flutter docs)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With