Skip to content

Commit a4caabb

Browse files
committed
bugfix(gui): Scale fonts based on the smallest screen dimension so they scale independent of aspect ratio
1 parent 1eceff5 commit a4caabb

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ void GlobalLanguage::parseFontFileName( INI *ini, void * instance, void *store,
187187

188188
Int GlobalLanguage::adjustFontSize(Int theFontSize)
189189
{
190-
Real adjustFactor = TheGlobalData->m_xResolution/800.0f;
190+
// TheSuperHackers @bugfix Mauller 10/08/2025 Scale fonts based on the smallest screen dimension so they are independent of aspect ratio
191+
Real adjustFactor = min(TheGlobalData->m_xResolution/800.0f, TheGlobalData->m_yResolution/600.0f);
191192
adjustFactor = 1.0f + (adjustFactor-1.0f) * m_resolutionFontSizeAdjustment;
192193
if (adjustFactor<1.0f) adjustFactor = 1.0f;
193194
if (adjustFactor>2.0f) adjustFactor = 2.0f;

GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ void GlobalLanguage::parseFontFileName( INI *ini, void * instance, void *store,
191191

192192
Int GlobalLanguage::adjustFontSize(Int theFontSize)
193193
{
194-
Real adjustFactor = TheGlobalData->m_xResolution/800.0f;
194+
// TheSuperHackers @bugfix Mauller 10/08/2025 Scale fonts based on the smallest screen dimension so they are independent of aspect ratio
195+
Real adjustFactor = min(TheGlobalData->m_xResolution/800.0f, TheGlobalData->m_yResolution/600.0f);
195196
adjustFactor = 1.0f + (adjustFactor-1.0f) * m_resolutionFontSizeAdjustment;
196197
if (adjustFactor<1.0f) adjustFactor = 1.0f;
197198
if (adjustFactor>2.0f) adjustFactor = 2.0f;

0 commit comments

Comments
 (0)