Call RebuildFonts on next Framework.Tick on NewFontRef (#926)

This commit is contained in:
kizer 2022-07-18 00:41:27 +09:00 committed by GitHub
parent 396e5fefca
commit 8cb28d0ebe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,6 +6,7 @@ using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Dalamud.Data; using Dalamud.Data;
using Dalamud.Game;
using Dalamud.Interface.Internal; using Dalamud.Interface.Internal;
using Dalamud.Utility.Timing; using Dalamud.Utility.Timing;
using ImGuiNET; using ImGuiNET;
@ -184,16 +185,9 @@ namespace Dalamud.Interface.GameFonts
needRebuild = !this.fonts.ContainsKey(style); needRebuild = !this.fonts.ContainsKey(style);
if (needRebuild) if (needRebuild)
{ {
if (interfaceManager.IsBuildingFontsBeforeAtlasBuild && this.isBetweenBuildFontsAndRightAfterImGuiIoFontsBuild) Log.Information("[GameFontManager] NewFontRef: Queueing RebuildFonts because {0} has been requested.", style.ToString());
{ Service<Framework>.GetAsync()
Log.Information("[GameFontManager] NewFontRef: Building {0} right now, as it is called while BuildFonts is already in progress yet atlas build has not been called yet.", style.ToString()); .ContinueWith(task => task.Result.RunOnTick(() => interfaceManager.RebuildFonts()));
this.EnsureFont(style);
}
else
{
Log.Information("[GameFontManager] NewFontRef: Calling RebuildFonts because {0} has been requested.", style.ToString());
interfaceManager.RebuildFonts();
}
} }
return new(this, style); return new(this, style);