Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link

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?

Copy link
Author

@Mauller Mauller Aug 10, 2025

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.

Copy link

@xezon xezon Aug 13, 2025

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;

Copy link
Author

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.

adjustFactor = 1.0f + (adjustFactor-1.0f) * m_resolutionFontSizeAdjustment;
if (adjustFactor<1.0f) adjustFactor = 1.0f;
if (adjustFactor>2.0f) adjustFactor = 2.0f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,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);
adjustFactor = 1.0f + (adjustFactor-1.0f) * m_resolutionFontSizeAdjustment;
if (adjustFactor<1.0f) adjustFactor = 1.0f;
if (adjustFactor>2.0f) adjustFactor = 2.0f;
Expand Down
Loading