|
52 | 52 | //-----------------------------------------------------------------------------
|
53 | 53 | #include "PreRTS.h"
|
54 | 54 |
|
| 55 | +#include "Common/FileSystem.h" |
55 | 56 | #include "Common/INI.h"
|
56 | 57 | #include "Common/Registry.h"
|
| 58 | + |
| 59 | +#include "GameClient/Display.h" |
57 | 60 | #include "GameClient/GlobalLanguage.h"
|
58 |
| -#include "Common/FileSystem.h" |
59 | 61 |
|
60 | 62 | //-----------------------------------------------------------------------------
|
61 | 63 | // DEFINES ////////////////////////////////////////////////////////////////////
|
@@ -191,10 +193,34 @@ void GlobalLanguage::parseFontFileName( INI *ini, void * instance, void *store,
|
191 | 193 |
|
192 | 194 | Int GlobalLanguage::adjustFontSize(Int theFontSize)
|
193 | 195 | {
|
194 |
| - Real adjustFactor = TheGlobalData->m_xResolution/800.0f; |
| 196 | + // TheSuperHackers @tweak xezon 16/08/2025 The size adjustment now also weighs in |
| 197 | + // the display height for a balanced rescale on non 4:3 resolutions. |
| 198 | + // The aspect ratio scaling is clamped between 1 and 2 to avoid oversizing. |
| 199 | + // The scaler no longer clamps at max 2, which makes it work properly for |
| 200 | + // 4k Resolutions and beyond. |
| 201 | + |
| 202 | + Real w = TheDisplay->getWidth(); |
| 203 | + Real h = TheDisplay->getHeight(); |
| 204 | + const Real aspect = w / h; |
| 205 | + Real wScale = w / DEFAULT_DISPLAY_WIDTH; |
| 206 | + Real hScale = h / DEFAULT_DISPLAY_HEIGHT; |
| 207 | + |
| 208 | + if (aspect > 2.0f) |
| 209 | + { |
| 210 | + // Recompute width at aspect=2 |
| 211 | + w = 2.0f * h; |
| 212 | + wScale = w / DEFAULT_DISPLAY_WIDTH; |
| 213 | + } |
| 214 | + else if (aspect < 1.0f) |
| 215 | + { |
| 216 | + // Recompute height at aspect=1 |
| 217 | + h = 1.0f * w; |
| 218 | + hScale = h / DEFAULT_DISPLAY_HEIGHT; |
| 219 | + } |
| 220 | + |
| 221 | + Real adjustFactor = (wScale + hScale) * 0.5f; |
195 | 222 | adjustFactor = 1.0f + (adjustFactor-1.0f) * m_resolutionFontSizeAdjustment;
|
196 |
| - if (adjustFactor<1.0f) adjustFactor = 1.0f; |
197 |
| - if (adjustFactor>2.0f) adjustFactor = 2.0f; |
| 223 | + if (adjustFactor < 1.0f) adjustFactor = 1.0f; |
198 | 224 | Int pointSize = REAL_TO_INT_FLOOR(theFontSize*adjustFactor);
|
199 | 225 | return pointSize;
|
200 | 226 | }
|
|
0 commit comments