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