疑问
在用 Flutter 做移动端开发时,在蓝湖上看到字体的属性为:
字体: 苹方-简 细体
字重: Light
那么,这个 细体 Light 对应的 FontWeight 到底是多少呢?
解答
目前 iOS 系统中 苹方-简 字体包含六种字重:
Ultralight、Thin、Light、Regular、Medium、Semibold
和 Flutter 中的 FontWeight值 对应关系如下:
| 中文 | 英文 | FontWeight值 |
|---|---|---|
| 苹方-简 极细体 | PingFangSC-Ultralight | w100 |
| 苹方-简 纤细体 | PingFangSC-Thin | w200 |
| 苹方-简 细体 | PingFangSC-Light | w300 |
| 苹方-简 常规体 | PingFangSC-Regular | w400 or normal |
| 苹方-简 中黑体 | PingFangSC-Medium | w500 |
| 苹方-简 中粗体 | PingFangSC-Semibold | w600 |
注意
需要注意一点:Flutter 中 FontWeight.bold 对应的值是 w700 。
我在之前的开发中,看到蓝湖中标注为 苹方-简 中黑体 Medium 的字体就会设置为 fontWeight: FontWeight.bold, 后来才发现一直设置的都是错的。