diff --git a/Dalamud/Interface/Internal/InterfaceManager.cs b/Dalamud/Interface/Internal/InterfaceManager.cs
index 21b5de793..cf53721c5 100644
--- a/Dalamud/Interface/Internal/InterfaceManager.cs
+++ b/Dalamud/Interface/Internal/InterfaceManager.cs
@@ -596,6 +596,29 @@ namespace Dalamud.Interface.Internal
private unsafe class TargetFontModification : IDisposable
{
+ ///
+ /// Initializes a new instance of the class.
+ /// Constructs new target font modification information, assuming that AXIS fonts will not be applied.
+ ///
+ /// Name of the font to write to ImGui font information.
+ /// Target font size in pixels, which will not be considered for further scaling.
+ internal TargetFontModification(string name, float sizePx)
+ {
+ this.Name = name;
+ this.Axis = AxisMode.Suppress;
+ this.TargetSizePx = sizePx;
+ this.Scale = 1;
+ this.SourceAxis = null;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ /// Constructs new target font modification information.
+ ///
+ /// Name of the font to write to ImGui font information.
+ /// Whether and how to use AXIS fonts.
+ /// Target font size in pixels, which will not be considered for further scaling.
+ /// Font scale to be referred for loading AXIS font of appropriate size.
internal TargetFontModification(string name, AxisMode axis, float sizePx, float scale)
{
this.Name = name;
@@ -630,6 +653,10 @@ namespace Dalamud.Interface.Internal
}
}
+ ///
+ /// Loads font for use in ImGui text functions.
+ ///
+ /// If non-zero, then glyphs will be loaded in smaller resolution to make all glyphs fit into given constraints.
private unsafe void SetupFonts(int scaler = 0)
{
var gameFontManager = Service.Get();
@@ -817,8 +844,21 @@ namespace Dalamud.Interface.Internal
config.OversampleV = 1;
var name = Encoding.UTF8.GetString((byte*)config.Name.Data, config.Name.Count).TrimEnd('\0');
- this.loadedFontInfo[config.DstFont.NativePtr] = new($"PluginRequest({name})", TargetFontModification.AxisMode.Suppress, config.SizePixels, 1);
- config.SizePixels = (disableBigFonts ? DefaultFontSizePx : config.SizePixels) * fontLoadScale;
+
+ // While the font will be loaded in the scaled size after FontScale is applied, the font will be treated as having the requested size when used from plugins.
+ this.loadedFontInfo[config.DstFont.NativePtr] = new($"PluginRequest({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 > DefaultFontSizePx * fontLoadScale)
+ config.SizePixels = DefaultFontSizePx * fontLoadScale;
+ }
+ else
+ {
+ config.SizePixels = config.SizePixels * fontLoadScale;
+ }
}
ioFonts.Build();