-
Notifications
You must be signed in to change notification settings - Fork 164
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
Ttf font scaling option #6330
Conversation
0b201bd
to
a1d4d29
Compare
There was a problem hiding this 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.
fb645cd
to
b150eb8
Compare
b150eb8
to
9830253
Compare
code/graphics/render.cpp
Outdated
// 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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
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.