mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
add some verbose logging for font loading
This commit is contained in:
parent
84b1dabbd2
commit
6d9b9a5eda
2 changed files with 21 additions and 1 deletions
|
|
@ -6,6 +6,7 @@ using System.Linq;
|
|||
using System.Numerics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using CheapLoc;
|
||||
using Dalamud.Game;
|
||||
using Dalamud.Game.Internal.DXGI;
|
||||
|
|
@ -207,9 +208,13 @@ namespace Dalamud.Interface
|
|||
// Sets up a deferred invocation of font rebuilding, before the next render frame
|
||||
public void RebuildFonts()
|
||||
{
|
||||
Log.Verbose("[FONT] RebuildFonts() called");
|
||||
|
||||
// don't invoke this multiple times per frame, in case multiple plugins call it
|
||||
if (!this.isRebuildingFonts)
|
||||
{
|
||||
Log.Verbose("[FONT] RebuildFonts() trigger");
|
||||
|
||||
this.isRebuildingFonts = true;
|
||||
this.scene.OnNewRenderFrame += RebuildFontsInternal;
|
||||
}
|
||||
|
|
@ -300,10 +305,18 @@ namespace Dalamud.Interface
|
|||
}, GCHandleType.Pinned);
|
||||
IconFont = ImGui.GetIO().Fonts.AddFontFromFileTTF(fontPathIcon, 17.0f, null, iconRangeHandle.AddrOfPinnedObject());
|
||||
|
||||
Log.Verbose("[FONT] Invoke OnBuildFonts");
|
||||
this.OnBuildFonts?.Invoke();
|
||||
Log.Verbose("[FONT] OnBuildFonts OK!");
|
||||
|
||||
for (var i = 0; i < ImGui.GetIO().Fonts.Fonts.Size; i++) {
|
||||
Log.Verbose("{0} - {1}", i, ImGui.GetIO().Fonts.Fonts[i].GetDebugName());
|
||||
}
|
||||
|
||||
ImGui.GetIO().Fonts.Build();
|
||||
|
||||
Log.Verbose("[FONT] Fonts built!");
|
||||
|
||||
fontConfig.Destroy();
|
||||
japaneseRangeHandle.Free();
|
||||
gameRangeHandle.Free();
|
||||
|
|
@ -313,11 +326,15 @@ namespace Dalamud.Interface
|
|||
// This is intended to only be called as a handler attached to scene.OnNewRenderFrame
|
||||
private void RebuildFontsInternal()
|
||||
{
|
||||
Log.Verbose("[FONT] RebuildFontsInternal() called");
|
||||
SetupFonts();
|
||||
|
||||
Log.Verbose("[FONT] RebuildFontsInternal() detaching");
|
||||
this.scene.OnNewRenderFrame -= RebuildFontsInternal;
|
||||
this.scene.InvalidateFonts();
|
||||
|
||||
Log.Verbose("[FONT] Font Rebuild OK!");
|
||||
|
||||
this.isRebuildingFonts = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -120,8 +120,11 @@ namespace Dalamud.Interface
|
|||
/// This will invoke any <see cref="OnBuildFonts"/> handlers and ensure that any loaded fonts are
|
||||
/// ready to be used on the next UI frame.
|
||||
/// </summary>
|
||||
public void RebuildFonts() =>
|
||||
public void RebuildFonts()
|
||||
{
|
||||
Log.Verbose("[FONT] {0} plugin is initiating FONT REBUILD", this.namespaceName);
|
||||
this.dalamud.InterfaceManager.RebuildFonts();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event that is fired when the plugin should open its configuration interface.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue