fix get Win32FamilyNames

pull/3189/head
2dust 2 years ago
parent 33dcef2285
commit f879235564

@ -69,6 +69,7 @@ namespace v2rayN.Views
var dir = new DirectoryInfo(Utils.GetFontsPath()); var dir = new DirectoryInfo(Utils.GetFontsPath());
var files = dir.GetFiles("*.ttf"); var files = dir.GetFiles("*.ttf");
var culture = _config.uiItem.currentLanguage.Equals(Global.Languages[0]) ? "zh-cn" : "en-us"; var culture = _config.uiItem.currentLanguage.Equals(Global.Languages[0]) ? "zh-cn" : "en-us";
var culture2 = "en-us";
foreach (var it in files) foreach (var it in files)
{ {
var families = Fonts.GetFontFamilies(Utils.GetFontsPath(it.Name)); var families = Fonts.GetFontFamilies(Utils.GetFontsPath(it.Name));
@ -85,9 +86,13 @@ namespace v2rayN.Views
} }
var fontFamily = glyph.Win32FamilyNames[new CultureInfo(culture)]; var fontFamily = glyph.Win32FamilyNames[new CultureInfo(culture)];
if (Utils.IsNullOrEmpty(fontFamily)) if (Utils.IsNullOrEmpty(fontFamily))
{
fontFamily = glyph.Win32FamilyNames[new CultureInfo(culture2)];
if (Utils.IsNullOrEmpty(fontFamily))
{ {
continue; continue;
} }
}
cmbcurrentFontFamily.Items.Add(fontFamily); cmbcurrentFontFamily.Items.Add(fontFamily);
break; break;
} }

Loading…
Cancel
Save