Use Lock instead of .ImFont

This commit is contained in:
Soreepeong 2024-01-21 04:49:51 +09:00
parent af1133f999
commit 3e3297f7a8

View file

@ -725,13 +725,16 @@ internal class InterfaceManager : IDisposable, IServiceType
// Do not use DefaultFont, IconFont, and MonoFont. // Do not use DefaultFont, IconFont, and MonoFont.
// Use font handles directly. // Use font handles directly.
using var defaultFont = this.DefaultFontHandle.Lock();
using var monoFont = this.MonoFontHandle.Lock();
// Fill missing glyphs in MonoFont from DefaultFont // Fill missing glyphs in MonoFont from DefaultFont
tk.CopyGlyphsAcrossFonts(this.DefaultFontHandle.ImFont, this.MonoFontHandle.ImFont, true); tk.CopyGlyphsAcrossFonts(defaultFont, monoFont, true);
// Update default font // Update default font
unsafe unsafe
{ {
ImGui.GetIO().NativePtr->FontDefault = this.DefaultFontHandle.ImFont; ImGui.GetIO().NativePtr->FontDefault = defaultFont;
} }
// Broadcast to auto-rebuilding instances // Broadcast to auto-rebuilding instances