From f8a4c73367c67ace97045a530057907c76ea6785 Mon Sep 17 00:00:00 2001 From: "H. Utku Maden" Date: Fri, 21 Jun 2024 11:59:04 +0300 Subject: [PATCH] Fix load order in FallbackFontDatabase. --- Quik.Media.Defaults/Fallback/FallbackFontDatabase.cs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/Quik.Media.Defaults/Fallback/FallbackFontDatabase.cs b/Quik.Media.Defaults/Fallback/FallbackFontDatabase.cs index f3dfd19..f43738a 100644 --- a/Quik.Media.Defaults/Fallback/FallbackFontDatabase.cs +++ b/Quik.Media.Defaults/Fallback/FallbackFontDatabase.cs @@ -41,6 +41,8 @@ namespace Quik.Media.Defaults.Fallback VerifyDatabase(database); FlushDatabase(database); + database.ForEach(x => AddFont(x.Face, new FileInfo(x.FilePath))); + (FontFace, FileInfo) serif = FontDataBaseProvider.ResolveSystemFont(EnvironmentVariables.SerifFont, LinuxFonts.DefaultSerifFamilies, this); SystemFonts[SystemFontFamily.Serif] = serif.Item1; (FontFace, FileInfo) sans = FontDataBaseProvider.ResolveSystemFont(EnvironmentVariables.SansFont, LinuxFonts.DefaultSansFamilies, this); @@ -51,14 +53,6 @@ namespace Quik.Media.Defaults.Fallback SystemFonts[SystemFontFamily.Cursive] = cursive.Item1; (FontFace, FileInfo) fantasy = FontDataBaseProvider.ResolveSystemFont(EnvironmentVariables.FantasyFont, LinuxFonts.DefaultFantasyFamilies, this); SystemFonts[SystemFontFamily.Fantasy] = fantasy.Item1; - - AddFont(serif.Item1, serif.Item2); - AddFont(sans.Item1, sans.Item2); - AddFont(mono.Item1, mono.Item2); - AddFont(cursive.Item1, cursive.Item2); - AddFont(fantasy.Item1, fantasy.Item2); - - database.ForEach(x => AddFont(x.Face, new FileInfo(x.FilePath))); } public FileInfo FontFileInfo(FontFace face) @@ -241,7 +235,7 @@ namespace Quik.Media.Defaults.Fallback { FileInfo info = new FileInfo(DbPath); Directory.CreateDirectory(Path.GetDirectoryName(DbPath)); - using Stream str = info.OpenWrite(); + using Stream str = info.Open(FileMode.Create); JsonSerializer.Serialize(str, db); }