/// <summary> /// load font list /// </summary> public void LoadFontList() { FontItems.Clear(); var currentLanguages = Cultures.ToDictionary((e) => e.CultureInfo.Name); foreach (FontFamily fontFamily in Fonts.SystemFontFamilies) { foreach (var culture in Cultures) { XmlLanguage userLanguage = XmlLanguage.GetLanguage(culture.CultureInfo.Name); LanguageSpecificStringDictionary dictionary = fontFamily.FamilyNames; if (dictionary.ContainsKey(userLanguage) == false) { continue; } var fontName = dictionary[userLanguage]; if (_searchWord.Length > 0) { if (!fontName.Contains(_searchWord)) { continue; } } var fontModel = new MogeraFontModel() { FontFamily = fontFamily, FontName = fontName, }; FontItems.Add(new FontItemViewModel(fontModel)); } } }
/// <summary> /// constructor /// </summary> /// <param name="fontModel">font model</param> /// <param name="parent">parent font model</param> public FontItemViewModel(MogeraFontModel fontModel) { _fontModel = fontModel; }