File tree Expand file tree Collapse file tree 6 files changed +35
-1
lines changed
GeneralsMD/Code/GameEngine Expand file tree Collapse file tree 6 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -409,6 +409,9 @@ class GlobalData : public SubsystemInterface
409
409
Int m_systemTimeFontSize;
410
410
Int m_gameTimeFontSize;
411
411
412
+ // TheSuperHackers @feature user adjustable font size percentage
413
+ Real m_userFontSizeAdjustment;
414
+
412
415
Real m_shakeSubtleIntensity; // /< Intensity for shaking a camera with SHAKE_SUBTLE
413
416
Real m_shakeNormalIntensity; // /< Intensity for shaking a camera with SHAKE_NORMAL
414
417
Real m_shakeStrongIntensity; // /< Intensity for shaking a camera with SHAKE_STRONG
Original file line number Diff line number Diff line change @@ -135,6 +135,8 @@ class OptionPreferences : public UserPreferences
135
135
136
136
Int getSystemTimeFontSize (void );
137
137
Int getGameTimeFontSize (void );
138
+
139
+ Real getUserFontScale (void );
138
140
};
139
141
140
142
// -----------------------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -101,6 +101,7 @@ class GlobalLanguage : public SubsystemInterface
101
101
FontDesc m_creditsNormalFont;
102
102
103
103
Real m_resolutionFontSizeAdjustment;
104
+ Real m_userFontSizeAdjustment;
104
105
105
106
// UnicodeString m_unicodeFontNameUStr;
106
107
Original file line number Diff line number Diff line change @@ -937,6 +937,8 @@ GlobalData::GlobalData()
937
937
m_systemTimeFontSize = 8 ;
938
938
m_gameTimeFontSize = 8 ;
939
939
940
+ m_userFontSizeAdjustment = 1 .0f ;
941
+
940
942
m_debugShowGraphicalFramerate = FALSE ;
941
943
942
944
// By default, show all asserts.
@@ -1204,6 +1206,8 @@ void GlobalData::parseGameDataDefinition( INI* ini )
1204
1206
TheWritableGlobalData->m_systemTimeFontSize = optionPref.getSystemTimeFontSize ();
1205
1207
TheWritableGlobalData->m_gameTimeFontSize = optionPref.getGameTimeFontSize ();
1206
1208
1209
+ TheWritableGlobalData->m_userFontSizeAdjustment = optionPref.getUserFontScale ();
1210
+
1207
1211
Int val=optionPref.getGammaValue ();
1208
1212
// generate a value between 0.6 and 2.0.
1209
1213
if (val < 50 )
Original file line number Diff line number Diff line change @@ -828,6 +828,20 @@ Int OptionPreferences::getGameTimeFontSize(void)
828
828
return fontSize;
829
829
}
830
830
831
+ Real OptionPreferences::getUserFontScale (void )
832
+ {
833
+ OptionPreferences::const_iterator it = find (" UserFontScale" );
834
+ if (it == end ())
835
+ return 1 .0f ;
836
+
837
+ Real fontRatio = (Real)atof (it->second .str ()) / 100 .0f ;
838
+ if (fontRatio < 0 .5f )
839
+ {
840
+ fontRatio = 0 .5f ;
841
+ }
842
+ return fontRatio;
843
+ }
844
+
831
845
static OptionPreferences *pref = NULL ;
832
846
833
847
static void setDefaults ( void )
@@ -1354,6 +1368,16 @@ static void saveOptions( void )
1354
1368
TheInGameUI->refreshGameTimeResources ();
1355
1369
}
1356
1370
1371
+ // -------------------------------------------------------------------------------------------------
1372
+ // Set User Font Scaling Percentage
1373
+ val = pref->getUserFontScale () * 100 .0f ; // TheSuperHackers @todo replace with options input when applicable
1374
+ if (val >= 50 )
1375
+ {
1376
+ AsciiString prefString;
1377
+ prefString.format (" %d" , REAL_TO_INT ( val ) );
1378
+ (*pref)[" UserFontScale" ] = prefString;
1379
+ }
1380
+
1357
1381
// -------------------------------------------------------------------------------------------------
1358
1382
// Resolution
1359
1383
//
Original file line number Diff line number Diff line change @@ -193,7 +193,7 @@ Int GlobalLanguage::adjustFontSize(Int theFontSize)
193
193
{
194
194
// TheSuperHackers @bugfix Mauller 10/08/2025 Scale fonts based on the smallest screen dimension so they are independent of aspect ratio
195
195
Real adjustFactor = min (TheGlobalData->m_xResolution /800 .0f , TheGlobalData->m_yResolution /600 .0f );
196
- adjustFactor = 1 .0f + (adjustFactor-1 .0f ) * m_resolutionFontSizeAdjustment;
196
+ adjustFactor = 1 .0f + (adjustFactor-1 .0f ) * m_resolutionFontSizeAdjustment * TheGlobalData-> m_userFontSizeAdjustment ;
197
197
if (adjustFactor<1 .0f ) adjustFactor = 1 .0f ;
198
198
if (adjustFactor>2 .0f ) adjustFactor = 2 .0f ;
199
199
Int pointSize = REAL_TO_INT_FLOOR (theFontSize*adjustFactor);
You can’t perform that action at this time.
0 commit comments