Skip to content

Commit

Permalink
Android,Linux,Windowsのフォントを変更
Browse files Browse the repository at this point in the history
  • Loading branch information
Npepperlinux committed Nov 19, 2023
1 parent d7d9ac2 commit 3972968
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions lib/view/themes/app_theme_scope.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,18 @@ class AppThemeScopeState extends ConsumerState<AppThemeScope> {
defaultTargetPlatform == TargetPlatform.macOS) {
return "SF Pro Text";
}
if (defaultTargetPlatform == TargetPlatform.linux) {
if (defaultTargetPlatform == TargetPlatform.linux ||
defaultTargetPlatform == TargetPlatform.android) {
return "Noto Sans CJK JP";
}

return "KosugiMaru";
return "Noto Sans";
}

List<String> resolveFontFamilyFallback(String defaultFontName) {
if (defaultTargetPlatform == TargetPlatform.windows ||
defaultTargetPlatform == TargetPlatform.linux) {
if (defaultTargetPlatform == TargetPlatform.windows) {
return [
if (defaultFontName.isNotEmpty) resolveFontFamilyName(""),
"Noto Sans CJK JP",
"KosugiMaru",
"BIZ UDPGothic"
"Noto Sans JP",
];
}
if (defaultTargetPlatform == TargetPlatform.iOS ||
Expand All @@ -103,6 +100,13 @@ class AppThemeScopeState extends ConsumerState<AppThemeScope> {
"Apple Color Emoji",
];
}
if (defaultTargetPlatform == TargetPlatform.android ||
defaultTargetPlatform == TargetPlatform.linux) {
return [
if (defaultFontName.isNotEmpty) resolveFontFamilyName(""),
"Noto Sans CJK JP",
];
}
return [];
}

Expand Down Expand Up @@ -134,7 +138,7 @@ class AppThemeScopeState extends ConsumerState<AppThemeScope> {
fallback.addAll(const ["Segoe UI Emoji", "Noto Color Emoji", "Meiryo"]);
} else if (defaultTargetPlatform == TargetPlatform.android) {
fontName = "Droid Sans Mono";
fallback.addAll(const ["Noto Color Emoji", "Noto Sans JP"]);
fallback.addAll(const ["Noto Color Emoji", "Noto Sans"]);
} else {
fontName = null;
}
Expand Down Expand Up @@ -164,7 +168,7 @@ class AppThemeScopeState extends ConsumerState<AppThemeScope> {
defaultTargetPlatform == TargetPlatform.linux) {
return const TextStyle(
fontFamily: "Noto Color Emoji",
fontFamilyFallback: ["Noto Color Emoji", "Noto Sans JP"]);
fontFamilyFallback: ["Noto Color Emoji", "Noto Sans"]);
}
return const TextStyle();
}
Expand Down

0 comments on commit 3972968

Please sign in to comment.