From 1d1db04f04f98a353995f836c53a4e3918b683a6 Mon Sep 17 00:00:00 2001 From: Haselnussbomber Date: Sat, 6 Dec 2025 16:09:42 +0100 Subject: [PATCH] Use ImFontPtr in SeStringDrawState --- .../ImGuiSeStringRenderer/SeStringDrawState.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Dalamud/Interface/ImGuiSeStringRenderer/SeStringDrawState.cs b/Dalamud/Interface/ImGuiSeStringRenderer/SeStringDrawState.cs index 11c1120b4..3a21e0db9 100644 --- a/Dalamud/Interface/ImGuiSeStringRenderer/SeStringDrawState.cs +++ b/Dalamud/Interface/ImGuiSeStringRenderer/SeStringDrawState.cs @@ -76,7 +76,7 @@ public unsafe ref struct SeStringDrawState this.splitter = default; this.GetEntity = ssdp.GetEntity; this.ScreenOffset = new(MathF.Round(this.ScreenOffset.X), MathF.Round(this.ScreenOffset.Y)); - this.FontSizeScale = this.FontSize / this.Font->FontSize; + this.FontSizeScale = this.FontSize / this.Font.FontSize; this.LineHeight = MathF.Round(ssdp.EffectiveLineHeight); this.LinkUnderlineThickness = ssdp.LinkUnderlineThickness ?? 0f; this.Opacity = ssdp.EffectiveOpacity; @@ -106,7 +106,7 @@ public unsafe ref struct SeStringDrawState public Vector2 ScreenOffset { get; } /// - public ImFont* Font { get; } + public ImFontPtr Font { get; } /// public float FontSize { get; } @@ -256,7 +256,7 @@ public unsafe ref struct SeStringDrawState /// Offset of the glyph in pixels w.r.t. . internal void DrawGlyph(scoped in ImGuiHelpers.ImFontGlyphReal g, Vector2 offset) { - var texId = this.Font->ContainerAtlas->Textures.Ref(g.TextureIndex).TexID; + var texId = this.Font.ContainerAtlas.Textures.Ref(g.TextureIndex).TexID; var xy0 = new Vector2( MathF.Round(g.X0 * this.FontSizeScale), MathF.Round(g.Y0 * this.FontSizeScale)); @@ -313,7 +313,7 @@ public unsafe ref struct SeStringDrawState offset += this.ScreenOffset; offset.Y += (this.LinkUnderlineThickness - 1) / 2f; - offset.Y += MathF.Round(((this.LineHeight - this.FontSize) / 2) + (this.Font->Ascent * this.FontSizeScale)); + offset.Y += MathF.Round(((this.LineHeight - this.FontSize) / 2) + (this.Font.Ascent * this.FontSizeScale)); this.SetCurrentChannel(SeStringDrawChannel.Foreground); this.DrawList.AddLine( @@ -340,9 +340,9 @@ public unsafe ref struct SeStringDrawState internal readonly ref ImGuiHelpers.ImFontGlyphReal FindGlyph(Rune rune) { var p = rune.Value is >= ushort.MinValue and < ushort.MaxValue - ? this.Font->FindGlyph((ushort)rune.Value) - : this.Font->FallbackGlyph; - return ref *(ImGuiHelpers.ImFontGlyphReal*)p; + ? (ImFontGlyphPtr)this.Font.FindGlyph((ushort)rune.Value) + : this.Font.FallbackGlyph; + return ref *(ImGuiHelpers.ImFontGlyphReal*)p.Handle; } /// Gets the glyph corresponding to the given codepoint. @@ -375,7 +375,7 @@ public unsafe ref struct SeStringDrawState return 0; return MathF.Round( - this.Font->GetDistanceAdjustmentForPair( + this.Font.GetDistanceAdjustmentForPair( (ushort)left.Value, (ushort)right.Value) * this.FontSizeScale); }