From a104693f97c2f51741f5b8cc211c319a57e473a9 Mon Sep 17 00:00:00 2001 From: Yeechan Lu Date: Sat, 29 Mar 2014 23:16:18 +0800 Subject: [PATCH] Fix performance issues while loading fonts --- Wox/Helper/FontHelper.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Wox/Helper/FontHelper.cs b/Wox/Helper/FontHelper.cs index 6ecba4f48f..64fe18ead1 100644 --- a/Wox/Helper/FontHelper.cs +++ b/Wox/Helper/FontHelper.cs @@ -60,7 +60,10 @@ namespace Wox.Helper public static FamilyTypeface ConvertFromInvariantStringsOrNormal(this FontFamily family, string style, string weight, string stretch) { - return family.FamilyTypefaces.FirstOrDefault(o => o.Style == GetFontStyleFromInvariantStringOrNormal(style) && o.Weight == GetFontWeightFromInvariantStringOrNormal(weight) && o.Stretch == GetFontStretchFromInvariantStringOrNormal(stretch)) + var styleObj = GetFontStyleFromInvariantStringOrNormal(style); + var weightObj = GetFontWeightFromInvariantStringOrNormal(weight); + var stretchObj = GetFontStretchFromInvariantStringOrNormal(stretch); + return family.FamilyTypefaces.FirstOrDefault(o => o.Style == styleObj && o.Weight == weightObj && o.Stretch == stretchObj) ?? family.ChooseRegularFamilyTypeface(); }