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

Fix input text string rendering #6533

Merged

Conversation

MjnMixael
Copy link
Contributor

@MjnMixael MjnMixael commented Jan 17, 2025

PR #6481 added scaling ability to VFonts but got lucking in its clipping checks in that almost all gr_string() calls occur while the clip region is set to the screen size. There are a few edge cases that set the clip region to a specific bounding box. So we have to do our clipping checks before we do the coordinate offsets.

Took the opportunity to just cleanup the gr_string_old() function a touch while I was at it again; moved variable declarations to where they are actually used.

Fixes #6531

I'll add that I did a full dive into the original clipping code that was present and have again concluded it's not necessary. Much of it was intended to display only partial characters if part of the character was clipped. It would do this by adjusting the UV coordinates from which to get the character bitmap to display. However, the rendering code seems to do this clipping automatically so that's unnecessary. An easy way to see this in action is to add +Can Scale: true to the default fonts.tbl and set your font scale to something larger like 2.0. Then go to the pilot select screen and create a pilot. While typing the name you'll see the characters are cutoff at the bottom clip border without any of the special code in place to get partial character UV coordinates. I can only conclude that sometime between when Volition wrote this function and now, one of our rendering upgrades took over this task.

@wookieejedi
Copy link
Member

Overall makes sense, though just wanted to check about the change of >= to > and <= to < in the clipping? Thanks!

@MjnMixael
Copy link
Contributor Author

Overall makes sense, though just wanted to check about the change of >= to > and <= to < in the clipping? Thanks!

Yes, those are intentional. That's what they were originally and it makes sense. The coordinates need to be fully outside the clip region to trigger the clip.

@wookieejedi wookieejedi added fix A fix for bugs, not-a-bugs, and/or regressions. ui A feature or issue specific to the menus portion of the user interface labels Jan 18, 2025
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.

Thanks for the extra context, overall looks good to me!

@wookieejedi wookieejedi merged commit adb0fa6 into scp-fs2open:master Jan 18, 2025
16 checks passed
@MjnMixael MjnMixael deleted the fix_input_string_rendering branch January 18, 2025 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix A fix for bugs, not-a-bugs, and/or regressions. 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.

skipmemymissionyo cheat no longer displays input
2 participants