b
This commit is contained in:
+32
-3
@@ -102,23 +102,52 @@ public sealed unsafe class SDL3Window : IDisposable
|
||||
if (!File.Exists(b.FullPath)) return;
|
||||
|
||||
if (Path.GetExtension(b.FullPath) != ".ttf") return;
|
||||
|
||||
ImGui.GetIO().AddFont(b.FullPath);
|
||||
};
|
||||
_watcher.Deleted += (_, b) =>
|
||||
{
|
||||
if (Path.GetExtension(b.FullPath) != ".ttf") return;
|
||||
|
||||
ImGui.GetIO().RemoveFont(b.Name);
|
||||
};
|
||||
_watcher.Renamed += (_, b) =>
|
||||
{
|
||||
if (Path.GetExtension(b.OldFullPath) != ".ttf") return;
|
||||
ImGui.GetIO().RemoveFont(b.OldName);
|
||||
|
||||
if (!File.Exists(b.FullPath)) return;
|
||||
if (Path.GetExtension(b.FullPath) != ".ttf") return;
|
||||
ImGui.GetIO().AddFont(b.FullPath);
|
||||
};
|
||||
|
||||
_watcher.IncludeSubdirectories = false;
|
||||
_watcher.EnableRaisingEvents = true;
|
||||
|
||||
string[] fonts = Directory.GetFiles(fontsPath, "*.ttf", SearchOption.AllDirectories);
|
||||
List<string> fonts = Directory.GetFiles(fontsPath, "*.ttf", SearchOption.AllDirectories).ToList();
|
||||
fonts.Sort();
|
||||
|
||||
List<string> mergeFonts = new List<string>();
|
||||
for (int i = fonts.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (Path.GetFileName(fonts[i]).StartsWith("merge_", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
mergeFonts.Add(fonts[i]);
|
||||
fonts.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
mergeFonts.Reverse();
|
||||
|
||||
foreach (string merge in mergeFonts)
|
||||
{
|
||||
io.AddFont(merge, true);
|
||||
}
|
||||
|
||||
foreach (string font in fonts)
|
||||
{
|
||||
io.AddFont(font);
|
||||
foreach (string merge in mergeFonts)
|
||||
{
|
||||
io.AddFont(merge, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
Reference in New Issue
Block a user