Skip to content

Conversation

xezon
Copy link

@xezon xezon commented Aug 16, 2025

This change is an alternative implementation for #1442.

The disadvantage of #1442 is that the proposed new font scaling for 1920 x 1080 is noticably smaller than the original font scaling: 21%. This is an inconvenience, because 1920 x 1080 and other 16:9 resolutions are the most popular resolutions to play with and their font scales are generally ok.

With this change, the font scaling is redesigned to scale better in different resolutions and aspect ratios. In 1920x1080 the font size will be just 11% smaller than originally.

Resolution Classic factor Strict Method factor Balanced Method factor
800 x 600 (4:3) 1.00 1.00 1.00
1600 x 1200 (4:3) 1.70 1.70 1.70
1920 x 1080 (16:9) 1.98 1.56 1.77
3840 x 2160 (16:9) 2.00 (capped) 3.24

Additionally, the maximum scale limit is removed, which makes the font look prettier in 4k Resolution and beyond.

TODO

  • Replicate in Generals

@xezon xezon added this to the Important features milestone Aug 16, 2025
@xezon xezon added Enhancement Is new feature or request GUI For graphical user interface Major Severity: Minor < Major < Critical < Blocker Gen Relates to Generals ZH Relates to Zero Hour labels Aug 16, 2025
@Mauller
Copy link

Mauller commented Aug 16, 2025

Compared to scaling off the smallest side of the image, this does not work the moment you compare between different aspect ratios where the resolutions have the same height or width.

in 2560x1080 the font is a size larger for every font compared to 1920x1080.

at 3440x1440 the font is larger than 2560x1440 etc.

By scaling off the smallest edge the font size is consistent between different aspect ratios. If you were to theoretically compare
1440x1080 (4:3) to 1920x1080 and 2520x1080 (21:9) the fonts increase in size as the aspect ratio increases.

@xezon
Copy link
Author

xezon commented Aug 16, 2025

I do not know what this means.

@Mauller
Copy link

Mauller commented Aug 17, 2025

I do not know what this means.

This method does not work since you are scaling based on both display axis. And due to this, it does not keep the font size consistant at increasing aspect ratio.
So when one of the display axis is fixed, increasing the other display dimension increases font size.

@xezon
Copy link
Author

xezon commented Aug 17, 2025

Yes this is intended.

@Mauller
Copy link

Mauller commented Aug 17, 2025

Yes this is intended.

But it is not the correct behaviour that we should have, because it means less text will fit vertically if you had the same 1080 height and the screen gets wider.

Fonts get larger in both dimensions as their point increases.

It will also make fonts not scale properly to other UI elements as the screen gets wider as well.

@xezon
Copy link
Author

xezon commented Aug 17, 2025

Yes but since the screen is wider or higher, there will be more room to fit texts. I am not concerned about the "technical" correctness of it, if it just looks good in the UI that the game has.

Can you show an example where this does not look correct with the proposed change?

@Mauller
Copy link

Mauller commented Aug 17, 2025

it introduces inconsistant behaviour as the screen aspect ratio changes.
At a fixed screen height, people don't expect elements to vertically grow as the horizontal resolution increases.

If a UI element is created that scales with the vertical resolution and someone sets a font for the height of that element, at a different screeen aspect the font will grow or shrink and not be consistant for that display element.

At a fixed screen height, the font should be consistent and remain the same size, even as the width of the screen changes.

@xezon
Copy link
Author

xezon commented Aug 17, 2025

At a fixed screen height, people don't expect elements to vertically grow as the horizontal resolution increases.

How do you know this?

The font sizes in Generals UI are much smaller than the buttons and things they are contained in. So there is enough room to increase their sizes. This change gives a balanced growth for aspects > 1.33 < 2.00

I suggest take a look at it ingame and see how the UI looks, not the technical expectation.

@Mauller
Copy link

Mauller commented Aug 17, 2025

i am considering the behaviour and use of fonts within game now and in future, when UI changes are made or within MODs etc.

So you have to consider the technicalities of how this affects font handling in general.

The font scaling also affects more than just the UI elements, it also affects ingame text too etc.

adjustFactor = 1.0f + (adjustFactor-1.0f) * m_resolutionFontSizeAdjustment;
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.

On a different note, this also breaks the current implementation of control bar pro at higher than 2k.

I made this tweak in the past for my test builds.

It would require control bar pro to be updated with a parralel SH compatible version that removes the new fonts for 2k+ resolutions

Copy link
Author

Choose a reason for hiding this comment

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

Fixed.

@Stubbjax
Copy link

@Mauller is correct - it is the most common way I've known PC games to scale their UIs, where the view width ideally does not have any influence on the vertical scale of UI elements.

Example 1
Example 2

@xezon xezon force-pushed the xezon/tweak-resolution-font-scale branch from 3a95cef to 01dc8cb Compare August 19, 2025 20:56
@xezon
Copy link
Author

xezon commented Aug 19, 2025

@Mauller is correct - it is the most common way I've known PC games to scale their UIs, where the view width ideally does not have any influence on the vertical scale of UI elements.

Ok. I have implemented two new scaling methods now: Strict and Balanced. The Balanced method looks closer to the Classic method which is far more important for the original UI and smooth adoption than forcing the Strict method. Note that Classic looks NOT broken in 1920x1080. The Strict method can be opt-in for new UI's that prefer it. And Control Bar Pro will automatically enable the Classic scaling method.

@Mauller
Copy link

Mauller commented Aug 22, 2025

Honestly this is still just over complicating something that is pretty straightforward.

If the font sizing is considered a little small we can adjust the m_resolutionFontSizeAdjustment value to make text a little bigger.
I think at the moment it is set to 0.75

@xezon
Copy link
Author

xezon commented Aug 22, 2025

I suggest test it in game if not yet done. To me this change looked good whereas #1442 did not.

@Mauller
Copy link

Mauller commented Aug 22, 2025

I suggest test it in game if not yet done. To me this change looked good whereas #1442 did not.

I have been using 1442 in test builds for the past few months now, it looks consistent and right at all resolutions and aspect ratios. And it matches how text looks when comparing various UI or ingame elements to original 4:3 resolutions and is how it would have looked if 16:9 had been officially supported and the bug had not existed.

No one using the test builds has complained that the font size is a problem, if anything they notice that text fits better and more shows in replay or map lists.

yes the text is smaller than how it shows in retail when people use resolutions beyond what the game engine officially supported, but that is because of a bug rather than because of how it was meant to look.

@xezon
Copy link
Author

xezon commented Aug 22, 2025

No one using the test builds has complained that the font size is a problem

I am raising it to be a problem. Does my feedback not matter? I have played with 1920 x 1080 for many years and this font size reduction is very noticable for me and not all positive.

For example look at the small money value in game. It is more difficult to see.

I think it is a mistake to default to Strict font scaling until we tweak UI more in data.

@Mauller
Copy link

Mauller commented Aug 23, 2025

No one using the test builds has complained that the font size is a problem

I am raising it to be a problem. Does my feedback not matter? I have played with 1920 x 1080 for many years and this font size reduction is very noticable for me and not all positive.

For example look at the small money value in game. It is more difficult to see.

I think it is a mistake to default to Strict font scaling until we tweak UI more in data.

I think i have a reasonable solution that meets both needs, the m_resolutionFontSizeAdjustment value is currently set to 0.7. at first i thought it was just a constant, but also appears to be updated from ini data, but we could set something to ignore the value or just not use it currently when scaling fonts.

ignoring it while using the smallest axis scaling method (strict), maintains the font scaling across all aspect ratios while increasing the size of the font in a linear fashion.

For example this is the main menu while ignoring the m_resolutionFontSizeAdjustment and using the strict scaling
image

And this is how it looks in current retail
image

Fonts look to be around a point size or two smaller compared to how it appears at 1080p in retail but still much larger than what they were when scaled against m_resolutionFontSizeAdjustment = 0.7

The current credits in comparisson

ignoring m_resolutionFontSizeAdjustment
image

And in the bugged retail
image

So we could ignore this font scaling value from data for now and achieve both linear font scaling with aspect ratio while having the larger fonts that are closer to what people are currently used to.

It ends upcoming to an adjustment factor of 1.79.

If we wanted to keep the value in place then we need to do something like fontadjust * ( 0.3f + m_resolutionFontSizeAdjustment) so it rescales the font adjustment value up to 1.

@helmutbuhler
Copy link

I also think the implementation in this PR is too complicated. How about with use the strict algo and apply a constant size increase (because players are now used to the bigger size).
I also don't think we need to bother to retain bugs for the control bar pro. It will be easy to update that.

@Mauller
Copy link

Mauller commented Aug 25, 2025

I have altered the implementation of #1442 so it now rescales m_resolutionFontSizeAdjustment and allows font's to scale for resolutions beyond 2k.

It produces fonts closer to 1080p retail while maintaining uniform font scaling across all resolutions and aspect ratios.

@xezon
Copy link
Author

xezon commented Aug 27, 2025

We will need to find some compromise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Is new feature or request Gen Relates to Generals GUI For graphical user interface Major 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
4 participants