Flutter提供的字体家族的完整列表? [英] Full list of font families provided with Flutter?

查看:103
本文介绍了Flutter提供的字体家族的完整列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Flutter中,我们可以使用TextStyle为文本提供所需的fontFamily属性.虽然某些fontFamily名称很明显并且可以正常工作(例如"Arial","Courier","Times"等),但可用选项的完整列表在哪里?

In Flutter we can use TextStyle to provide a desired fontFamily property for the text. While some fontFamily names are obvious and do work (like 'Arial', 'Courier', 'Times' and so on), where's the full list of available options?

文档( https://api.flutter.dev/flutter/painting/TextStyle/fontFamily.html )无济于事.

推荐答案

我不认为Flutter团队会提供这样的列表.您提到的字体可能是系统默认字体.Flutter通过自定义字体后备"来处理自定义字体的使用.下面列出了如何进行工作的工具片段:

I do not think such a list is provided by the Flutter team. The fonts you mention are probably system default fonts. Flutter handles the use of custom fonts with a 'Custom Font Fallback'. Listed below is a tool snippet of how this goes to work:

在下面的示例中,将尝试使用 Noto Sans CJK SC 然后使用解析字体 Raleway 中不存在的任何字形.> Noto彩色表情符号:

In the following example, any glyphs not present in the font Raleway will be attempted to be resolved with Noto Sans CJK SC, and then with Noto Color Emoji:


const TextStyle(
    fontFamily: 'RaleWay',
    fontFamilyFallback: <String>[
        'Noto Sans CJK SC',
        'Noto Color Emoji',
    ],
)

如果所有自定义后备字体系列都用尽,并且找不到匹配项或未提供自定义后备广告,则将使用平台字体后备广告.

由于您没有提供任何FallBack字体,因此Flutter会自动将默认字体用于您选择的系统.

Since you do not provide any FallBack fonts, Flutter automatically uses the the fonts default to your system of choice.

希望您能理解现在会发生什么!请查看有关如何添加自定义字体的文档:

I hope this you understand what happens now! Please look at the documentation on how to add custom fonts:

Flutter字体文档

这篇关于Flutter提供的字体家族的完整列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆