Fix load order in FallbackFontDatabase.

This commit is contained in:
H. Utku Maden 2024-06-21 11:59:04 +03:00
parent 88e060a92b
commit f8a4c73367

@ -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);
}