Hi all,
I am trying to display some Arabic text on the screen. Since Arabic is written from right to left, I set the alignment to right and that works fine in the simulator. When I produce an APK and upload to my Android phone, the alignment is reversed (only for Arabic). English text alignment is fine.
To reproduce the issue, copy the following code into a blank project:
local options ={ text = "Hello World", x = display.contentCenterX , y = 50, width = display.safeActualContentWidth - 20, font = native.systemFont, fontSize = 18, align = "left" -- Alignment parameter } english\_text1 = display.newText(options) english\_text1:setFillColor( 0, 0, 1 ) options.align = "right" options.y = 100 english\_text2 = display.newText(options) english\_text2:setFillColor( 1, 0, 0 ) options.align = "left" options.y = 150 options.text = "أهلا و سهلا" arabic\_text1 = display.newText(options) arabic\_text1:setFillColor( 0, 0, 1 ) options.y = 200 options.align = "right" arabic\_text2 = display.newText(options) arabic\_text2:setFillColor( 1, 0, 0 )
The code displays 2 English texts (one left and one right aligned), and 2 Arabic texts (again one left and one right aligned). On the simulator it works as expected. On my Android device the English is fine but the Arabic is reversed.
Is this an Android or Corona issue?
Is there another setting that I need to set (e.g. text direction)?
I haven’t tested on iOS so I would appreciate anyone with an iPhone to try the code to see if it has the same issue.
Thanks.