Closed InfoTeddy closed 7 months ago
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 FontContainer
with their own index. When you use setfont()
, you're changing what PR_FONT_LEVEL
means, and for fonts that come from level assets, PR_FONT_LEVEL
is the only way to display them. So without further changes, there can only be one level asset font onscreen at the same time.
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...
Fixed. Also, overriding the fonts of every existing text box is now possible by specifying all
as the second parameter of setfont
or setrtl
.
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