-
Notifications
You must be signed in to change notification settings - Fork 559
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
Properly fix using setfont()
/setrtl()
script commands in between text boxes
#1132
Conversation
This is broken for custom level fonts. Print flags can currently encode individual main fonts (built-in 8x8, Japanese, Chinese, etc...), but not individual fonts from level assets, which are stored in a separate Font selection:
So if you want to actually make it work this way, you'd have to extend the bitflag with a way to also encode individual level-specific fonts. Something like 32-63 for level-specific fonts 0-31, or a separate bit that just changes the meaning of the existing 0-31. Also, I think there's actually a nice side effect of the existing system - with internal scripting you could currently make text animate by switching fonts while keeping a textbox displayed! A change like this would make that impossible. Maybe it'd be cool to support both usecases somehow... |
8ea00fe
to
daf7770
Compare
Fixed. Also, overriding the fonts of every existing text box is now possible by specifying |
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.
I think it looks mostly alright from the code side? Just a couple small things, and I haven't tested it out yet.
I was honestly expecting a change like this to be way more invasive 😄
There used to be a problem with the setfont and setrtl script commands. Namely, if you used them in between text boxes naïvely, without any careful thought, then the fading out text box would suddenly gain the font of the new one. A kludge solution to this was implemented by simply blocking the script until the existing text box faded out before switching the font or RTL, and shipped for 2.4.0. However, a better solution is to simply bake the font flags in to the text box, so that way, if the level font switches, then the text box keeps its font. This is only for custom levels, because in the main game, the font in a text box needs to be able to change depending on language. But it seems like custom level translations weren't much on the roadmap, and so even the existing hack didn't support changing the font based on translation (even though translation of custom level cutscenes is supported). So baking the font flags into the text box here doesn't make things any worse. It also makes things better, arguably, by allowing multiple text boxes to exist on screen at once with different fonts. Maybe in the future we'll need a flag that specifies that the font should change depending on language if a translation in said language exists for the text box, or something like that. For people that want to override the fonts of every existing text box on screen, you can specify "all" as the second parameter of setfont or setrtl to do so.
daf7770
to
404ec30
Compare
Fixed. |
There used to be a problem with the
setfont()
andsetrtl()
script commands. Namely, if you used them in between text boxes naïvely, without any careful thought, then the fading out text box would suddenly gain the font of the new one. A kludge solution to this was implemented by simply blocking the script until the existing text box faded out before switching the font or RTL, and shipped for 2.4.0.However, a better solution is to simply bake the font flags in to the text box, so that way, if the level font switches, then the text box keeps its font.
This is only for custom levels, because in the main game, the font in a text box needs to be able to change depending on language. But it seems like custom level translations weren't much on the roadmap, and so even the existing hack didn't support changing the font based on translation (even though translation of custom level cutscenes is supported). So baking the font flags into the text box here doesn't make things any worse.
It also makes things better, arguably, by allowing multiple text boxes to exist on screen at once with different fonts.
Maybe in the future we'll need a flag that specifies that the font should change depending on language if a translation in said language exists for the text box, or something like that.
For people that want to override the fonts of every existing text box on screen, you can specify
all
as the second parameter ofsetfont
orsetrtl
to do so.Here is an example of what you can do now.
Legal Stuff:
By submitting this pull request, I confirm that...
CONTRIBUTORS
file and the "GitHub Friends"section of the credits for all of said releases, but will NOT be compensated
for these changes unless there is a prior written agreement