diff --git a/Dalamud/Interface/Internal/InterfaceManager.cs b/Dalamud/Interface/Internal/InterfaceManager.cs index 7f030a77b..a768dd2df 100644 --- a/Dalamud/Interface/Internal/InterfaceManager.cs +++ b/Dalamud/Interface/Internal/InterfaceManager.cs @@ -1012,7 +1012,36 @@ namespace Dalamud.Interface.Internal Log.Verbose("[FONT] RebuildFontsInternal() detaching"); this.scene.OnNewRenderFrame -= this.RebuildFontsInternal; - this.scene.InvalidateFonts(); + + 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"); + } + } Log.Verbose("[FONT] Font Rebuild OK!"); diff --git a/Dalamud/Interface/Internal/Windows/SettingsWindow.cs b/Dalamud/Interface/Internal/Windows/SettingsWindow.cs index 321fc0f61..8f86752fa 100644 --- a/Dalamud/Interface/Internal/Windows/SettingsWindow.cs +++ b/Dalamud/Interface/Internal/Windows/SettingsWindow.cs @@ -367,6 +367,8 @@ namespace Dalamud.Interface.Internal.Windows 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; @@ -377,7 +379,7 @@ namespace Dalamud.Interface.Internal.Windows ImGui.TextWrapped(string.Format( Loc.Localize( "DalamudSettingsFontResolutionLevelHint", - "This option allows Dalamud fonts to look better.\n* If your game crashes right away 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 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."), + "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();