diff --git a/HellionChat/FontManager.cs b/HellionChat/FontManager.cs index 88d9a42..1ceb3ea 100644 --- a/HellionChat/FontManager.cs +++ b/HellionChat/FontManager.cs @@ -13,15 +13,17 @@ namespace HellionChat; // AddFontWithFallback); a ctor-injected ILogger would not be reachable // from those scopes, so the class stays on Plugin.LogProxy. // -// Hybrid handle model: Axis, AxisItalic and FontAwesome are tied to the -// game's current font state and never change for the lifetime of the -// plugin, so they are init-only. RegularFont and ItalicFont depend on -// user-toggleable settings and get replaced live via RebuildDelegateFonts -// when those settings change; they stay as mutable nullable fields. +// Hybrid handle model: Axis and AxisItalic mirror the game's current +// font state and are init-only. FontAwesome reuses Dalamud's UiBuilder +// fixed-width icon handle and is likewise init-only. RegularFont and +// ItalicFont depend on user-toggleable settings and get replaced live +// via RebuildDelegateFonts when those settings change; they stay as +// mutable nullable fields. // -// All five handles register inside a single SuppressAutoRebuild block in -// the ctor so the font atlas only rebuilds once for the whole plugin start -// instead of once per handle. +// The four atlas-owned handles register inside a single +// SuppressAutoRebuild block so the font atlas only rebuilds once for the +// whole plugin start instead of once per handle. FontAwesome lives +// outside that accounting because the UiBuilder already owns it. public sealed class FontManager : IDisposable { private readonly IDalamudPluginInterface _pluginInterface; @@ -83,13 +85,7 @@ public sealed class FontManager : IDisposable } ); - FontAwesome = atlas.NewDelegateFontHandle(e => - { - e.OnPreBuild(tk => - tk.AddFontAwesomeIconFont(new SafeFontConfig { SizePx = GetFontSize() }) - ); - e.OnPostBuild(tk => tk.FitRatio(tk.Font)); - }); + FontAwesome = _pluginInterface.UiBuilder.IconFontFixedWidthHandle; RegularFont = BuildRegularFontHandle(atlas); @@ -181,7 +177,8 @@ public sealed class FontManager : IDisposable { Axis.Dispose(); AxisItalic.Dispose(); - FontAwesome.Dispose(); + // FontAwesome is shared with the UiBuilder; the host owns its + // lifetime, so the plugin must not dispose it. RegularFont?.Dispose(); ItalicFont?.Dispose(); }