I want to use Persian/Arabic text beside English in whether Label
or ui::Text
.
Persian is a Right-to-Left and English is a Left-to-Right language and so I have problem to combine them in one string.
Scnario:
I want to show this text: 1."من1"
then 2."emadpres2"
and finally 3."3هستم"
.
If I write this text in a Left-to-Right editor it show as : ( Wrong Direction: =====> )
1من emadpres2 هستم3
But actually it should be shown as : ( Correct Direction: <===== )
هستم3 emadpres2 من1
This is my code :
auto rtl = Label::createWithSystemFont("سلام emadpres چطوری", B_NAZANIN, 25, Size(480, 100));
// The string here is also in wrong direction because the Visual Studio editor is Left-to-Right.
rtl->setColor(Color3B(0, 0, 0));
rtl->setPosition(...);
rtl->setHorizontalAlignment(TextHAlignment::RIGHT);
this->addChild(rtl, Z_NORMAL);
and this is the screenshot of this code:
As you see, I tried to use TextHAlignment
but It doesn't help. I need something to change Direction not Alignment .
How should I make it Right-to-Left ?
PS: Cocos2dx v3.3