@@ -285,15 +285,15 @@ public static void SetFonts(string defaultFont, string monospaceFont)
285285 if ( ! string . IsNullOrEmpty ( defaultFont ) )
286286 {
287287 monospaceFont = $ "fonts:SourceGit#JetBrains Mono,{ defaultFont } ";
288- resDic . Add ( "Fonts.Monospace" , new FontFamily ( monospaceFont ) ) ;
288+ resDic . Add ( "Fonts.Monospace" , FontFamily . Parse ( monospaceFont ) ) ;
289289 }
290290 }
291291 else
292292 {
293293 if ( ! string . IsNullOrEmpty ( defaultFont ) && ! monospaceFont . Contains ( defaultFont , StringComparison . Ordinal ) )
294294 monospaceFont = $ "{ monospaceFont } ,{ defaultFont } ";
295295
296- resDic . Add ( "Fonts.Monospace" , new FontFamily ( monospaceFont ) ) ;
296+ resDic . Add ( "Fonts.Monospace" , FontFamily . Parse ( monospaceFont ) ) ;
297297 }
298298
299299 if ( resDic . Count > 0 )
@@ -663,9 +663,8 @@ private string FixFontFamilyName(string input)
663663 if ( string . IsNullOrEmpty ( t ) )
664664 continue ;
665665
666- // Collapse multiple spaces into single space
667- var prevChar = '\0 ' ;
668666 var sb = new StringBuilder ( ) ;
667+ var prevChar = '\0 ' ;
669668
670669 foreach ( var c in t )
671670 {
@@ -676,14 +675,16 @@ private string FixFontFamilyName(string input)
676675 }
677676
678677 var name = sb . ToString ( ) ;
679- if ( name . Contains ( '#' ) )
678+ try
680679 {
681- if ( ! name . Equals ( "fonts:Inter#Inter" , StringComparison . Ordinal ) &&
682- ! name . Equals ( "fonts:SourceGit#JetBrains Mono" , StringComparison . Ordinal ) )
683- continue ;
680+ var fontFamily = FontFamily . Parse ( name ) ;
681+ if ( fontFamily . FamilyTypefaces . Count > 0 )
682+ trimmed . Add ( name ) ;
683+ }
684+ catch
685+ {
686+ // Ignore exceptions.
684687 }
685-
686- trimmed . Add ( name ) ;
687688 }
688689
689690 return trimmed . Count > 0 ? string . Join ( ',' , trimmed ) : string . Empty ;
0 commit comments