Skip to content
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

Add scaling for vfnts and scale multipler to gr_string() #6481

Merged
merged 4 commits into from
Jan 14, 2025

Conversation

MjnMixael
Copy link
Contributor

Adds two features for string handling:

First it adds scaling ability to Volition fonts which brings them into parity with TTF fonts. In doing so it made sense to move the font scale option out of the TTF font cpp file and into the general font cpp file. Notably, allowing players to scale fonts is currently opt-in. Now that all font types can scale, there's possibly an argument to make them opt-out. I could go either way, personally.

Second it adds a scale multiplier to gr_string(). This will be used for the HUD Config upgrade and it basically allows a gr_string() call to multiply the user's font scale up or down by a percentage. Think of it like a C++ version of CSS's em font size capability. This did change the signature of gr_string() because I felt scaleMultiplier had more utility than the length parameter and there were only a handful of places where length was used so it was fairly trivial to update them.

@MjnMixael MjnMixael added this to the Release 25.0 milestone Dec 21, 2024
@wookieejedi wookieejedi added enhancement A new feature or upgrade of an existing feature to add additional functionality. refactor A cleanup/restructure of a feature for speed, simplicity, and/or maintainability graphics A feature or issue related to graphics (2d and 3d) labels Dec 21, 2024
@MjnMixael MjnMixael force-pushed the volition_font_scaling branch from f33eaf0 to 9c3f0ad Compare December 30, 2024 17:57
Copy link
Member

@BMagnu BMagnu left a comment

Choose a reason for hiding this comment

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

Looks good, mostly.
One question.

Comment on lines +398 to +403
if (optional_string("+Can Scale:")) {
bool temp;

stuff_boolean(&temp);

font->setScaleBehavior(temp);
Copy link
Member

Choose a reason for hiding this comment

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

What's the default for the scale behaviour?
Would it be sensible to default-allow it, or will that break stuff?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently the default scale behavior is not to scale at all. A font must explicitly allow it using this table setting first.

Now that font scaling can handle vfnts, I think there's an argument to be made to make it default allow but I'm unsure how the retail UI would be impacted in all cases... we have a lot of UIs that'd need to be sanity checked just to be sure. Personally, I'd feel better about tackling that in a follow-up to allow for additional retail testing and because there's a couple different ways it could be done. (Default engine-wide, default by editing the built-in fonts.tbl, etc)

Copy link
Member

Choose a reason for hiding this comment

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

Good point.
Presumably, if sanity-checked, it could be auto-enabled if the mod targets an engine version like 25.2 or something.

@wookieejedi
Copy link
Member

Will merge later today unless someone else beats me to it

@wookieejedi wookieejedi merged commit d27f735 into scp-fs2open:master Jan 14, 2025
16 checks passed
@MjnMixael MjnMixael deleted the volition_font_scaling branch January 14, 2025 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A new feature or upgrade of an existing feature to add additional functionality. graphics A feature or issue related to graphics (2d and 3d) refactor A cleanup/restructure of a feature for speed, simplicity, and/or maintainability
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants