【发布时间】:2020-08-17 18:00:12
【问题描述】:
我正在尝试使用字体系列 NunitoSans 并且我必须修改预先存在的应用程序。这是 pubspec.yaml 文件在字体方面的样子:
flutter:
fonts:
- family: NunitoSans
fonts:
- asset: fonts/NunitoSans-Regular.ttf
weight: 600
- asset: fonts/NunitoSans-ExtraLight.ttf
weight: 100
- asset: fonts/NunitoSans-Light.ttf
weight: 200
- asset: fonts/NunitoSans-SemiBold.ttf
weight: 700
- asset: fonts/NunitoSans-Bold.ttf
weight: 800
- asset: fonts/NunitoSans-ExtraBold.ttf
weight: 900
- family: OverpassMono
fonts:
- asset: fonts/OverpassMono-Regular.ttf
weight: 600
- asset: fonts/OverpassMono-Light.ttf
weight: 100
- family: AppIcons
fonts:
- asset: fonts/AppIcons.ttf
weight: 500
assets:
- assets/QR.svg
- assets/welcome_animation.flr
- assets/send_animation.flr
这就是我尝试使用字体的方式。如果我放了除 fonts/NunitoSans-Regualar.ttf 以外的任何东西,我会收到一个错误,即此字体不存在于所需位置。
final font1 = await rootBundle.load('fonts/NunitoSans-Regular.ttf');
final font2 = await rootBundle.load('fonts/NunitoSans-Regular.ttf');
感谢任何帮助。这是我的完整错误(链接没有帮助我抱歉):
Courier has no Unicode support see https://github.com/DavBfr/dart_pdf/wiki/Fonts-Management
The font is not in my assets, its like this:
【问题讨论】:
-
由于 Courier 未在您的任何字体选择中列出,因此在未找到请求的字体时必须使用它。
-
关于如何找到所需字体的任何想法?
-
只要确保它已安装在您的系统中。
-
它已安装,这就是为什么我无法弄清楚为什么我无法访问它
标签: android-studio flutter dart fonts