From 04ec131b15eadd32ebe6ba0803b74930d8d47ea5 Mon Sep 17 00:00:00 2001 From: goaaats Date: Thu, 31 Mar 2022 16:00:01 +0200 Subject: [PATCH] Revert "Show size appropriate fonts" This reverts commit be65907beb7c0ab9041f1e13d2d121a273a4ec52. --- .../Interface/GameFonts/GameFontManager.cs | 60 +--- .../Interface/Internal/InterfaceManager.cs | 280 ++++-------------- .../Internal/Windows/SettingsWindow.cs | 2 +- .../Internal/Windows/TitleScreenMenuWindow.cs | 75 ++--- 4 files changed, 97 insertions(+), 320 deletions(-) diff --git a/Dalamud/Interface/GameFonts/GameFontManager.cs b/Dalamud/Interface/GameFonts/GameFontManager.cs index b7e208af1..ba9253a9b 100644 --- a/Dalamud/Interface/GameFonts/GameFontManager.cs +++ b/Dalamud/Interface/GameFonts/GameFontManager.cs @@ -117,21 +117,18 @@ namespace Dalamud.Interface.GameFonts /// Target font. /// Whether to copy missing glyphs only. /// Whether to call target.BuildLookupTable(). - /// Low codepoint range to copy. - /// High codepoing range to copy. - public static void CopyGlyphsAcrossFonts(ImFontPtr? source, ImFontPtr? target, bool missingOnly, bool rebuildLookupTable, int rangeLow = 32, int rangeHigh = 0xFFFE) + public static void CopyGlyphsAcrossFonts(ImFontPtr? source, ImFontPtr? target, bool missingOnly, bool rebuildLookupTable) { if (!source.HasValue || !target.HasValue) return; - var scale = target.Value!.FontSize / source.Value!.FontSize; unsafe { var glyphs = (ImFontGlyphReal*)source.Value!.Glyphs.Data; for (int j = 0, j_ = source.Value!.Glyphs.Size; j < j_; j++) { var glyph = &glyphs[j]; - if (glyph->Codepoint < rangeLow || glyph->Codepoint > rangeHigh) + if (glyph->Codepoint < 32 || glyph->Codepoint >= 0xFFFF) continue; var prevGlyphPtr = (ImFontGlyphReal*)target.Value!.FindGlyphNoFallback((ushort)glyph->Codepoint).NativePtr; @@ -140,27 +137,27 @@ namespace Dalamud.Interface.GameFonts target.Value!.AddGlyph( target.Value!.ConfigData, (ushort)glyph->Codepoint, - glyph->X0 * scale, - glyph->Y0 * scale, - glyph->X1 * scale, - glyph->Y1 * scale, + glyph->X0, + glyph->Y0, + glyph->X0 + ((glyph->X1 - glyph->X0) * target.Value!.FontSize / source.Value!.FontSize), + glyph->Y0 + ((glyph->Y1 - glyph->Y0) * target.Value!.FontSize / source.Value!.FontSize), glyph->U0, glyph->V0, glyph->U1, glyph->V1, - glyph->AdvanceX * scale); + glyph->AdvanceX * target.Value!.FontSize / source.Value!.FontSize); } else if (!missingOnly) { - prevGlyphPtr->X0 = glyph->X0 * scale; - prevGlyphPtr->Y0 = glyph->Y0 * scale; - prevGlyphPtr->X1 = glyph->X1 * scale; - prevGlyphPtr->Y1 = glyph->Y1 * scale; + prevGlyphPtr->X0 = glyph->X0; + prevGlyphPtr->Y0 = glyph->Y0; + prevGlyphPtr->X1 = glyph->X0 + ((glyph->X1 - glyph->X0) * target.Value!.FontSize / source.Value!.FontSize); + prevGlyphPtr->Y1 = glyph->Y0 + ((glyph->Y1 - glyph->Y0) * target.Value!.FontSize / source.Value!.FontSize); prevGlyphPtr->U0 = glyph->U0; prevGlyphPtr->V0 = glyph->V0; prevGlyphPtr->U1 = glyph->U1; prevGlyphPtr->V1 = glyph->V1; - prevGlyphPtr->AdvanceX = glyph->AdvanceX * scale; + prevGlyphPtr->AdvanceX = glyph->AdvanceX * target.Value!.FontSize / source.Value!.FontSize; } } } @@ -169,39 +166,6 @@ namespace Dalamud.Interface.GameFonts target.Value!.BuildLookupTable(); } - /// - /// Unscales fonts after they have been rendered onto atlas. - /// - /// Font to unscale. - /// Scale factor. - /// Whether to call target.BuildLookupTable(). - public static void UnscaleFont(ImFontPtr fontPtr, float fontScale, bool rebuildLookupTable = true) - { - unsafe - { - var font = fontPtr.NativePtr; - for (int i = 0, i_ = font->IndexAdvanceX.Size; i < i_; ++i) - ((float*)font->IndexAdvanceX.Data)[i] /= fontScale; - font->FallbackAdvanceX /= fontScale; - font->FontSize /= fontScale; - font->Ascent /= fontScale; - font->Descent /= fontScale; - var glyphs = (ImFontGlyphReal*)font->Glyphs.Data; - for (int i = 0, i_ = font->Glyphs.Size; i < i_; i++) - { - var glyph = &glyphs[i]; - glyph->X0 /= fontScale; - glyph->X1 /= fontScale; - glyph->Y0 /= fontScale; - glyph->Y1 /= fontScale; - glyph->AdvanceX /= fontScale; - } - } - - if (rebuildLookupTable) - fontPtr.BuildLookupTable(); - } - /// public void Dispose() { diff --git a/Dalamud/Interface/Internal/InterfaceManager.cs b/Dalamud/Interface/Internal/InterfaceManager.cs index 6f5477463..0c6d99efa 100644 --- a/Dalamud/Interface/Internal/InterfaceManager.cs +++ b/Dalamud/Interface/Internal/InterfaceManager.cs @@ -47,13 +47,8 @@ namespace Dalamud.Interface.Internal /// internal class InterfaceManager : IDisposable { - private const float DefaultFontSizePt = 12.0f; - private const float DefaultFontSizePx = DefaultFontSizePt * 4.0f / 3.0f; - private readonly string rtssPath; - private readonly HashSet glyphRequests = new(); - private readonly Hook presentHook; private readonly Hook resizeBuffersHook; private readonly Hook setCursorHook; @@ -63,7 +58,6 @@ namespace Dalamud.Interface.Internal private RawDX11Scene? scene; private GameFontHandle? axisFontHandle; - private bool overwriteAllNotoGlyphsWithAxis; // can't access imgui IO before first present call private bool lastWantCapture = false; @@ -343,69 +337,6 @@ namespace Dalamud.Interface.Internal this.fontBuildSignal.WaitOne(); } - /// - /// Requests a default font of specified size to exist. - /// - /// Font size in pixels. - /// Ranges of glyphs. - /// Requets handle. - public SpecialGlyphRequest NewFontSizeRef(float size, List> ranges) - { - var allContained = true; - var fonts = ImGui.GetIO().Fonts.Fonts; - ImFontPtr foundFont = null; - unsafe - { - for (int i = 0, i_ = fonts.Size; allContained && i < i_; i++) - { - if (!this.glyphRequests.Any(x => x.FontInternal.NativePtr == fonts[i].NativePtr)) - continue; - - foreach (var range in ranges) - { - if (!allContained) - break; - - for (var j = range.Item1; j <= range.Item2 && allContained; j++) - allContained &= fonts[i].FindGlyphNoFallback(j).NativePtr != null; - } - - if (allContained) - foundFont = fonts[i]; - - break; - } - } - - var req = new SpecialGlyphRequest(this, size, ranges); - req.FontInternal = foundFont; - - if (!allContained) - this.RebuildFonts(); - - return req; - } - - /// - /// Requests a default font of specified size to exist. - /// - /// Font size in pixels. - /// Text to calculate glyph ranges from. - /// Requets handle. - public SpecialGlyphRequest NewFontSizeRef(float size, string text) - { - List> ranges = new(); - foreach (var c in new SortedSet(text.ToHashSet())) - { - if (ranges.Any() && ranges[^1].Item2 + 1 == c) - ranges[^1] = Tuple.Create(ranges[^1].Item1, c); - else - ranges.Add(Tuple.Create(c, c)); - } - - return this.NewFontSizeRef(size, ranges); - } - private static void ShowFontError(string path) { Util.Fatal($"One or more files required by XIVLauncher were not found.\nPlease restart and report this error if it occurs again.\n\n{path}", "Error"); @@ -414,15 +345,21 @@ namespace Dalamud.Interface.Internal private void SetAxisFonts() { var configuration = Service.Get(); - this.overwriteAllNotoGlyphsWithAxis = configuration.UseAxisFontsFromGame; - - var currentFamilyAndSize = GameFontStyle.GetRecommendedFamilyAndSize(GameFontFamily.Axis, this.axisFontHandle?.Style.Size ?? 0f); - var expectedFamilyAndSize = GameFontStyle.GetRecommendedFamilyAndSize(GameFontFamily.Axis, DefaultFontSizePt * ImGui.GetIO().FontGlobalScale); - if (currentFamilyAndSize != expectedFamilyAndSize) + if (configuration.UseAxisFontsFromGame) { + var currentFamilyAndSize = GameFontStyle.GetRecommendedFamilyAndSize(GameFontFamily.Axis, this.axisFontHandle?.Style.Size ?? 0f); + var expectedFamilyAndSize = GameFontStyle.GetRecommendedFamilyAndSize(GameFontFamily.Axis, 12 * ImGui.GetIO().FontGlobalScale); + if (currentFamilyAndSize == expectedFamilyAndSize) + return; + this.axisFontHandle?.Dispose(); this.axisFontHandle = Service.Get().NewFontRef(new(expectedFamilyAndSize)); } + else + { + this.axisFontHandle?.Dispose(); + this.axisFontHandle = null; + } } /* @@ -594,95 +531,64 @@ namespace Dalamud.Interface.Internal private unsafe void SetupFonts() { var dalamud = Service.Get(); - var io = ImGui.GetIO(); - var ioFonts = io.Fonts; - var fontScale = io.FontGlobalScale; + var ioFonts = ImGui.GetIO().Fonts; var fontGamma = this.FontGamma; - List fontsToUnscale = new(); this.fontBuildSignal.Reset(); + ioFonts.Clear(); + ImFontConfigPtr fontConfig = ImGuiNative.ImFontConfig_ImFontConfig(); + fontConfig.PixelSnapH = true; + var fontPathJp = Path.Combine(dalamud.AssetDirectory.FullName, "UIRes", "NotoSansCJKjp-Medium.otf"); + if (!File.Exists(fontPathJp)) ShowFontError(fontPathJp); - // Default font - { - var japaneseRangeHandle = GCHandle.Alloc(GlyphRangesJapanese.GlyphRanges, GCHandleType.Pinned); - DefaultFont = ioFonts.AddFontFromFileTTF(fontPathJp, (DefaultFontSizePx + 1) * fontScale, null, japaneseRangeHandle.AddrOfPinnedObject()); - japaneseRangeHandle.Free(); - fontsToUnscale.Add(DefaultFont); - } + var japaneseRangeHandle = GCHandle.Alloc(GlyphRangesJapanese.GlyphRanges, GCHandleType.Pinned); - // FontAwesome icon font - { - var fontPathIcon = Path.Combine(dalamud.AssetDirectory.FullName, "UIRes", "FontAwesome5FreeSolid.otf"); - if (!File.Exists(fontPathIcon)) - ShowFontError(fontPathIcon); + DefaultFont = ioFonts.AddFontFromFileTTF(fontPathJp, 17.0f, null, japaneseRangeHandle.AddrOfPinnedObject()); - var iconRangeHandle = GCHandle.Alloc(new ushort[] { 0xE000, 0xF8FF, 0, }, GCHandleType.Pinned); - IconFont = ioFonts.AddFontFromFileTTF(fontPathIcon, DefaultFontSizePx * fontScale, null, iconRangeHandle.AddrOfPinnedObject()); - iconRangeHandle.Free(); - fontsToUnscale.Add(IconFont); - } + var fontPathGame = Path.Combine(dalamud.AssetDirectory.FullName, "UIRes", "gamesym.ttf"); - // Monospace font - { - var fontPathMono = Path.Combine(dalamud.AssetDirectory.FullName, "UIRes", "Inconsolata-Regular.ttf"); - if (!File.Exists(fontPathMono)) - ShowFontError(fontPathMono); - MonoFont = ioFonts.AddFontFromFileTTF(fontPathMono, DefaultFontSizePx * fontScale); - fontsToUnscale.Add(MonoFont); - } + if (!File.Exists(fontPathGame)) + ShowFontError(fontPathGame); - // Default font but in requested size for requested glyphs - { - Dictionary> extraFontRequests = new(); - foreach (var extraFontRequest in this.glyphRequests) + var gameRangeHandle = GCHandle.Alloc( + new ushort[] { - if (!extraFontRequests.ContainsKey(extraFontRequest.Size)) - extraFontRequests[extraFontRequest.Size] = new(); - extraFontRequests[extraFontRequest.Size].Add(extraFontRequest); - } + 0xE020, + 0xE0DB, + 0, + }, + GCHandleType.Pinned); - foreach (var (fontSize, requests) in extraFontRequests) + fontConfig.MergeMode = false; + ioFonts.AddFontFromFileTTF(fontPathGame, 17.0f, fontConfig, gameRangeHandle.AddrOfPinnedObject()); + fontConfig.MergeMode = true; + + var fontPathIcon = Path.Combine(dalamud.AssetDirectory.FullName, "UIRes", "FontAwesome5FreeSolid.otf"); + + if (!File.Exists(fontPathIcon)) + ShowFontError(fontPathIcon); + + var iconRangeHandle = GCHandle.Alloc( + new ushort[] { - List> codepointRanges = new(); - foreach (var request in requests) - { - foreach (var range in request.CodepointRanges) - codepointRanges.Add(range); - } + 0xE000, + 0xF8FF, + 0, + }, + GCHandleType.Pinned); + IconFont = ioFonts.AddFontFromFileTTF(fontPathIcon, 17.0f, null, iconRangeHandle.AddrOfPinnedObject()); - codepointRanges.Sort((x, y) => (x.Item1 == y.Item1 ? (x.Item2 < y.Item2 ? -1 : (x.Item2 == y.Item2 ? 0 : 1)) : (x.Item1 < y.Item1 ? -1 : 1))); + var fontPathMono = Path.Combine(dalamud.AssetDirectory.FullName, "UIRes", "Inconsolata-Regular.ttf"); - List flattenedRanges = new(); - foreach (var range in codepointRanges) - { - if (flattenedRanges.Any() && flattenedRanges[^1] >= range.Item1 - 1) - { - flattenedRanges[^1] = Math.Max(flattenedRanges[^1], range.Item2); - } - else - { - flattenedRanges.Add(range.Item1); - flattenedRanges.Add(range.Item2); - } - } + if (!File.Exists(fontPathMono)) + ShowFontError(fontPathMono); - flattenedRanges.Add(0); - - var rangeHandle = GCHandle.Alloc(flattenedRanges.ToArray(), GCHandleType.Pinned); - var sizedFont = ioFonts.AddFontFromFileTTF(fontPathJp, fontSize * fontScale, null, rangeHandle.AddrOfPinnedObject()); - rangeHandle.Free(); - - fontsToUnscale.Add(sizedFont); - - foreach (var request in requests) - request.FontInternal = sizedFont; - } - } + MonoFont = ioFonts.AddFontFromFileTTF(fontPathMono, 16.0f); var gameFontManager = Service.Get(); gameFontManager.BuildFonts(); @@ -706,27 +612,8 @@ namespace Dalamud.Interface.Internal texPixels[i] = (byte)(Math.Pow(texPixels[i] / 255.0f, 1.0f / fontGamma) * 255.0f); } - foreach (var font in fontsToUnscale) - GameFontManager.UnscaleFont(font, fontScale, false); - gameFontManager.AfterBuildFonts(); - - foreach (var font in fontsToUnscale) - { - if (font.NativePtr == MonoFont.NativePtr || font.NativePtr == IconFont.NativePtr) - continue; - - if (this.overwriteAllNotoGlyphsWithAxis) - GameFontManager.CopyGlyphsAcrossFonts(this.axisFontHandle?.ImFont, font, false, false); - else - GameFontManager.CopyGlyphsAcrossFonts(this.axisFontHandle?.ImFont, font, false, false, 0xE020, 0xE0DB); - } - - // Fill missing glyphs in MonoFont from DefaultFont - GameFontManager.CopyGlyphsAcrossFonts(DefaultFont, MonoFont, true, false); - - foreach (var font in fontsToUnscale) - font.BuildLookupTable(); + GameFontManager.CopyGlyphsAcrossFonts(this.axisFontHandle?.ImFont, DefaultFont, false, true); Log.Verbose("[FONT] Invoke OnAfterBuildFonts"); this.AfterBuildFonts?.Invoke(); @@ -736,6 +623,11 @@ namespace Dalamud.Interface.Internal this.fontBuildSignal.Set(); + fontConfig.Destroy(); + japaneseRangeHandle.Free(); + gameRangeHandle.Free(); + iconRangeHandle.Free(); + this.FontsReady = true; } @@ -873,65 +765,5 @@ namespace Dalamud.Interface.Internal Service.Get().Draw(); } - - /// - /// Represents a glyph request. - /// - public class SpecialGlyphRequest : IDisposable - { - /// - /// Initializes a new instance of the class. - /// - /// InterfaceManager to associate. - /// Font size in pixels. - /// Codepoint ranges. - internal SpecialGlyphRequest(InterfaceManager manager, float size, List> ranges) - { - this.Manager = manager; - this.Size = size; - this.CodepointRanges = ranges; - this.Manager.glyphRequests.Add(this); - } - - /// - /// Gets the font of specified size, or DefaultFont if it's not ready yet. - /// - public ImFontPtr Font - { - get - { - unsafe - { - return this.FontInternal.NativePtr == null ? DefaultFont : this.FontInternal; - } - } - } - - /// - /// Gets or sets the associated ImFont. - /// - internal ImFontPtr FontInternal { get; set; } - - /// - /// Gets associated InterfaceManager. - /// - internal InterfaceManager Manager { get; init; } - - /// - /// Gets font size. - /// - internal float Size { get; init; } - - /// - /// Gets codepoint ranges. - /// - internal List> CodepointRanges { get; init; } - - /// - public void Dispose() - { - this.Manager.glyphRequests.Remove(this); - } - } } } diff --git a/Dalamud/Interface/Internal/Windows/SettingsWindow.cs b/Dalamud/Interface/Internal/Windows/SettingsWindow.cs index 9ff94f42e..48104ed6a 100644 --- a/Dalamud/Interface/Internal/Windows/SettingsWindow.cs +++ b/Dalamud/Interface/Internal/Windows/SettingsWindow.cs @@ -26,7 +26,7 @@ namespace Dalamud.Interface.Internal.Windows internal class SettingsWindow : Window { private const float MinScale = 0.3f; - private const float MaxScale = 3.0f; + private const float MaxScale = 2.0f; private readonly string[] languages; private readonly string[] locLanguages; diff --git a/Dalamud/Interface/Internal/Windows/TitleScreenMenuWindow.cs b/Dalamud/Interface/Internal/Windows/TitleScreenMenuWindow.cs index 7ea7b64dd..b4c089fbe 100644 --- a/Dalamud/Interface/Internal/Windows/TitleScreenMenuWindow.cs +++ b/Dalamud/Interface/Internal/Windows/TitleScreenMenuWindow.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Linq; using System.Numerics; using Dalamud.Configuration.Internal; @@ -21,18 +20,17 @@ namespace Dalamud.Interface.Internal.Windows /// internal class TitleScreenMenuWindow : Window, IDisposable { - private const float TargetFontSizePt = 18f; - private const float TargetFontSizePx = TargetFontSizePt * 4 / 3; - + private const float TargetFontSize = 16.2f; private readonly TextureWrap shadeTexture; private readonly Dictionary shadeEasings = new(); private readonly Dictionary moveEasings = new(); private readonly Dictionary logoEasings = new(); - private readonly Dictionary specialGlyphRequests = new(); private InOutCubic? fadeOutEasing; + private GameFontHandle? axisFontHandle; + private State state = State.Hide; /// @@ -73,14 +71,19 @@ namespace Dalamud.Interface.Internal.Windows /// public override void PreDraw() { + this.SetAxisFonts(); ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Vector2(0, 0)); ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, new Vector2(0, 0)); + if (this.axisFontHandle?.Available ?? false) + ImGui.PushFont(this.axisFontHandle.ImFont); base.PreDraw(); } /// public override void PostDraw() { + if (this.axisFontHandle?.Available ?? false) + ImGui.PopFont(); ImGui.PopStyleVar(2); base.PostDraw(); } @@ -96,7 +99,7 @@ namespace Dalamud.Interface.Internal.Windows /// public override void Draw() { - var scale = ImGui.GetIO().FontGlobalScale; + ImGui.SetWindowFontScale(TargetFontSize / ImGui.GetFont().FontSize * 4 / 3); var tsm = Service.Get(); @@ -126,7 +129,7 @@ namespace Dalamud.Interface.Internal.Windows moveEasing.Update(); - var finalPos = (i + 1) * this.shadeTexture.Height * scale; + var finalPos = (i + 1) * this.shadeTexture.Height; var pos = moveEasing.Value * finalPos; // FIXME(goat): Sometimes, easings can overshoot and bring things out of alignment. @@ -177,7 +180,7 @@ namespace Dalamud.Interface.Internal.Windows { var entry = tsm.Entries[i]; - var finalPos = (i + 1) * this.shadeTexture.Height * scale; + var finalPos = (i + 1) * this.shadeTexture.Height; this.DrawEntry(entry, i != 0, true, i == 0, false); @@ -219,35 +222,26 @@ namespace Dalamud.Interface.Internal.Windows break; } } + } - var srcText = tsm.Entries.Select(e => e.Name).ToHashSet(); - var keys = this.specialGlyphRequests.Keys.ToHashSet(); - keys.RemoveWhere(x => srcText.Contains(x)); - foreach (var key in keys) + private void SetAxisFonts() + { + var configuration = Service.Get(); + if (configuration.UseAxisFontsFromGame) { - this.specialGlyphRequests[key].Dispose(); - this.specialGlyphRequests.Remove(key); + if (this.axisFontHandle == null) + this.axisFontHandle = Service.Get().NewFontRef(new(GameFontFamily.Axis, TargetFontSize)); + } + else + { + this.axisFontHandle?.Dispose(); + this.axisFontHandle = null; } } private bool DrawEntry( TitleScreenMenu.TitleScreenMenuEntry entry, bool inhibitFadeout, bool showText, bool isFirst, bool overrideAlpha) { - InterfaceManager.SpecialGlyphRequest fontHandle; - if (this.specialGlyphRequests.TryGetValue(entry.Name, out fontHandle) && fontHandle.Size != TargetFontSizePx) - { - fontHandle.Dispose(); - this.specialGlyphRequests.Remove(entry.Name); - fontHandle = null; - } - - if (fontHandle == null) - this.specialGlyphRequests[entry.Name] = fontHandle = Service.Get().NewFontSizeRef(TargetFontSizePx, entry.Name); - - ImGui.PushFont(fontHandle.Font); - - var scale = ImGui.GetIO().FontGlobalScale; - if (!this.shadeEasings.TryGetValue(entry.Id, out var shadeEasing)) { shadeEasing = new InOutCubic(TimeSpan.FromMilliseconds(350)); @@ -257,7 +251,7 @@ namespace Dalamud.Interface.Internal.Windows var initialCursor = ImGui.GetCursorPos(); ImGui.PushStyleVar(ImGuiStyleVar.Alpha, (float)shadeEasing.Value); - ImGui.Image(this.shadeTexture.ImGuiHandle, new Vector2(this.shadeTexture.Width * scale, this.shadeTexture.Height * scale)); + ImGui.Image(this.shadeTexture.ImGuiHandle, new Vector2(this.shadeTexture.Width, this.shadeTexture.Height)); ImGui.PopStyleVar(); var isHover = ImGui.IsItemHovered(); @@ -311,7 +305,7 @@ namespace Dalamud.Interface.Internal.Windows ImGui.PushStyleVar(ImGuiStyleVar.Alpha, 1f); } - ImGui.Image(entry.Texture.ImGuiHandle, new Vector2(TitleScreenMenu.TextureSize * scale)); + ImGui.Image(entry.Texture.ImGuiHandle, new Vector2(TitleScreenMenu.TextureSize)); if (overrideAlpha || isFirst) { ImGui.PopStyleVar(); @@ -325,36 +319,23 @@ namespace Dalamud.Interface.Internal.Windows var textHeight = ImGui.GetTextLineHeightWithSpacing(); var cursor = ImGui.GetCursorPos(); - cursor.Y += (entry.Texture.Height * scale / 2) - (textHeight / 2); + cursor.Y += (entry.Texture.Height / 2) - (textHeight / 2); + ImGui.SetCursorPos(cursor); if (overrideAlpha) { ImGui.PushStyleVar(ImGuiStyleVar.Alpha, showText ? (float)logoEasing.Value : 0f); } - // Drop shadow - ImGui.PushStyleColor(ImGuiCol.Text, 0xFF000000); - for (int i = 0, i_ = (int)Math.Ceiling(1 * scale); i < i_; i++) - { - ImGui.SetCursorPos(new Vector2(cursor.X, cursor.Y + i)); - ImGui.Text(entry.Name); - } - - ImGui.PopStyleColor(); - - ImGui.SetCursorPos(cursor); ImGui.Text(entry.Name); - if (overrideAlpha) { ImGui.PopStyleVar(); } - initialCursor.Y += entry.Texture.Height * scale; + initialCursor.Y += entry.Texture.Height; ImGui.SetCursorPos(initialCursor); - ImGui.PopFont(); - return isHover; }