refactor(fonts): hybrid FontManager init via SuppressAutoRebuild
Move font handle creation from BuildFonts() into the FontManager ctor inside a single atlas.SuppressAutoRebuild() block. Axis, AxisItalic and FontAwesome become init-only IFontHandle properties; RegularFont and ItalicFont stay mutable so the live font-settings rebuild path keeps working without a plugin reload. - BuildFonts() renamed to RebuildDelegateFonts(), scope reduced to the delegate fonts only - BuildFontsAsync() removed; Task.Run had no purpose with ctor-init - FontManagerInitHostedService deleted; PluginHostFactory drops the matching AddHostedService registration - PluginHostFactory FontManager registration takes IDalamudPluginInterface via factory lambda - Settings save path now calls RebuildDelegateFonts() instead of BuildFonts() - Plugin.Draw push site gets a null-forgiving for the nullable RegularFont with a one-line WHY
This commit is contained in:
+11
-6
@@ -307,11 +307,13 @@ public sealed class Plugin : IAsyncDalamudPlugin
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
// Container drives service init now: Host.StartAsync triggers the
|
||||
// IHostedService adapters (FontManager.BuildFonts, ThemeRegistry
|
||||
// cache warmup + Switch, IPC eager-resolve, MessageManager
|
||||
// FilterAllTabsAsync, AutoTellTabsService.Initialize). Window
|
||||
// registration with WindowSystem runs on the framework thread
|
||||
// inside PluginLifecycle.LoadAsync after StartAsync returns.
|
||||
// remaining IHostedService adapters (ThemeRegistry cache warmup +
|
||||
// Switch, IPC eager-resolve, MessageManager FilterAllTabsAsync,
|
||||
// AutoTellTabsService.Initialize). FontManager runs its own init
|
||||
// inline inside the ctor's SuppressAutoRebuild block on eager
|
||||
// resolve. Window registration with WindowSystem runs on the
|
||||
// framework thread inside PluginLifecycle.LoadAsync after
|
||||
// StartAsync returns.
|
||||
if (_lifecycle is not null)
|
||||
await _lifecycle.LoadAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
@@ -911,7 +913,10 @@ public sealed class Plugin : IAsyncDalamudPlugin
|
||||
Interface.UiBuilder.DisableUserUiHide = !Config.HideWhenUiHidden;
|
||||
ChatLogWindow.DefaultText = ImGui.GetStyle().Colors[(int)ImGuiCol.Text];
|
||||
|
||||
using ((Config.FontsEnabled ? FontManager.RegularFont : FontManager.Axis).Push())
|
||||
// RegularFont is nullable only because the live rebuild path
|
||||
// disposes it before reassigning; both ends of that swap happen on
|
||||
// this same draw thread, so it cannot be null here.
|
||||
using ((Config.FontsEnabled ? FontManager.RegularFont! : FontManager.Axis).Push())
|
||||
WindowSystem.Draw();
|
||||
|
||||
ChatLogWindow.FinalizeFrame();
|
||||
|
||||
Reference in New Issue
Block a user