Browse Source

Fix regional fonts

pull/137/head
Ionite 1 year ago
parent
commit
6ebc3be68a
No known key found for this signature in database
  1. 1
      StabilityMatrix.Avalonia/App.axaml
  2. 3
      StabilityMatrix.Avalonia/Assets.cs
  3. BIN
      StabilityMatrix.Avalonia/Assets/Fonts/NotoSansJP-Variable.ttf
  4. BIN
      StabilityMatrix.Avalonia/Assets/Fonts/NotoSansJP/NotoSansJP-Regular.ttf
  5. BIN
      StabilityMatrix.Avalonia/Assets/Fonts/NotoSansJP/NotoSansJP-SemiBold.ttf
  6. 0
      StabilityMatrix.Avalonia/Assets/Fonts/NotoSansJP/OFL.txt
  7. 11
      StabilityMatrix.Avalonia/Views/MainWindow.axaml.cs
  8. 1
      StabilityMatrix.Avalonia/Views/SettingsPage.axaml

1
StabilityMatrix.Avalonia/App.axaml

@ -18,6 +18,7 @@
<ResourceInclude Source="Styles/Card.axaml"/>
</ResourceDictionary.MergedDictionaries>
<x:Double x:Key="ContentDialogMaxWidth">700</x:Double>
<FontFamily x:Key="NotoSansJP">avares://StabilityMatrix.Avalonia/Assets/Fonts/NotoSansJP#Noto Sans JP</FontFamily>
</ResourceDictionary>
</Application.Resources>

3
StabilityMatrix.Avalonia/Assets.cs

@ -16,9 +16,6 @@ internal static class Assets
public static AvaloniaResource AppIconPng { get; } =
new("avares://StabilityMatrix.Avalonia/Assets/Icon.png");
public static AvaloniaResource RegionalFontJapanese { get; } =
new("avares://StabilityMatrix.Avalonia/Assets/Fonts/NotoSansJP-Variable.ttf");
/// <summary>
/// Fixed image for models with no images.
/// </summary>

BIN
StabilityMatrix.Avalonia/Assets/Fonts/NotoSansJP-Variable.ttf

Binary file not shown.

BIN
StabilityMatrix.Avalonia/Assets/Fonts/NotoSansJP/NotoSansJP-Regular.ttf

Binary file not shown.

BIN
StabilityMatrix.Avalonia/Assets/Fonts/NotoSansJP/NotoSansJP-SemiBold.ttf

Binary file not shown.

0
StabilityMatrix.Avalonia/Assets/Fonts/NotoSansJP-Variable LICENSE.txt → StabilityMatrix.Avalonia/Assets/Fonts/NotoSansJP/OFL.txt

11
StabilityMatrix.Avalonia/Views/MainWindow.axaml.cs

@ -149,7 +149,10 @@ public partial class MainWindow : AppWindowBase
{
if (Cultures.Current?.Name == "ja-JP")
{
fonts.Add(Assets.RegionalFontJapanese.UriPath.ToString());
var customFont = (Application.Current!.Resources["NotoSansJP"] as FontFamily)!;
Resources["ContentControlThemeFontFamily"] = customFont;
FontFamily = customFont;
return;
}
else if (Compat.IsWindows)
{
@ -171,16 +174,20 @@ public partial class MainWindow : AppWindowBase
else
{
Resources["ContentControlThemeFontFamily"] = FontFamily.Default;
FontFamily = FontFamily.Default;
return;
}
Resources["ContentControlThemeFontFamily"] = new FontFamily(string.Join(",", fonts));
var fontString = new FontFamily(string.Join(",", fonts));
Resources["ContentControlThemeFontFamily"] = fontString;
FontFamily = fontString;
}
catch (Exception e)
{
LogManager.GetCurrentClassLogger().Error(e);
Resources["ContentControlThemeFontFamily"] = FontFamily.Default;
FontFamily = FontFamily.Default;
}
}

1
StabilityMatrix.Avalonia/Views/SettingsPage.axaml

@ -39,7 +39,6 @@
</ui:SettingsExpander>
<ui:SettingsExpander
Grid.Row="2"
IsVisible="{Binding SharedState.IsDebugMode}"
Margin="8,0,8,4"
Header="{x:Static lang:Resources.Label_Language}"
IconSource="Character">

Loading…
Cancel
Save