-
Notifications
You must be signed in to change notification settings - Fork 89
bugfix(gui): Scale fonts based on the smallest screen dimension so they scale independent of aspect ratio #1442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…ey scale independent of aspect ratio
@@ -187,7 +187,8 @@ void GlobalLanguage::parseFontFileName( INI *ini, void * instance, void *store, | |||
|
|||
Int GlobalLanguage::adjustFontSize(Int theFontSize) | |||
{ | |||
Real adjustFactor = TheGlobalData->m_xResolution/800.0f; | |||
// TheSuperHackers @bugfix Mauller 10/08/2025 Scale fonts based on the smallest screen dimension so they are independent of aspect ratio | |||
Real adjustFactor = min(TheGlobalData->m_xResolution/800.0f, TheGlobalData->m_yResolution/600.0f); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I expect that this will significantly shrink text size in the most popular resolution: 1920 x 1080
Originally the adjust factor was 2.4, with this change 1.8, which is a 25% size decrease (before m_resolutionFontSizeAdjustment).
How do we deal with that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The font was scaled larger than it should have been to begin with and only gets larger on a 21:9 monitor.
If you run this and compare, the fonts often look better and are more in proportion compared to before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a look and texts look smaller than we are used to.
How about we make a follow up change and expose a ResolutionFontAdjustment
setting to the Options.ini with a default value of 1.
This would then multiply with the ResolutionFontAdjustment
from Language.ini and give the user the option to modify the default scaling without touching Language.ini
So in code it would then do
adjustFactor = 1.0f + (adjustFactor-1.0f) * m_resolutionFontSizeAdjustment * anotherResolutionFontSizeAdjustment;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, i can make the followup lead off this PR, will sort that in a sec.
This PR adds the ability for the font scaling function to properly handle scaling fonts when non 4:3 aspect ratios are used.
At the moment since only the width is taken into account, fonts can be scaled larger than they should be when playing in a wide aspect ratio.
This PR makes sure that fonts scale with the smallest screen dimension so they scale in a more uniform way independent of the aspect ratio itself.