Skip to content

Commit 250949f

Browse files
committed
fix: Validate font names before adding to list
Fixes #1347
1 parent 1ee7d11 commit 250949f

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/App.axaml.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,16 @@ private string FixFontFamilyName(string input)
671671
prevChar = c;
672672
}
673673

674-
trimmed.Add(sb.ToString());
674+
var fontName = sb.ToString();
675+
try
676+
{
677+
_ = new Typeface(fontName).GlyphTypeface;
678+
}
679+
catch
680+
{
681+
continue;
682+
}
683+
trimmed.Add(fontName);
675684
}
676685

677686
return trimmed.Count > 0 ? string.Join(',', trimmed) : string.Empty;

0 commit comments

Comments
 (0)