Reputation: 6158
Below is my test code:
Text(
'I love 中国',
style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.w300,
color: Colors.red,
),
),
Text(
'I love 中国',
style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.w500,
color: Colors.red,
),
),
Result:
You can see with different fontWeight letter works but Chinese act the same.
How can I solve it?
My flutter is 3.3.2.
Note: run on iOS.
Upvotes: 0
Views: 672
Reputation: 6158
theme
in your MaterialApp
:theme: ThemeData(
fontFamily: "PingFang SC",
),
fontFamilyFallback
where you need:Text(
'I love 中国',
style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.w500,
color: Colors.red,
fontFamilyFallback: ["PingFang SC", "Heiti SC"],
),
),
DefaultTextStyle
with fontFamilyFallback
:DefaultTextStyle(
style: TextStyle(
fontFamilyFallback: ["PingFang SC", "Heiti SC"],
color: Colors.red,
fontSize: 30,
),
child: Column(
children: [
Text(
'I love 中国',
style: TextStyle(
fontWeight: FontWeight.w400,
),
),
Text(
'I love 中国',
style: TextStyle(
fontWeight: FontWeight.w300,
),
),
Text(
'I love 中国',
style: TextStyle(
fontWeight: FontWeight.w500,
),
),
],
),
),
Upvotes: 0
Reputation: 1727
Flutter will search for a font on the host system that is closest to the specified font weight. But if the system only provides one font that handles the requested characters, then Flutter and Skia will synthesize a "fake bold" version of that font to handle other font weights.
Due to issue on github
Upvotes: 2