Skip to content

Conversation

Mauller
Copy link

@Mauller Mauller commented Aug 10, 2025

Alternative to:


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.

The PR now also rescales the m_resolutionFontSizeAdjustment value to only reduce fonts by 5%. This makes ingame fonts closer to what people have been used to when playing 1080p in retail, although the fonts are still slightly smaller overall.

Fonts can now also scale up beyond 2K resolutions as i removed the limit on scaling.

@Mauller Mauller self-assigned this Aug 10, 2025
@Mauller Mauller added Bug Something is not working right, typically is user facing GUI For graphical user interface Minor Severity: Minor < Major < Critical < Blocker Gen Relates to Generals ZH Relates to Zero Hour labels Aug 10, 2025
@@ -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.

@Mauller
Copy link
Author

Mauller commented Aug 10, 2025

This is 1920x1080 with the above fix
image
image

This is 1600x1200 which will scale as the game originally scaled the font
image
image

This is 1920x1080 without the tweaked scaling, the fonts are larger in proportion than they should be relative to 4:3 and the menu buttons etc.
image
image

@Mauller
Copy link
Author

Mauller commented Aug 14, 2025

Just a rebase before making the followup PR for user font adjustment.

@Mauller
Copy link
Author

Mauller commented Aug 25, 2025

A rebase with main before tweaking the implementation

@Mauller Mauller force-pushed the fix-font-scaling branch 2 times, most recently from 35e01c7 to e41707c Compare August 25, 2025 09:09
@Mauller
Copy link
Author

Mauller commented Aug 25, 2025

So i have tweaked the implementation of this so the m_resolutionFontSizeAdjustment gets rescaled.
With the rescaled rescaling factor it only reduces the font size by 5% instead of 30%.

This makes the fonts much closer to what people were used to with the original broken scaling while keeping the ability to use the m_resolutionFontSizeAdjustment and the strict smallest screen dimension scaling.

This then results in uniform font scaling across all resolutions and aspect ratios.

@Mauller
Copy link
Author

Mauller commented Aug 25, 2025

The money counter at different resolutions and aspect ratios

1600x1200 (4:3)
image

1920x1080 (16:9)
image

3440:1440 (21:9)
image

3200:900 (32:) - Not as realistic a resolution but shows the uniform scaling
image

@helmutbuhler
Copy link

Much better!

if (adjustFactor<1.0f) adjustFactor = 1.0f;
if (adjustFactor>2.0f) adjustFactor = 2.0f;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will create very large fonts with the original Control Bar Pro in 2k and 4k presets.

// TheSuperHackers @bugfix Mauller 25/08/2025 Scale fonts based on the smallest screen dimension so they are independent of aspect ratio
// We also rescale the font size adjustment to make the ingame fonts closer to what players have been used to with the original scaling
Real adjustFactor = min(TheGlobalData->m_xResolution / (Real)DEFAULT_DISPLAY_WIDTH, TheGlobalData->m_yResolution/ (Real)DEFAULT_DISPLAY_HEIGHT );
adjustFactor = 1.0f + (adjustFactor-1.0f) * ( 0.25f + m_resolutionFontSizeAdjustment );
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.25f is a magic value that does not belong here. It will also change the scaling in 1600 x 1200 (4:3). I do not like this solution, because it changes the promise of m_resolutionFontSizeAdjustment.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to use the default value of the new scaler in the Options.ini to apply the new adjustment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is not working right, typically is user facing Gen Relates to Generals GUI For graphical user interface Minor Severity: Minor < Major < Critical < Blocker ZH Relates to Zero Hour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scaling Font with Resolution Game text size does not scale well beyond 1920x1080 game resolution
3 participants