mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Remove fallback font bs
This commit is contained in:
parent
b6747827f4
commit
c6174233b3
6 changed files with 18 additions and 288 deletions
|
|
@ -144,17 +144,6 @@ namespace Dalamud.Configuration.Internal
|
|||
/// </summary>
|
||||
public float FontGammaLevel { get; set; } = 1.4f;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating the level of font resolution between 1 to 5.
|
||||
/// 0(1024x1024), 1(2048x2048), 2(4096x4096), 3(8192x8192), 4(16384x16384).
|
||||
/// </summary>
|
||||
public int FontResolutionLevel { get; set; } = 2;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to disable font fallback notice.
|
||||
/// </summary>
|
||||
public bool DisableFontFallbackNotice { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether or not plugin UI should be hidden.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ namespace Dalamud.Interface.GameFonts
|
|||
private readonly Dictionary<GameFontStyle, Dictionary<char, Tuple<int, FdtReader.FontTableEntry>>> glyphRectIds = new();
|
||||
|
||||
private bool isBetweenBuildFontsAndRightAfterImGuiIoFontsBuild = false;
|
||||
private bool isBuildingAsFallbackFontMode = false;
|
||||
|
||||
[ServiceManager.ServiceConstructor]
|
||||
private GameFontManager(DataManager dataManager)
|
||||
|
|
@ -253,10 +252,8 @@ namespace Dalamud.Interface.GameFonts
|
|||
/// <summary>
|
||||
/// Build fonts before plugins do something more. To be called from InterfaceManager.
|
||||
/// </summary>
|
||||
/// <param name="forceMinSize">Whether to load fonts in minimum sizes.</param>
|
||||
public void BuildFonts(bool forceMinSize)
|
||||
public void BuildFonts()
|
||||
{
|
||||
this.isBuildingAsFallbackFontMode = forceMinSize;
|
||||
this.isBetweenBuildFontsAndRightAfterImGuiIoFontsBuild = true;
|
||||
|
||||
this.glyphRectIds.Clear();
|
||||
|
|
@ -305,7 +302,7 @@ namespace Dalamud.Interface.GameFonts
|
|||
|
||||
foreach (var (style, font) in this.fonts)
|
||||
{
|
||||
var fdt = this.fdts[(int)(this.isBuildingAsFallbackFontMode ? style.FamilyWithMinimumSize : style.FamilyAndSize)];
|
||||
var fdt = this.fdts[(int)style.FamilyAndSize];
|
||||
var scale = style.SizePt / fdt.FontHeader.Size;
|
||||
var fontPtr = font.NativePtr;
|
||||
|
||||
|
|
@ -436,7 +433,7 @@ namespace Dalamud.Interface.GameFonts
|
|||
{
|
||||
var rectIds = this.glyphRectIds[style] = new();
|
||||
|
||||
var fdt = this.fdts[(int)(this.isBuildingAsFallbackFontMode ? style.FamilyWithMinimumSize : style.FamilyAndSize)];
|
||||
var fdt = this.fdts[(int)style.FamilyAndSize];
|
||||
if (fdt == null)
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ namespace Dalamud.Interface.Internal
|
|||
private readonly SelfTestWindow selfTestWindow;
|
||||
private readonly StyleEditorWindow styleEditorWindow;
|
||||
private readonly TitleScreenMenuWindow titleScreenMenuWindow;
|
||||
private readonly FallbackFontNoticeWindow fallbackFontNoticeWindow;
|
||||
private readonly ProfilerWindow profilerWindow;
|
||||
|
||||
private readonly TextureWrap logoTexture;
|
||||
|
|
@ -98,7 +97,6 @@ namespace Dalamud.Interface.Internal
|
|||
this.selfTestWindow = new SelfTestWindow() { IsOpen = false };
|
||||
this.styleEditorWindow = new StyleEditorWindow() { IsOpen = false };
|
||||
this.titleScreenMenuWindow = new TitleScreenMenuWindow() { IsOpen = false };
|
||||
this.fallbackFontNoticeWindow = new FallbackFontNoticeWindow() { IsOpen = interfaceManager.IsFallbackFontMode && !configuration.DisableFontFallbackNotice };
|
||||
this.profilerWindow = new ProfilerWindow() { IsOpen = false };
|
||||
|
||||
this.WindowSystem.AddWindow(this.changelogWindow);
|
||||
|
|
@ -115,7 +113,6 @@ namespace Dalamud.Interface.Internal
|
|||
this.WindowSystem.AddWindow(this.selfTestWindow);
|
||||
this.WindowSystem.AddWindow(this.styleEditorWindow);
|
||||
this.WindowSystem.AddWindow(this.titleScreenMenuWindow);
|
||||
this.WindowSystem.AddWindow(this.fallbackFontNoticeWindow);
|
||||
this.WindowSystem.AddWindow(this.profilerWindow);
|
||||
|
||||
ImGuiManagedAsserts.AssertsEnabled = configuration.AssertsEnabledAtStartup;
|
||||
|
|
@ -222,11 +219,6 @@ namespace Dalamud.Interface.Internal
|
|||
/// </summary>
|
||||
public void OpenDevMenu() => this.isImGuiDrawDevMenu = true;
|
||||
|
||||
/// <summary>
|
||||
/// Opens the fallback font notice window.
|
||||
/// </summary>
|
||||
public void OpenFallbackFontNoticeWindow() => this.fallbackFontNoticeWindow.IsOpen = true;
|
||||
|
||||
/// <summary>
|
||||
/// Opens the <see cref="GamepadModeNotifierWindow"/>.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -47,8 +47,6 @@ namespace Dalamud.Interface.Internal
|
|||
[ServiceManager.BlockingEarlyLoadedService]
|
||||
internal class InterfaceManager : IDisposable, IServiceType
|
||||
{
|
||||
private const float MinimumFallbackFontSizePt = 9.6f; // Game's minimum AXIS font size
|
||||
private const float MinimumFallbackFontSizePx = MinimumFallbackFontSizePt * 4.0f / 3.0f;
|
||||
private const float DefaultFontSizePt = 12.0f;
|
||||
private const float DefaultFontSizePx = DefaultFontSizePt * 4.0f / 3.0f;
|
||||
private const ushort Fallback1Codepoint = 0x3013; // Geta mark; FFXIV uses this to indicate that a glyph is missing.
|
||||
|
|
@ -72,7 +70,6 @@ namespace Dalamud.Interface.Internal
|
|||
// can't access imgui IO before first present call
|
||||
private bool lastWantCapture = false;
|
||||
private bool isRebuildingFonts = false;
|
||||
private bool isFallbackFontMode = false;
|
||||
private bool isOverrideGameCursor = true;
|
||||
|
||||
[ServiceManager.ServiceConstructor]
|
||||
|
|
@ -120,11 +117,6 @@ namespace Dalamud.Interface.Internal
|
|||
/// </summary>
|
||||
public event Action AfterBuildFonts;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets an action that is executed right after font fallback mode has been changed.
|
||||
/// </summary>
|
||||
public event Action<bool> FallbackFontModeChange;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default ImGui font.
|
||||
/// </summary>
|
||||
|
|
@ -184,22 +176,6 @@ namespace Dalamud.Interface.Internal
|
|||
/// </summary>
|
||||
public bool IsDispatchingEvents { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the font has been loaded in fallback mode.
|
||||
/// </summary>
|
||||
public bool IsFallbackFontMode
|
||||
{
|
||||
get => this.isFallbackFontMode;
|
||||
internal set
|
||||
{
|
||||
if (value == this.isFallbackFontMode)
|
||||
return;
|
||||
|
||||
this.isFallbackFontMode = value;
|
||||
this.FallbackFontModeChange?.Invoke(value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to override configuration for UseAxis.
|
||||
/// </summary>
|
||||
|
|
@ -220,16 +196,6 @@ namespace Dalamud.Interface.Internal
|
|||
/// </summary>
|
||||
public float FontGamma => Math.Max(0.1f, this.FontGammaOverride.GetValueOrDefault(Service<DalamudConfiguration>.Get().FontGammaLevel));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to override configuration for FontResolutionLevel.
|
||||
/// </summary>
|
||||
public int? FontResolutionLevelOverride { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating the level of font resolution.
|
||||
/// </summary>
|
||||
public int FontResolutionLevel => this.FontResolutionLevelOverride ?? Service<DalamudConfiguration>.Get().FontResolutionLevel;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether we're building fonts but haven't generated atlas yet.
|
||||
/// </summary>
|
||||
|
|
@ -599,8 +565,7 @@ namespace Dalamud.Interface.Internal
|
|||
/// <summary>
|
||||
/// Loads font for use in ImGui text functions.
|
||||
/// </summary>
|
||||
/// <param name="disableBigFonts">If set, then glyphs will be loaded in smaller resolution to make all glyphs fit into given constraints.</param>
|
||||
private unsafe void SetupFonts(bool disableBigFonts = false)
|
||||
private unsafe void SetupFonts()
|
||||
{
|
||||
using var setupFontsTimings = Timings.Start("IM SetupFonts");
|
||||
|
||||
|
|
@ -609,12 +574,11 @@ namespace Dalamud.Interface.Internal
|
|||
var io = ImGui.GetIO();
|
||||
var ioFonts = io.Fonts;
|
||||
|
||||
var maxTexDimension = 1 << (10 + Math.Max(0, Math.Min(4, this.FontResolutionLevel)));
|
||||
var fontGamma = this.FontGamma;
|
||||
|
||||
this.fontBuildSignal.Reset();
|
||||
ioFonts.Clear();
|
||||
ioFonts.TexDesiredWidth = maxTexDimension;
|
||||
ioFonts.TexDesiredWidth = 4096;
|
||||
|
||||
Log.Verbose("[FONT] SetupFonts - 1");
|
||||
|
||||
|
|
@ -657,10 +621,9 @@ namespace Dalamud.Interface.Internal
|
|||
"Default",
|
||||
this.UseAxis ? TargetFontModification.AxisMode.Overwrite : TargetFontModification.AxisMode.GameGlyphsOnly,
|
||||
this.UseAxis ? DefaultFontSizePx : DefaultFontSizePx + 1,
|
||||
io.FontGlobalScale,
|
||||
disableBigFonts);
|
||||
io.FontGlobalScale);
|
||||
Log.Verbose("[FONT] SetupFonts - Default corresponding AXIS size: {0}pt ({1}px)", fontInfo.SourceAxis.Style.BaseSizePt, fontInfo.SourceAxis.Style.BaseSizePx);
|
||||
fontConfig.SizePixels = disableBigFonts ? Math.Min(MinimumFallbackFontSizePx, fontInfo.TargetSizePx) : fontInfo.TargetSizePx * io.FontGlobalScale;
|
||||
fontConfig.SizePixels = fontInfo.TargetSizePx * io.FontGlobalScale;
|
||||
if (this.UseAxis)
|
||||
{
|
||||
fontConfig.GlyphRanges = dummyRangeHandle.AddrOfPinnedObject();
|
||||
|
|
@ -700,8 +663,8 @@ namespace Dalamud.Interface.Internal
|
|||
|
||||
fontConfig.GlyphRanges = iconRangeHandle.AddrOfPinnedObject();
|
||||
fontConfig.PixelSnapH = true;
|
||||
IconFont = ioFonts.AddFontFromFileTTF(fontPathIcon, disableBigFonts ? Math.Min(MinimumFallbackFontSizePx, DefaultFontSizePx) : DefaultFontSizePx * io.FontGlobalScale, fontConfig);
|
||||
this.loadedFontInfo[IconFont] = new("Icon", TargetFontModification.AxisMode.GameGlyphsOnly, DefaultFontSizePx, io.FontGlobalScale, disableBigFonts);
|
||||
IconFont = ioFonts.AddFontFromFileTTF(fontPathIcon, DefaultFontSizePx * io.FontGlobalScale, fontConfig);
|
||||
this.loadedFontInfo[IconFont] = new("Icon", TargetFontModification.AxisMode.GameGlyphsOnly, DefaultFontSizePx, io.FontGlobalScale);
|
||||
}
|
||||
|
||||
// Monospace font
|
||||
|
|
@ -713,8 +676,8 @@ namespace Dalamud.Interface.Internal
|
|||
|
||||
fontConfig.GlyphRanges = IntPtr.Zero;
|
||||
fontConfig.PixelSnapH = true;
|
||||
MonoFont = ioFonts.AddFontFromFileTTF(fontPathMono, disableBigFonts ? Math.Min(MinimumFallbackFontSizePx, DefaultFontSizePx) : DefaultFontSizePx * io.FontGlobalScale, fontConfig);
|
||||
this.loadedFontInfo[MonoFont] = new("Mono", TargetFontModification.AxisMode.GameGlyphsOnly, DefaultFontSizePx, io.FontGlobalScale, disableBigFonts);
|
||||
MonoFont = ioFonts.AddFontFromFileTTF(fontPathMono, DefaultFontSizePx * io.FontGlobalScale, fontConfig);
|
||||
this.loadedFontInfo[MonoFont] = new("Mono", TargetFontModification.AxisMode.GameGlyphsOnly, DefaultFontSizePx, io.FontGlobalScale);
|
||||
}
|
||||
|
||||
// Default font but in requested size for requested glyphs
|
||||
|
|
@ -766,8 +729,7 @@ namespace Dalamud.Interface.Internal
|
|||
$"Requested({fontSize}px)",
|
||||
this.UseAxis ? TargetFontModification.AxisMode.Overwrite : TargetFontModification.AxisMode.GameGlyphsOnly,
|
||||
fontSize,
|
||||
io.FontGlobalScale,
|
||||
disableBigFonts);
|
||||
io.FontGlobalScale);
|
||||
if (this.UseAxis)
|
||||
{
|
||||
fontConfig.GlyphRanges = dummyRangeHandle.AddrOfPinnedObject();
|
||||
|
|
@ -785,7 +747,7 @@ namespace Dalamud.Interface.Internal
|
|||
garbageList.Add(rangeHandle);
|
||||
fontConfig.PixelSnapH = true;
|
||||
|
||||
var sizedFont = ioFonts.AddFontFromFileTTF(fontPathJp, disableBigFonts ? Math.Min(MinimumFallbackFontSizePx, fontSize) : fontSize * io.FontGlobalScale, fontConfig, rangeHandle.AddrOfPinnedObject());
|
||||
var sizedFont = ioFonts.AddFontFromFileTTF(fontPathJp, fontSize * io.FontGlobalScale, fontConfig, rangeHandle.AddrOfPinnedObject());
|
||||
this.loadedFontInfo[sizedFont] = fontInfo;
|
||||
foreach (var request in requests)
|
||||
request.FontInternal = sizedFont;
|
||||
|
|
@ -793,7 +755,7 @@ namespace Dalamud.Interface.Internal
|
|||
}
|
||||
}
|
||||
|
||||
gameFontManager.BuildFonts(disableBigFonts);
|
||||
gameFontManager.BuildFonts();
|
||||
|
||||
var customFontFirstConfigIndex = ioFonts.ConfigData.Size;
|
||||
|
||||
|
|
@ -835,17 +797,7 @@ namespace Dalamud.Interface.Internal
|
|||
this.loadedFontInfo[config.DstFont.NativePtr] = new($"PlReq({name})", config.SizePixels);
|
||||
}
|
||||
|
||||
if (disableBigFonts)
|
||||
{
|
||||
// If a plugin has requested a font size that is bigger than current restrictions, load it scaled down.
|
||||
// After loading glyphs onto font atlas, font information will be modified to make it look like the font of original size has been loaded.
|
||||
if (config.SizePixels > MinimumFallbackFontSizePx)
|
||||
config.SizePixels = MinimumFallbackFontSizePx;
|
||||
}
|
||||
else
|
||||
{
|
||||
config.SizePixels = config.SizePixels * io.FontGlobalScale;
|
||||
}
|
||||
config.SizePixels = config.SizePixels * io.FontGlobalScale;
|
||||
}
|
||||
|
||||
for (int i = 0, i_ = ioFonts.ConfigData.Size; i < i_; i++)
|
||||
|
|
@ -859,34 +811,6 @@ namespace Dalamud.Interface.Internal
|
|||
gameFontManager.AfterIoFontsBuild();
|
||||
Log.Verbose("[FONT] ImGui.IO.Build OK!");
|
||||
|
||||
if (ioFonts.TexHeight > maxTexDimension)
|
||||
{
|
||||
var possibilityForScaling = false;
|
||||
foreach (var x in this.loadedFontInfo.Values)
|
||||
{
|
||||
if (x.TargetSizePx * x.Scale > MinimumFallbackFontSizePx)
|
||||
{
|
||||
possibilityForScaling = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (possibilityForScaling && !disableBigFonts)
|
||||
{
|
||||
Log.Information("[FONT] Atlas size is {0}x{1} which is bigger than allowed {2}x{3}. Retrying with minimized font sizes.", ioFonts.TexWidth, ioFonts.TexHeight, maxTexDimension, maxTexDimension);
|
||||
this.IsFallbackFontMode = true;
|
||||
this.SetupFonts(true);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Warning("[FONT] Atlas size is {0}x{1} which is bigger than allowed {2}x{3} even when font sizes are minimized up to {4}px. This may result in crash.", ioFonts.TexWidth, ioFonts.TexHeight, maxTexDimension, maxTexDimension, MinimumFallbackFontSizePx);
|
||||
}
|
||||
}
|
||||
|
||||
if (!disableBigFonts)
|
||||
this.IsFallbackFontMode = false;
|
||||
|
||||
gameFontManager.AfterBuildFonts();
|
||||
|
||||
foreach (var (font, mod) in this.loadedFontInfo)
|
||||
|
|
@ -1004,34 +928,7 @@ namespace Dalamud.Interface.Internal
|
|||
this.scene!.OnNewRenderFrame -= this.RebuildFontsInternal;
|
||||
|
||||
Log.Verbose("[FONT] Calling InvalidateFonts");
|
||||
try
|
||||
{
|
||||
this.scene.InvalidateFonts();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (this.FontResolutionLevel > 2)
|
||||
{
|
||||
Log.Error(ex, "[FONT] Failed to create font textures; setting font resolution level to 2 and retrying");
|
||||
this.FontResolutionLevelOverride = 2;
|
||||
this.SetupFonts();
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Error(ex, "[FONT] Failed to create font textures; forcing fallback font mode");
|
||||
this.SetupFonts(true);
|
||||
}
|
||||
|
||||
Log.Verbose("[FONT] Calling InvalidateFonts again");
|
||||
try
|
||||
{
|
||||
this.scene.InvalidateFonts();
|
||||
}
|
||||
catch (Exception ex2)
|
||||
{
|
||||
Log.Error(ex2, "[FONT] Giving up");
|
||||
}
|
||||
}
|
||||
this.scene.InvalidateFonts();
|
||||
|
||||
Log.Verbose("[FONT] Font Rebuild OK!");
|
||||
|
||||
|
|
@ -1279,13 +1176,12 @@ namespace Dalamud.Interface.Internal
|
|||
/// <param name="axis">Whether and how to use AXIS fonts.</param>
|
||||
/// <param name="sizePx">Target font size in pixels, which will not be considered for further scaling.</param>
|
||||
/// <param name="globalFontScale">Font scale to be referred for loading AXIS font of appropriate size.</param>
|
||||
/// <param name="disableBigFonts">Whether to enable loading big AXIS fonts.</param>
|
||||
internal TargetFontModification(string name, AxisMode axis, float sizePx, float globalFontScale, bool disableBigFonts)
|
||||
internal TargetFontModification(string name, AxisMode axis, float sizePx, float globalFontScale)
|
||||
{
|
||||
this.Name = name;
|
||||
this.Axis = axis;
|
||||
this.TargetSizePx = sizePx;
|
||||
this.Scale = disableBigFonts ? MinimumFallbackFontSizePx / sizePx : globalFontScale;
|
||||
this.Scale = globalFontScale;
|
||||
this.SourceAxis = Service<GameFontManager>.Get().NewFontRef(new(GameFontFamily.Axis, this.TargetSizePx * this.Scale));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,95 +0,0 @@
|
|||
using System;
|
||||
using System.Numerics;
|
||||
|
||||
using CheapLoc;
|
||||
using Dalamud.Configuration.Internal;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using ImGuiNET;
|
||||
using Serilog;
|
||||
|
||||
namespace Dalamud.Interface.Internal.Windows
|
||||
{
|
||||
/// <summary>
|
||||
/// For major updates, an in-game Changelog window.
|
||||
/// </summary>
|
||||
internal sealed class FallbackFontNoticeWindow : Window, IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FallbackFontNoticeWindow"/> class.
|
||||
/// </summary>
|
||||
public FallbackFontNoticeWindow()
|
||||
: base(Title, ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.NoNavFocus)
|
||||
{
|
||||
this.Namespace = "FallbackFontNoticeWindow";
|
||||
this.RespectCloseHotkey = false;
|
||||
|
||||
this.Size = new Vector2(885, 463);
|
||||
this.SizeCondition = ImGuiCond.Appearing;
|
||||
|
||||
var interfaceManager = Service<InterfaceManager>.Get();
|
||||
var dalamud = Service<Dalamud>.Get();
|
||||
|
||||
Service<InterfaceManager>.Get().FallbackFontModeChange += this.OnFallbackFontModeChange;
|
||||
}
|
||||
|
||||
private static string Title => Loc.Localize("FallbackFontNoticeWindowTitle", "Fallback Font Mode Active");
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Draw()
|
||||
{
|
||||
ImGui.Text(Title);
|
||||
ImGuiHelpers.ScaledDummy(10);
|
||||
|
||||
ImGui.Text(Loc.Localize("FallbackFontNoticeWindowBody", "The text used by Dalamud and plugins has been made blurry in order to prevent possible crash."));
|
||||
ImGuiHelpers.ScaledDummy(10);
|
||||
|
||||
ImGui.Text(Loc.Localize("FallbackFontNoticeWindowSolution1", "* You may attempt to increase the limits on text quality. This may result in a crash."));
|
||||
ImGuiHelpers.ScaledDummy(10);
|
||||
ImGui.SameLine();
|
||||
if (ImGui.Button(Loc.Localize("FallbackFontNoticeWindowOpenDalamudSettings", "Open Dalamud Settings")))
|
||||
Service<DalamudInterface>.Get().OpenSettings();
|
||||
ImGuiHelpers.ScaledDummy(10);
|
||||
ImGui.SameLine();
|
||||
ImGui.Text(string.Format(
|
||||
Loc.Localize(
|
||||
"FallbackFontNoticeWindowSolution1Instructions",
|
||||
"In \"{0}\" tab, choose a better option for \"{1}\"."),
|
||||
Loc.Localize("DalamudSettingsVisual", "Look & Feel"),
|
||||
Loc.Localize("DalamudSettingsFontResolutionLevel", "Font resolution level")));
|
||||
|
||||
ImGuiHelpers.ScaledDummy(10);
|
||||
|
||||
ImGui.Text(Loc.Localize("FallbackFontNoticeWindowSolution2", "* You may disable custom fonts, or make fonts smaller, from individual plugin settings."));
|
||||
ImGuiHelpers.ScaledDummy(10);
|
||||
ImGui.SameLine();
|
||||
if (ImGui.Button(Loc.Localize("FallbackFontNoticeWindowOpenDalamudPlugins", "Open Plugin Installer")))
|
||||
Service<DalamudInterface>.Get().OpenPluginInstaller();
|
||||
|
||||
ImGuiHelpers.ScaledDummy(10);
|
||||
|
||||
if (ImGui.Button(Loc.Localize("FallbackFontNoticeWindowDoNotShowAgain", "Do not show again")))
|
||||
{
|
||||
this.IsOpen = false;
|
||||
Service<DalamudConfiguration>.Get().DisableFontFallbackNotice = true;
|
||||
Service<DalamudConfiguration>.Get().Save();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose this window.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
Service<InterfaceManager>.Get().FallbackFontModeChange -= this.OnFallbackFontModeChange;
|
||||
}
|
||||
|
||||
private void OnFallbackFontModeChange(bool mode)
|
||||
{
|
||||
Log.Verbose("[{0}] OnFallbackFontModeChange called: {1} (disable={2})", this.Namespace, mode, Service<DalamudConfiguration>.Get().DisableFontFallbackNotice);
|
||||
if (!mode)
|
||||
this.IsOpen = false;
|
||||
else if (!Service<DalamudConfiguration>.Get().DisableFontFallbackNotice)
|
||||
this.IsOpen = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -27,8 +27,6 @@ namespace Dalamud.Interface.Internal.Windows
|
|||
private readonly string[] languages;
|
||||
private readonly string[] locLanguages;
|
||||
|
||||
private readonly string[] fontResolutionLevelStrings;
|
||||
|
||||
private int langIndex;
|
||||
|
||||
private XivChatType dalamudMessagesChatType;
|
||||
|
|
@ -38,8 +36,6 @@ namespace Dalamud.Interface.Internal.Windows
|
|||
private bool doCfChatMessage;
|
||||
private bool doMbCollect;
|
||||
|
||||
private int fontResolutionLevel;
|
||||
|
||||
private float globalUiScale;
|
||||
private bool doUseAxisFontsFromGame;
|
||||
private float fontGamma;
|
||||
|
|
@ -101,7 +97,6 @@ namespace Dalamud.Interface.Internal.Windows
|
|||
this.globalUiScale = configuration.GlobalUiScale;
|
||||
this.fontGamma = configuration.FontGammaLevel;
|
||||
this.doUseAxisFontsFromGame = configuration.UseAxisFontsFromGame;
|
||||
this.fontResolutionLevel = configuration.FontResolutionLevel;
|
||||
this.doToggleUiHide = configuration.ToggleUiHide;
|
||||
this.doToggleUiHideDuringCutscenes = configuration.ToggleUiHideDuringCutscenes;
|
||||
this.doToggleUiHideDuringGpose = configuration.ToggleUiHideDuringGpose;
|
||||
|
|
@ -126,15 +121,6 @@ namespace Dalamud.Interface.Internal.Windows
|
|||
this.doButtonsSystemMenu = configuration.DoButtonsSystemMenu;
|
||||
this.disableRmtFiltering = configuration.DisableRmtFiltering;
|
||||
|
||||
this.fontResolutionLevelStrings = new[]
|
||||
{
|
||||
Loc.Localize("DalamudSettingsFontResolutionLevel0", "Least (1k x 1k texture)"),
|
||||
Loc.Localize("DalamudSettingsFontResolutionLevel1", "Lesser (2k x 2k texture)"),
|
||||
Loc.Localize("DalamudSettingsFontResolutionLevel2", "Normal (4k x 4k texture)"),
|
||||
Loc.Localize("DalamudSettingsFontResolutionLevel3", "Better (8k x 8k texture, may crash your game)"),
|
||||
Loc.Localize("DalamudSettingsFontResolutionLevel4", "Best (16k x 16k texture, may crash your game)"),
|
||||
};
|
||||
|
||||
this.languages = Localization.ApplicableLangCodes.Prepend("en").ToArray();
|
||||
this.langIndex = Array.IndexOf(this.languages, configuration.EffectiveLanguage);
|
||||
if (this.langIndex == -1)
|
||||
|
|
@ -184,12 +170,10 @@ namespace Dalamud.Interface.Internal.Windows
|
|||
|
||||
var rebuildFont = ImGui.GetIO().FontGlobalScale != configuration.GlobalUiScale
|
||||
|| interfaceManager.FontGamma != configuration.FontGammaLevel
|
||||
|| interfaceManager.FontResolutionLevel != configuration.FontResolutionLevel
|
||||
|| interfaceManager.UseAxis != configuration.UseAxisFontsFromGame;
|
||||
|
||||
ImGui.GetIO().FontGlobalScale = configuration.GlobalUiScale;
|
||||
interfaceManager.FontGammaOverride = null;
|
||||
interfaceManager.FontResolutionLevelOverride = null;
|
||||
interfaceManager.UseAxisOverride = null;
|
||||
this.thirdRepoList = configuration.ThirdRepoList.Select(x => x.Clone()).ToList();
|
||||
this.devPluginLocations = configuration.DevPluginLoadLocations.Select(x => x.Clone()).ToList();
|
||||
|
|
@ -373,38 +357,6 @@ namespace Dalamud.Interface.Internal.Windows
|
|||
|
||||
ImGui.TextColored(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingToggleUiAxisFontsHint", "Use AXIS fonts (the game's main UI fonts) as default Dalamud font."));
|
||||
|
||||
ImGuiHelpers.ScaledDummy(3);
|
||||
|
||||
ImGui.Text(Loc.Localize("DalamudSettingsFontResolutionLevel", "Font resolution level"));
|
||||
if (interfaceManager.FontResolutionLevelOverride != null)
|
||||
this.fontResolutionLevel = interfaceManager.FontResolutionLevelOverride.Value;
|
||||
if (ImGui.Combo("##DalamudSettingsFontResolutionLevelCombo", ref this.fontResolutionLevel, this.fontResolutionLevelStrings, this.fontResolutionLevelStrings.Length))
|
||||
{
|
||||
interfaceManager.FontResolutionLevelOverride = this.fontResolutionLevel;
|
||||
interfaceManager.RebuildFonts();
|
||||
}
|
||||
|
||||
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudGrey);
|
||||
ImGui.TextWrapped(string.Format(
|
||||
Loc.Localize(
|
||||
"DalamudSettingsFontResolutionLevelHint",
|
||||
"This option allows Dalamud fonts to look better.\n* If your game crashes right away, or the option reverts, when changing this option, your PC does not support high font resolutions in Dalamud - you will have to use a lower one.\n* If it doesn't crash or revert immediately, then you can keep the new choice indefinitely as it's not going to crash your game once it worked.\n* Either choose the 3rd or 5th option. Use other options only when neither works well.\n* Current font atlas size is {0}px * {1}px."),
|
||||
ImGui.GetIO().Fonts.TexWidth,
|
||||
ImGui.GetIO().Fonts.TexHeight));
|
||||
ImGui.PopStyleColor();
|
||||
|
||||
if (Service<DalamudConfiguration>.Get().DisableFontFallbackNotice)
|
||||
{
|
||||
ImGui.Text(Loc.Localize("DalamudSettingsFontResolutionLevelWarningDisabled", "Warning will not be displayed even when the limits are enforced and fonts become blurry."));
|
||||
if (ImGui.Button(Loc.Localize("DalamudSettingsFontResolutionLevelWarningReset", "Show warnings") + "##DalamudSettingsFontResolutionLevelWarningReset"))
|
||||
{
|
||||
Service<DalamudConfiguration>.Get().DisableFontFallbackNotice = false;
|
||||
Service<DalamudConfiguration>.Get().Save();
|
||||
if (Service<InterfaceManager>.Get().IsFallbackFontMode)
|
||||
Service<DalamudInterface>.Get().OpenFallbackFontNoticeWindow();
|
||||
}
|
||||
}
|
||||
|
||||
ImGuiHelpers.ScaledDummy(10);
|
||||
|
||||
ImGui.TextColored(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingToggleUiHideOptOutNote", "Plugins may independently opt out of the settings below."));
|
||||
|
|
@ -969,7 +921,6 @@ namespace Dalamud.Interface.Internal.Windows
|
|||
configuration.ShowTsm = this.doTsm;
|
||||
|
||||
configuration.UseAxisFontsFromGame = this.doUseAxisFontsFromGame;
|
||||
configuration.FontResolutionLevel = this.fontResolutionLevel;
|
||||
configuration.FontGammaLevel = this.fontGamma;
|
||||
|
||||
// This is applied every frame in InterfaceManager::CheckViewportState()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue