diff --git a/HellionChat/FontManager.cs b/HellionChat/FontManager.cs index c9e11b4..07e94d5 100644 --- a/HellionChat/FontManager.cs +++ b/HellionChat/FontManager.cs @@ -100,6 +100,19 @@ public class FontManager JpRange = BuildRange(GlyphRangesJapanese.GlyphRanges); } + /// + /// Async wrapper around for the Phase-1 LoadAsync + /// path. The font-atlas build is CPU-bound, so we offload via Task.Run and + /// honour the cancellation token at the scheduling boundary; this lets the + /// font build run in parallel with the theme init without blocking the + /// loader. Settings-driven manual rebuilds keep using the sync entry point. + /// + public async Task BuildFontsAsync(CancellationToken cancellationToken) + { + cancellationToken.ThrowIfCancellationRequested(); + await Task.Run(BuildFonts, cancellationToken).ConfigureAwait(false); + } + public void BuildFonts() { SetUpRanges(); diff --git a/HellionChat/Plugin.cs b/HellionChat/Plugin.cs index dc14cf3..d6b3728 100755 --- a/HellionChat/Plugin.cs +++ b/HellionChat/Plugin.cs @@ -490,11 +490,10 @@ public sealed class Plugin : IAsyncDalamudPlugin // Group A: Font + Theme parallel — both CPU-bound, independent, and // dominate the load-time profile. Everything else stays sequential to // keep ordering simple. - var fontTask = Task.Run(() => + var fontTask = Task.Run(async () => { FontManager = new FontManager(); - // TODO(v1.4.x): replace with FontManager.BuildFontsAsync(cancellationToken) - FontManager.BuildFonts(); + await FontManager.BuildFontsAsync(cancellationToken).ConfigureAwait(false); }, cancellationToken); var themeTask = Task.Run(() =>