Skip to content

Commit 108e2d6

Browse files
committed
fix: Patch fonts for Windows
1 parent 298f47b commit 108e2d6

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/main.dart

+16
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,20 @@ void mainLoop() {
239239

240240
final rootNavigatorKey = GlobalKey<NavigatorState>();
241241

242+
String? getWindowsFont(AppTheme theme) {
243+
if (!Platform.isWindows) return null;
244+
245+
final lc = theme.locale?.languageCode.toLowerCase();
246+
final cc = theme.locale?.scriptCode?.toLowerCase();
247+
248+
if (lc == 'ja') return "Yu Gothic";
249+
if (lc == 'ko') return 'Malgun Gothic';
250+
if (lc == 'zh' && cc == 'hant') return "Microsoft JhengHei";
251+
if (lc == 'zh' && cc == 'hans') return "Microsoft YaHei";
252+
253+
return null;
254+
}
255+
242256
class Rune extends StatefulWidget {
243257
const Rune({super.key});
244258

@@ -281,10 +295,12 @@ class _RuneState extends State<Rune> {
281295
color: appTheme.color,
282296
themeMode: appTheme.mode,
283297
theme: FluentThemeData(
298+
fontFamily: getWindowsFont(appTheme),
284299
accentColor: appTheme.color,
285300
visualDensity: VisualDensity.standard,
286301
),
287302
darkTheme: FluentThemeData(
303+
fontFamily: getWindowsFont(appTheme),
288304
brightness: Brightness.dark,
289305
accentColor: appTheme.color,
290306
visualDensity: VisualDensity.standard,

0 commit comments

Comments
 (0)