Text becoming rightbound for some reason when using certain characters?

I'm currently making a game in which characters occasionally text each other. As such, I wanted to make it so that occasionally, one of the characters uses kaomoji. I have had this idea since I was working with RPG Maker MV, where text displayed just fine and as intended, but now I've run into a strange issue.

1743177159359.png

Almost all kaomoji i use cause the text to irreversible be written from the right side in this incredibly strange fashion? It also moves the character's portraits over to the right for seemingly no reason? I've tried various ways to try and get it to look normal while kaomoji are used, but for some reason, it just won't work. What can I do about this?
MZ has built-in support for right-to-left display of text. By default the check is for Arabic characters:
Spoiler: core snippets
JavaScript:
Utils.containsArabic = function(str) {
    const regExp = /[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF]/;
    return regExp.test(str);
};

Game_Message.prototype.isRTL = function() {
    return Utils.containsArabic(this.allText());
};

Window_Base.prototype.createTextState = function(text, x, y, width) {
    const rtl = Utils.containsArabic(text);
// ...
}
So I guess your text includes Arabic characters, maybe the hands?

If you don't care about supporting RTL text then a plugin like this might help (untested):
JavaScript:
/*:
 * @target MZ
 * @plugindesc Disable core support for right-to-left text.
 * @author Caethyril
 * @url https://forums.rpgmakerweb.com/threads/176594/
 * @help Free to use and/or modify for any project, no credit required.
 */
Utils.containsArabic = function() { return false; };

Alternatively you could look for similar characters, e.g. via a site like https://shapecatcher.com/.
MZ has built-in support for right-to-left display of text. By default the check is for Arabic characters:
Spoiler: core snippets
JavaScript:
Utils.containsArabic = function(str) {
    const regExp = /[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF]/;
    return regExp.test(str);
};

Game_Message.prototype.isRTL = function() {
    return Utils.containsArabic(this.allText());
};

Window_Base.prototype.createTextState = function(text, x, y, width) {
    const rtl = Utils.containsArabic(text);
// ...
}
So I guess your text includes Arabic characters, maybe the hands?

If you don't care about supporting RTL text then a plugin like this might help (untested):
JavaScript:
/*:
 * @target MZ
 * @plugindesc Disable core support for right-to-left text.
 * @author Caethyril
 * @url https://forums.rpgmakerweb.com/threads/176594/
 * @help Free to use and/or modify for any project, no credit required.
 */
Utils.containsArabic = function() { return false; };

Alternatively you could look for similar characters, e.g. via a site like https://shapecatcher.com/.
1743181572879.png


Thank you very much, I can confirm that it now actually displays the right way ingame. Annoyingly, the generator preview still shows it as rightbound, but I suppose not much can be done about that.

Original thread: https://forums.rpgmakerweb.com/threads/text-becoming-rightbound-for-some-reason-when-using-certain-characters.176594/