From 69725bbfe9fe8a8a3d159f3f340e87d3123145d3 Mon Sep 17 00:00:00 2001 From: goat Date: Wed, 7 Jun 2023 19:57:19 +0200 Subject: [PATCH] feat: clear font, style, color stack when fonts are rebuilt --- Dalamud/Interface/Internal/DalamudInterface.cs | 5 +++++ Dalamud/Interface/Internal/InterfaceManager.cs | 10 ++++++++++ lib/ImGuiScene | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Dalamud/Interface/Internal/DalamudInterface.cs b/Dalamud/Interface/Internal/DalamudInterface.cs index 07d557967..75c3b2b03 100644 --- a/Dalamud/Interface/Internal/DalamudInterface.cs +++ b/Dalamud/Interface/Internal/DalamudInterface.cs @@ -802,6 +802,11 @@ internal class DalamudInterface : IDisposable, IServiceType ImGui.SetWindowFocus(null); } + if (ImGui.MenuItem("Clear stacks")) + { + Service.Get().ClearStacks(); + } + if (ImGui.MenuItem("Dump style")) { var info = string.Empty; diff --git a/Dalamud/Interface/Internal/InterfaceManager.cs b/Dalamud/Interface/Internal/InterfaceManager.cs index 9a8da773c..5de5f52de 100644 --- a/Dalamud/Interface/Internal/InterfaceManager.cs +++ b/Dalamud/Interface/Internal/InterfaceManager.cs @@ -435,6 +435,15 @@ internal class InterfaceManager : IDisposable, IServiceType return null; } + /// + /// Clear font, style, and color stack. Dangerous, only use when you know + /// no one else has something pushed they may try to pop. + /// + public void ClearStacks() + { + this.scene?.ClearStacksOnContext(); + } + /// /// Toggle Windows 11 immersive mode on the game window. /// @@ -892,6 +901,7 @@ internal class InterfaceManager : IDisposable, IServiceType Log.Verbose("[FONT] ImGui.IO.Build will be called."); ioFonts.Build(); gameFontManager.AfterIoFontsBuild(); + this.ClearStacks(); Log.Verbose("[FONT] ImGui.IO.Build OK!"); gameFontManager.AfterBuildFonts(); diff --git a/lib/ImGuiScene b/lib/ImGuiScene index 262d3b066..99b735d7a 160000 --- a/lib/ImGuiScene +++ b/lib/ImGuiScene @@ -1 +1 @@ -Subproject commit 262d3b0668196fb236e2191c4a37e9be94e5a7a3 +Subproject commit 99b735d7a7fe36aaf92c027c75173dd150871c6b