Scrollback newlines are queried with the wrong font
When messages are added to the scrollback, they get newlines inserted based on their width. This calculation of width happens with the currently selected font (in hud_add_msg_to_scrollback, in hudmessage.cpp), regardless of which font is used to actually draw the respective message.
Observed by @JadedDragoon with AxMessage, since that script changes around fonts. This results in the training messages, rendered via scrollback apparently, to have incorrect linebreaks.
Just looked into this a bit. A proper fix would require completely rewriting how scrollback is handled, because the split-string needs to happen when the string is displayed, not when it is added to the scrollback. This is doable but not exactly simple.
Just throwing my 2c here. I started looking at scrollback for SCPUI and getting it working is also going to require a bit of a rewrite, I think. So maybe punt this one to the next release and assign to me. I can fix this while I'm in there.
Hats off to you, then. This doesn't look like a fun bug to squash.
@BMagnu can you confirm your findings that training messages are rendered with scrollback? Just want to make sure we're talking about the same thing. It looks like training messages during gameplay are rendered in missiontraining.cpp and not with scrollback. They are added to scrollback, at the same time, though. Is the bug related to training messages referring to the gameplay ones or specifically the version as rendered in the F4 (scrollback) menu?