11using System ;
22using System . Collections . Generic ;
33using System . IO ;
4- using System . Text ;
54using System . Text . Json ;
65using System . Text . Json . Serialization ;
76using Avalonia . Collections ;
@@ -66,9 +65,8 @@ public string DefaultFontFamily
6665 get => _defaultFontFamily ;
6766 set
6867 {
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 ) ;
7270 }
7371 }
7472
@@ -77,9 +75,8 @@ public string MonospaceFontFamily
7775 get => _monospaceFontFamily ;
7876 set
7977 {
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 ) ;
8380 }
8481 }
8582
@@ -620,35 +617,6 @@ private bool RemoveInvalidRepositoriesRecursive(List<RepositoryNode> collection)
620617 return changed ;
621618 }
622619
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-
652620 private static Preferences _instance = null ;
653621 private static bool _isLoading = false ;
654622
0 commit comments