Closed liorGameDev closed 1 year ago
Had the same problem. Don't use the text style to initiate the RTL, instead use its function, which is text.initRTL().
@javurtez Thank you very much for the response. I added the code to the issue + using the text.initRTL() as you suggested. It seems not to work. Do you have any idea why? did it work for you?
@javurtez Thank you very much for the response. I added the code to the issue + using the text.initRTL() as you suggested. It seems not to work. Do you have any idea why? did it work for you?
Did you also use the text style to initiate the font family and font size? If that's the case, then you should also 'setFontFamily' and 'setFontSize'.
Okay, after rechecking the problem again in iOS15, I think the workaround for this is after setting the textObject.text/textObject.setText to a new text string, or even adjust the fontSize, you need to call 'initRTL' and then 'setWordWrapWidth'.
Also, font size should also be not large.
let textObj = scene.add.text(0, 0, 'این یک آزمایش است.', {
fontFamily: font,
fontSize: size,
color: color,
rtl: true
});
// without calling the functions below, rtl doesn't show
textObj.initRTL();
textObj.setWordWrapWidth(600);
or
let textObj = scene.add.text(0, 0, '', {
fontFamily: font,
fontSize: size,
color: color,
rtl: true
});
textObj.setText('این یک آزمایش است.');
// textObj.text = 'این یک آزمایش است.';
// without calling the functions below, rtl doesn't show
textObj.initRTL();
textObj.setWordWrapWidth(600);
or
let textObj = scene.add.text(0, 0, 'این یک آزمایش است.', {
fontFamily: font,
color: color,
rtl: true
});
textObj.initRTL();
textObj.setWordWrapWidth(600);
// any adjustments of the text will make the text get hidden again unless call the initRTL and setWordWrapWidth
textObj.setFontSize(size);
// without calling the functions below, rtl doesn't show
textObj.initRTL();
textObj.setWordWrapWidth(600);
@photonstorm @liorGameDev
Thank you for submitting this issue. We have fixed this and the fix has been pushed to the master
branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.
Version
Description
When runing my game on ios devices, the text (rtl) is not shown. On desktop and on Android it works fine. On ios it doesn't work on chrome nor safari.
Example Test Code
Additional Information