From 5bc35cf92b43fa54a3771db3bd36b922ca8b8e83 Mon Sep 17 00:00:00 2001 From: Stone-Red-Code <56473591+Stone-Red-Code@users.noreply.github.com> Date: Wed, 15 Sep 2021 19:49:47 +0200 Subject: [PATCH] - Removed font mono space check. --- src/DesktopMagic/MainWindow.xaml.cs | 39 ++++++----------------------- 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/src/DesktopMagic/MainWindow.xaml.cs b/src/DesktopMagic/MainWindow.xaml.cs index ff11bcd..ef50509 100644 --- a/src/DesktopMagic/MainWindow.xaml.cs +++ b/src/DesktopMagic/MainWindow.xaml.cs @@ -667,41 +667,18 @@ namespace DesktopMagic char[] chars = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }; foreach (FontFamily ff in Fonts.SystemFontFamilies) { - double charWidth = -1; - bool monospace = true; - - textBlock.FontFamily = ff; - - foreach (char c in chars) + ComboBoxItem comboBoxItem = new() { - textBlock.Text = ""; + FontFamily = ff, + Content = ff.ToString() + }; + _ = fontComboBox.Items.Add(comboBoxItem); - textBlock.Text += c.ToString(); - - textBlock.UpdateLayout(); - - if (charWidth != textBlock.ActualWidth && charWidth != -1) - { - monospace = false; - break; - } - charWidth = textBlock.ActualWidth; - } - if (monospace) + if (ff.ToString() == GlobalFont) { - ComboBoxItem comboBoxItem = new() - { - FontFamily = ff, - Content = ff.ToString() - }; - _ = fontComboBox.Items.Add(comboBoxItem); - - if (ff.ToString() == GlobalFont) - { - fontComboBox.SelectedIndex = index; - } - index++; + fontComboBox.SelectedIndex = index; } + index++; } if (fontComboBox.SelectedIndex == -1) {