Skip to content

Conversation

Mauller
Copy link

@Mauller Mauller commented Aug 14, 2025

This PR adds user based font scaling adjustment to the game.

The value can be set within the options.ini by setting ResolutionFontAdjustment = 10 etc, where the value is a percentage increase, the default being 0% of the original scale.

This value acts on the normal ini based resolution scaling to give some user flexibility.


TODO:

  • Replicate in generals

@Mauller Mauller self-assigned this Aug 14, 2025
@Mauller Mauller added Enhancement Is new feature or request GUI For graphical user interface Minor Severity: Minor < Major < Critical < Blocker Gen Relates to Generals ZH Relates to Zero Hour labels Aug 14, 2025
@Mauller Mauller force-pushed the feat-user-font-adjust branch from 828eaa2 to b632b27 Compare August 14, 2025 19:00
@Mauller
Copy link
Author

Mauller commented Aug 14, 2025

Tweaked some naming but theres likely going to be the odd bit of name tweaking still.

@Mauller Mauller force-pushed the feat-user-font-adjust branch from b632b27 to 654b37e Compare August 15, 2025 13:41
Copy link

@xezon xezon left a comment

Choose a reason for hiding this comment

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

I suggest to merge this change before the other, so we can experiment with this.

@Mauller
Copy link
Author

Mauller commented Aug 27, 2025

I suggest to merge this change before the other, so we can experiment with this.

i will tweak and rebase this on main so it can be merged independent of other font scaling tweaks.

@Mauller Mauller force-pushed the feat-user-font-adjust branch from 654b37e to 5b6391f Compare August 31, 2025 09:14
@Mauller
Copy link
Author

Mauller commented Aug 31, 2025

Rebased, removed the other font scaling stuff and tweaked based on feedback.

This now will not scale the font if the value is set to zero, which i have set as the default.

@xezon
Copy link

xezon commented Aug 31, 2025

This is not what I meant :)

adjustFactor = 1.0f + (adjustFactor-1.0f) * m_resolutionFontSizeAdjustment * TheGlobalData->m_resolutionFontAdjustment; was fine, because if TheGlobalData->m_resolutionFontAdjustment is 0, then the adjust factor simply will be one: no resolution scaling, text has same size as with 800 x 600

* (1 + TheGlobalData->m_resolutionFontAdjustment) is misleading, because 1 becomes 2 (doubling).

@Mauller
Copy link
Author

Mauller commented Aug 31, 2025

This is not what I meant :)

adjustFactor = 1.0f + (adjustFactor-1.0f) * m_resolutionFontSizeAdjustment * TheGlobalData->m_resolutionFontAdjustment; was fine, because if TheGlobalData->m_resolutionFontAdjustment is 0, then the adjust factor simply will be one: no resolution scaling, text has same size as with 800 x 600

* (1 + TheGlobalData->m_resolutionFontAdjustment) is misleading, because 1 becomes 2 (doubling).

Yeah i thought you meant that zero would result in the extra user option not having any effect on the current scaling.
So the game essentially just scales like it normally would.

Also this is the game with just the raw Font sizes, so m_resolutionFontAdjustment at zero
image

@Mauller Mauller force-pushed the feat-user-font-adjust branch from 5b6391f to d1843fa Compare August 31, 2025 14:37
@Mauller
Copy link
Author

Mauller commented Aug 31, 2025

Tweaked and pushed.

@xezon
Copy link

xezon commented Aug 31, 2025

One more thought: If a user sets the scale to 1, then we would expect a linear scale. But instead it would "secretly" scale by 0.7 * 1. I wonder if we should do something about that.

@Mauller
Copy link
Author

Mauller commented Aug 31, 2025

One more thought: If a user sets the scale to 1, then we would expect a linear scale. But instead it would "secretly" scale by 0.7 * 1. I wonder if we should do something about that.

Should we override whatever m_resolutionFontSizeAdjustment is set to with the user set option? But take whatever m_resolutionFontSizeAdjustment is as the default?

Situation here ends up a bit like what the scroll Anchor PR is doing.
We consider the user option to be the source of truth and the ini value as the default.

@xezon
Copy link

xezon commented Aug 31, 2025

Maybe start m_resolutionFontSizeAdjustment as -1 and if it less than 0 then we use Language.ini settings, otherwise user setting. Not sure.

@Mauller Mauller force-pushed the feat-user-font-adjust branch from d1843fa to 37ee9c5 Compare September 3, 2025 18:37
@Mauller
Copy link
Author

Mauller commented Sep 3, 2025

So tweaked this now so by default, for this PR, the user based setting does not adjust the default from languages.ini

@Mauller Mauller force-pushed the feat-user-font-adjust branch from 37ee9c5 to 1105ede Compare September 4, 2025 19:00
@Mauller
Copy link
Author

Mauller commented Sep 4, 2025

Tweaked based on some of the feedback.

@Mauller Mauller force-pushed the feat-user-font-adjust branch from 1105ede to 2c6ada7 Compare September 4, 2025 20:03
@Mauller
Copy link
Author

Mauller commented Sep 4, 2025

Tweaked now so the GlobalLanguage reads from the options.ini and loads the value locally.

The options menu then reads from the options ini and sets the value in GlobalLanguage

@Mauller
Copy link
Author

Mauller commented Sep 5, 2025

will replicate to generals later if we think this is good to go now.

@Mauller Mauller force-pushed the feat-user-font-adjust branch from 2c6ada7 to 8845a00 Compare September 5, 2025 14:57
@Mauller
Copy link
Author

Mauller commented Sep 5, 2025

Tweaked and replicated to generals

@Mauller Mauller force-pushed the feat-user-font-adjust branch from 8845a00 to 72e16f6 Compare September 9, 2025 17:51
@Mauller
Copy link
Author

Mauller commented Sep 9, 2025

Tweaked and pushed.

//-------------------------------------------------------------------------------------------------
// Set User Font Scaling Percentage
val = pref->getResolutionFontAdjustment() * 100.0f; // TheSuperHackers @todo replace with options input when applicable
if (val >= 0)
Copy link

Choose a reason for hiding this comment

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

if this is -1 default, then this is not saved to Options.ini? Is this intended?

Copy link
Author

Choose a reason for hiding this comment

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

tweaked it now so -100 is a considered value since it's a special case for disabling the user font scaling.

Copy link

Choose a reason for hiding this comment

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

Does it even need the check at all? The OptionPreferences function already clamps it to valid values, so we could just go ahead and use its returned value without checking it?

Copy link
Author

Choose a reason for hiding this comment

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

The checks there more for later when we have UI elements to set the value instead of it being taken from prefs directly as it currently is.

Copy link

Choose a reason for hiding this comment

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

Ok. I dont yet quite understand how the user will be setting a minus one.

@Mauller Mauller force-pushed the feat-user-font-adjust branch from 72e16f6 to 0188f49 Compare September 10, 2025 17:45
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 Minor Severity: Minor < Major < Critical < Blocker ZH Relates to Zero Hour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants