1
1
using System ;
2
2
using System . Collections . Generic ;
3
3
using System . IO ;
4
- using System . Text ;
5
4
using System . Text . Json ;
6
5
using System . Text . Json . Serialization ;
7
6
using Avalonia . Collections ;
@@ -66,9 +65,8 @@ public string DefaultFontFamily
66
65
get => _defaultFontFamily ;
67
66
set
68
67
{
69
- var name = FixFontFamilyName ( value ) ;
70
- if ( SetProperty ( ref _defaultFontFamily , name ) && ! _isLoading )
71
- App . SetFonts ( _defaultFontFamily , _monospaceFontFamily , _onlyUseMonoFontInEditor ) ;
68
+ if ( SetProperty ( ref _defaultFontFamily , value ) && ! _isLoading )
69
+ App . SetFonts ( value , _monospaceFontFamily , _onlyUseMonoFontInEditor ) ;
72
70
}
73
71
}
74
72
@@ -77,9 +75,8 @@ public string MonospaceFontFamily
77
75
get => _monospaceFontFamily ;
78
76
set
79
77
{
80
- var name = FixFontFamilyName ( value ) ;
81
- if ( SetProperty ( ref _monospaceFontFamily , name ) && ! _isLoading )
82
- App . SetFonts ( _defaultFontFamily , _monospaceFontFamily , _onlyUseMonoFontInEditor ) ;
78
+ if ( SetProperty ( ref _monospaceFontFamily , value ) && ! _isLoading )
79
+ App . SetFonts ( _defaultFontFamily , value , _onlyUseMonoFontInEditor ) ;
83
80
}
84
81
}
85
82
@@ -620,35 +617,6 @@ private bool RemoveInvalidRepositoriesRecursive(List<RepositoryNode> collection)
620
617
return changed ;
621
618
}
622
619
623
- private string FixFontFamilyName ( string name )
624
- {
625
- var trimmed = name . Trim ( ) ;
626
- if ( string . IsNullOrEmpty ( trimmed ) )
627
- return string . Empty ;
628
-
629
- var builder = new StringBuilder ( ) ;
630
- var lastIsSpace = false ;
631
- for ( int i = 0 ; i < trimmed . Length ; i ++ )
632
- {
633
- var c = trimmed [ i ] ;
634
- if ( char . IsWhiteSpace ( c ) )
635
- {
636
- if ( lastIsSpace )
637
- continue ;
638
-
639
- lastIsSpace = true ;
640
- }
641
- else
642
- {
643
- lastIsSpace = false ;
644
- }
645
-
646
- builder . Append ( c ) ;
647
- }
648
-
649
- return builder . ToString ( ) ;
650
- }
651
-
652
620
private static Preferences _instance = null ;
653
621
private static bool _isLoading = false ;
654
622
0 commit comments