1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 17:49:43 +01:00

Don't pass newline characters to bidi algorithm

If you copy-paste a newline character where it's not interpreted, such
as in a level title, the print function wouldn't treat it any special.
font::print_wrap() would, but that's not used here.

However, now that bidi is involved, the newline is passed straight to
SheenBidi which interprets it as a new line (which would need a new
SBLine to be created, or maybe even a new SBParagraph if there's two).
All while we're still treating it as a single line. This means the text
would just stop being displayed after the first newline. This is now
fixed by treating all newlines as spaces.
This commit is contained in:
Dav999 2024-01-05 02:48:45 +01:00 committed by Misa Elizabeth Kai
parent c8dbdc890e
commit 96fa932a8a

View file

@ -324,9 +324,16 @@ const char* bidi_transform(const bool rtl, const char* text)
int n_codepoints = 0; int n_codepoints = 0;
const char* text_ptr = text; const char* text_ptr = text;
while ((utf32_in[n_codepoints] = UTF8_next(&text_ptr))) uint32_t codepoint;
while ((codepoint = UTF8_next(&text_ptr)))
{ {
n_codepoints++; if (codepoint == '\r' || codepoint == '\n')
{
// Don't treat newlines in font::print differently in bidi
codepoint = ' ';
}
utf32_in[n_codepoints++] = codepoint;
if (n_codepoints >= 1023) if (n_codepoints >= 1023)
{ {