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

Ttf font scaling option #6330

Merged
merged 6 commits into from
Nov 27, 2024
Merged

Conversation

MjnMixael
Copy link
Contributor

Adds an in-game option to scale the internal fonts. Only works with TTF fonts so after the font table is parsed we check. If there are no scaling-allowed TTF fonts then we remove the option.

Scaling fonts is explicitly opt-in so that mods can control what can scale.. thinking mostly of HUDs with this. I have a plan of attack for allowing HUDs to scale in a later PR.

@MjnMixael MjnMixael added the Waiting for Stable Marks a pull request that is to be merged after the next stable release, due to a release cycle label Aug 28, 2024
@MjnMixael MjnMixael force-pushed the ttf_font_scaling_option branch 2 times, most recently from 0b201bd to a1d4d29 Compare August 29, 2024 00:07
@Goober5000 Goober5000 removed the Waiting for Stable Marks a pull request that is to be merged after the next stable release, due to a release cycle label Oct 28, 2024
@wookieejedi wookieejedi added enhancement A new feature or upgrade of an existing feature to add additional functionality. ui A feature or issue specific to the menus portion of the user interface labels Oct 28, 2024
@wookieejedi wookieejedi added this to the Release 25.0 milestone Oct 29, 2024
@MjnMixael MjnMixael added the Requested by Active Mod A feature request that has been requested by a mod that is actively in development. label Oct 29, 2024
Copy link
Member

@wookieejedi wookieejedi left a comment

Choose a reason for hiding this comment

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

Look good to me, and definitely useful. Of course wouldn't hurt to have another set of eyes, such as @BMagnu, too.

@MjnMixael MjnMixael force-pushed the ttf_font_scaling_option branch from fb645cd to b150eb8 Compare November 25, 2024 15:19
@MjnMixael MjnMixael force-pushed the ttf_font_scaling_option branch from b150eb8 to 9830253 Compare November 25, 2024 18:36
Comment on lines 830 to 831
// Not sure if we should do this.. kinda depends on if the text is drawn at the top of the screen or the bottom
float offsetY = (scaledSize - originalSize) * 0.5f;
Copy link
Member

Choose a reason for hiding this comment

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

Given that the text is set to ALIGN_TOP a few lines later, IMO the scaling should reflect that (as in, that the upper left corner of the text does not move when the text scales).
Rather than manually offset the position, it's probably better to let the text library handle that, and if necessary, make the text alignment configurable for stuff like scripting or maybe even hudgauges.
In the long run, this anchor needs to set properly (both horizontally and vertically) by whatever is drawing the text based on the context in which it's drawn to get proper anchor behaviour everywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comments updated per our discussion on Discord

@BMagnu BMagnu merged commit 06b0966 into scp-fs2open:master Nov 27, 2024
16 checks passed
@MjnMixael MjnMixael deleted the ttf_font_scaling_option branch November 27, 2024 10:14
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. Requested by Active Mod A feature request that has been requested by a mod that is actively in development. ui A feature or issue specific to the menus portion of the user interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants