Skip to content

Commit 35e01c7

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

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,10 @@ void GlobalLanguage::parseFontFileName( INI *ini, void * instance, void *store,
187187

188188
Int GlobalLanguage::adjustFontSize(Int theFontSize)
189189
{
190-
Real adjustFactor = TheGlobalData->m_xResolution / (Real)DEFAULT_DISPLAY_WIDTH;
191-
adjustFactor = 1.0f + (adjustFactor-1.0f) * m_resolutionFontSizeAdjustment;
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 / (Real)DEFAULT_DISPLAY_WIDTH, TheGlobalData->m_yResolution/600.0f);
192+
adjustFactor = 1.0f + (adjustFactor-1.0f) * ( 0.25f + m_resolutionFontSizeAdjustment );
192193
if (adjustFactor<1.0f) adjustFactor = 1.0f;
193-
if (adjustFactor>2.0f) adjustFactor = 2.0f;
194194
Int pointSize = REAL_TO_INT_FLOOR(theFontSize*adjustFactor);
195195
return pointSize;
196196
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,10 @@ void GlobalLanguage::parseFontFileName( INI *ini, void * instance, void *store,
191191

192192
Int GlobalLanguage::adjustFontSize(Int theFontSize)
193193
{
194-
Real adjustFactor = TheGlobalData->m_xResolution / (Real)DEFAULT_DISPLAY_WIDTH;
195-
adjustFactor = 1.0f + (adjustFactor-1.0f) * m_resolutionFontSizeAdjustment;
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 / (Real)DEFAULT_DISPLAY_WIDTH, TheGlobalData->m_yResolution/600.0f);
196+
adjustFactor = 1.0f + (adjustFactor-1.0f) * ( 0.25f + m_resolutionFontSizeAdjustment );
196197
if (adjustFactor<1.0f) adjustFactor = 1.0f;
197-
if (adjustFactor>2.0f) adjustFactor = 2.0f;
198198
Int pointSize = REAL_TO_INT_FLOOR(theFontSize*adjustFactor);
199199
return pointSize;
200200
}

0 commit comments

Comments
 (0)