diff --git a/Bloxstrap/UI/Elements/Settings/Pages/ModsPage.xaml b/Bloxstrap/UI/Elements/Settings/Pages/ModsPage.xaml index 2ce0a73..925c0fc 100644 --- a/Bloxstrap/UI/Elements/Settings/Pages/ModsPage.xaml +++ b/Bloxstrap/UI/Elements/Settings/Pages/ModsPage.xaml @@ -99,7 +99,7 @@ Description="{x:Static resources:Strings.Menu_Mods_Misc_CustomFont_Description}"> - + diff --git a/Bloxstrap/UI/ViewModels/Settings/ModsViewModel.cs b/Bloxstrap/UI/ViewModels/Settings/ModsViewModel.cs index 3a116ff..af6e580 100644 --- a/Bloxstrap/UI/ViewModels/Settings/ModsViewModel.cs +++ b/Bloxstrap/UI/ViewModels/Settings/ModsViewModel.cs @@ -9,8 +9,10 @@ using Windows.Win32.Foundation; using CommunityToolkit.Mvvm.Input; -using Bloxstrap.Models.SettingTasks; using Bloxstrap.AppData; +using System.Drawing.Text; +using Wpf.Ui.Controls; +using System.Windows.Media; namespace Bloxstrap.UI.ViewModels.Settings { @@ -52,9 +54,12 @@ namespace Bloxstrap.UI.ViewModels.Settings TextFontTask.NewState = dialog.FileName; } + OnPropertyChanged(nameof(ChooseCustomFontVisibility)); OnPropertyChanged(nameof(DeleteCustomFontVisibility)); + OnPropertyChanged(nameof(CustomFontName)); + OnPropertyChanged(nameof(DeleteCustomFontFontFamily)); } public ICommand OpenModsFolderCommand => new RelayCommand(OpenModsFolder); @@ -63,6 +68,18 @@ namespace Bloxstrap.UI.ViewModels.Settings public Visibility DeleteCustomFontVisibility => !String.IsNullOrEmpty(TextFontTask.NewState) ? Visibility.Visible : Visibility.Collapsed; + public System.Windows.Media.FontFamily DeleteCustomFontFontFamily => new System.Windows.Media.FontFamily($"{TextFontTask.NewState}#{CustomFontName}"); + + public string CustomFontName + { + get + { + var families = Fonts.GetFontFamilies(TextFontTask.NewState); + var first = families.ElementAt(0); + return first.ToString().Split("#").ElementAt(first.ToString().Split("#").Count() - 1); + } + } + public ICommand ManageCustomFontCommand => new RelayCommand(ManageCustomFont); public ICommand OpenCompatSettingsCommand => new RelayCommand(OpenCompatSettings); diff --git a/Bloxstrap/content/fonts/CustomFont.ttf b/Bloxstrap/content/fonts/CustomFont.ttf new file mode 100644 index 0000000..fc02de4 Binary files /dev/null and b/Bloxstrap/content/fonts/CustomFont.ttf differ