The vanilla code for AbstractCard.initializeDescriptionCN() (used by zhs, kor and jpn etc) uses a flawed logic which would result card strings with double space to be rendered incorrectly. This is because double space when processed by the Java's String.split(" "), will create another empty string "" between each consecutive occurence of spaces.(For example "I[double space]like[double space]it" will be split into "I","","like","","it") The vanilla function then, uses a flawed logic so that whenever it encounters any empty string "", it will set the width of the current line to be processed to 0, no matter it is a new line or not, resulting in some lines having shorter measured width than how long the real text is.
The existing patch CNCardTextColors.java actually doesn't function at all. It's because this insertor patch is located within an if else branch, where a pervious branch's condition completely covers the patch's condition. So whenever the patch's condition could be met, it will met that one earlier so the patch actually doesn't work at all. I have optimized the logic and repositioned where it happens. It's now inserted before that other branch and will function normally.
In the modified patch above, I added another logic to make colored text ignore punctuation's width, just like what vanilla did, if it's located at the ending of a line.
Previews of these changes:
For 1:
For 2:
(the forth line is aligned with the third because each colored block of text is incorrectly recognised by vanilla code to be energy orbs)
For 3:
(notice in the first image the 2 sentences are exactly the same text, but the second one is forced to be split between 2 lines because the period's width isn't ignored like the normal one, resulted in longer width even though there's enough space for it to be shown in one line.)
This PR solves 3 issues:
For 2: (the forth line is aligned with the third because each colored block of text is incorrectly recognised by vanilla code to be energy orbs)
For 3: (notice in the first image the 2 sentences are exactly the same text, but the second one is forced to be split between 2 lines because the period's width isn't ignored like the normal one, resulted in longer width even though there's enough space for it to be shown in one line.)