Open FetFrumos opened 2 years ago
I'd find it helpful if you shared a small but complete example of the issue.
Some places where this could possibly go wrong:
Obviously if it's that last point, there's a bug in this package. A reproduction case would be able to narrow this down.
Is there any updates on this. I am appearing to have the same issue. Font is loaded before image is rendered and font is available for use in the app. I am building the app for web using canvaskit.
Is there any updates on this. I am appearing to have the same issue. Font is loaded before image is rendered and font is available for use in the app. I am building the app for web using canvaskit.
You need to load the font when executing the application.
void main() async {
runApp(const MyApp());
}
void loadFont() async {
var fontLoader = FontLoader("FontName");
fontLoader.addFont(rootBundle.load('fonts/FontName.ttf'));
await fontLoader.load();
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
loadFont();
return Container();
}
}
Please note that sometimes the font-family is specified in extra quotes in the svg file
font-family="FontName"
and
font-family="'FontName'"
these are different things, and, accordingly, you need to import different fonts
var fontLoader = FontLoader("FontName");
var fontLoader = FontLoader("'FontName'");
I have svg image(export from Adobe Xd). For the correct display of this file, I need to install an additional font in the system(MAC or Windows) - then the picture is displayed correctly, without this font it is incorrect. but I need to display this drawing in application. I using flutter_svg plugin. I download ttf of font, add in assets and pubspec. But after that it doesn't work either. how add custom font for svg image(with flutter_svg)?