From cf1f11118e89df2c6640f22b1b684c68b5d02e3a Mon Sep 17 00:00:00 2001 From: Mauller <26652186+Mauller@users.noreply.github.com> Date: Sun, 10 Aug 2025 09:58:38 +0100 Subject: [PATCH] bugfix(gui): Scale fonts based on the smallest screen dimension so they scale independent of aspect ratio --- .../Code/GameEngine/Source/GameClient/GlobalLanguage.cpp | 7 ++++--- .../Code/GameEngine/Source/GameClient/GlobalLanguage.cpp | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp b/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp index ccc41f9eec..26b79bfd06 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp @@ -187,10 +187,11 @@ void GlobalLanguage::parseFontFileName( INI *ini, void * instance, void *store, Int GlobalLanguage::adjustFontSize(Int theFontSize) { - Real adjustFactor = TheGlobalData->m_xResolution / (Real)DEFAULT_DISPLAY_WIDTH; - adjustFactor = 1.0f + (adjustFactor-1.0f) * m_resolutionFontSizeAdjustment; + // TheSuperHackers @bugfix Mauller 25/08/2025 Scale fonts based on the smallest screen dimension so they are independent of aspect ratio + // We also rescale the font size adjustment to make the ingame fonts closer to what players have been used to with the original scaling + Real adjustFactor = min(TheGlobalData->m_xResolution / (Real)DEFAULT_DISPLAY_WIDTH, TheGlobalData->m_yResolution/ (Real)DEFAULT_DISPLAY_HEIGHT ); + adjustFactor = 1.0f + (adjustFactor-1.0f) * ( 0.25f + m_resolutionFontSizeAdjustment ); if (adjustFactor<1.0f) adjustFactor = 1.0f; - if (adjustFactor>2.0f) adjustFactor = 2.0f; Int pointSize = REAL_TO_INT_FLOOR(theFontSize*adjustFactor); return pointSize; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp index 6ab0a30fe6..7c5f8aeb06 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp @@ -191,10 +191,11 @@ void GlobalLanguage::parseFontFileName( INI *ini, void * instance, void *store, Int GlobalLanguage::adjustFontSize(Int theFontSize) { - Real adjustFactor = TheGlobalData->m_xResolution / (Real)DEFAULT_DISPLAY_WIDTH; - adjustFactor = 1.0f + (adjustFactor-1.0f) * m_resolutionFontSizeAdjustment; + // TheSuperHackers @bugfix Mauller 25/08/2025 Scale fonts based on the smallest screen dimension so they are independent of aspect ratio + // We also rescale the font size adjustment to make the ingame fonts closer to what players have been used to with the original scaling + Real adjustFactor = min(TheGlobalData->m_xResolution / (Real)DEFAULT_DISPLAY_WIDTH, TheGlobalData->m_yResolution/ (Real)DEFAULT_DISPLAY_HEIGHT ); + adjustFactor = 1.0f + (adjustFactor-1.0f) * ( 0.25f + m_resolutionFontSizeAdjustment ); if (adjustFactor<1.0f) adjustFactor = 1.0f; - if (adjustFactor>2.0f) adjustFactor = 2.0f; Int pointSize = REAL_TO_INT_FLOOR(theFontSize*adjustFactor); return pointSize; }