Skip to content

Commit

Permalink
fix: Patch fonts for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Losses committed Nov 26, 2024
1 parent 298f47b commit 108e2d6
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,20 @@ void mainLoop() {

final rootNavigatorKey = GlobalKey<NavigatorState>();

String? getWindowsFont(AppTheme theme) {
if (!Platform.isWindows) return null;

final lc = theme.locale?.languageCode.toLowerCase();
final cc = theme.locale?.scriptCode?.toLowerCase();

if (lc == 'ja') return "Yu Gothic";
if (lc == 'ko') return 'Malgun Gothic';
if (lc == 'zh' && cc == 'hant') return "Microsoft JhengHei";
if (lc == 'zh' && cc == 'hans') return "Microsoft YaHei";

return null;
}

class Rune extends StatefulWidget {
const Rune({super.key});

Expand Down Expand Up @@ -281,10 +295,12 @@ class _RuneState extends State<Rune> {
color: appTheme.color,
themeMode: appTheme.mode,
theme: FluentThemeData(
fontFamily: getWindowsFont(appTheme),
accentColor: appTheme.color,
visualDensity: VisualDensity.standard,
),
darkTheme: FluentThemeData(
fontFamily: getWindowsFont(appTheme),
brightness: Brightness.dark,
accentColor: appTheme.color,
visualDensity: VisualDensity.standard,
Expand Down

0 comments on commit 108e2d6

Please sign in to comment.