protected override void ApplyFontToWindow() { if (DefaultFontFamily == null) { DefaultFontFamily = this.FontFamily; SelectedFontFamily = DefaultFontFamily; FontList.Clear(); FontList.AddRange(Fonts.GetFontFamilies(Environment.GetFolderPath(Environment.SpecialFolder.Fonts)).ToList()); } base.ApplyFontToWindow(); }
public static async void LoadAllFont(Action complete) { if (FontList == null) { IsLoaded = false; FontList = new List <KeyName>(); } //사용자 폰트 var folder = await Windows.Storage.ApplicationData.Current.LocalFolder.CreateFolderAsync("Fonts", CreationCollisionOption.OpenIfExists); var files = await folder.GetFilesAsync(); //삭제 대상 폰트 var reservedDeletionFontList = FontDAO.GetTempFontList(); //사용자폰트 로드 foreach (var file in files.OrderBy(x => x.Name)) { foreach (var fontItem in await GetFontItems(file)) { if (!FontList.Any(x => x.Key.ToString() == fontItem.Key.ToString()) && !reservedDeletionFontList.Any(x => x == (fontItem.Payload as StorageFile).Path)) { FontList.Add(fontItem); //System.Diagnostics.Debug.WriteLine($"모든 폰트 로드 : {fontItem.Key}"); } } } //기본값 FontList.Add(new KeyName(FONT_FAMILY_DEFAUT, FONT_FAMILY_DEFAUT) { Type = FontTypes.OS.ToString() }); //시스템 폰트 IList <NativeHelper.Font> systemFontList = NativeHelper.FontList.GetSystemFontList("en-us"); FontList.AddRange(systemFontList.Where(x => !IgnoreFonts.Contains(x.FamilyName) && !string.IsNullOrWhiteSpace(x.FamilyName)) .Select(x => new KeyName(x.FamilyName, x.FamilyName) { Type = FontTypes.OS.ToString() })); IsLoaded = true; complete?.Invoke(); }