Arabic or left to right text

I’m having problems with Arab text. A client sent me the following text to test translating to arabic but he says that the text is showing in the other direction:

ولكنهما لم تيكونا وحدهما في استكشاف الزنازين…

(Can`t post arab text on the correct order. It should have the tree dots to the left. Same problem with openfl)

I’m using a swf with an embedded font for the text messages. To load the text I’m using firetongue. I made the same question on their github:

Lime should have the ability to render with arabic, going right-to-left. However, this has not completely made it to OpenFL. You say that Flash displays it backward?

I wonder if there’s a way we can detect the text orientation automatically, or if we’ll have to force the user to set which direction to use

The following is from the “TextRendering” sample of Lime

I’m using a textfield from Flash Professional cs6. In that soft the text is also displayed wrong.

For the game I load the text to the text field using firetongue and openfl.

This is hard to fix or notice because I don’t know Arabic :smiley: I’m not sure when it is displaying it ok. I found this website that helps visualizing the problem:

It will be great if the possibility to select text direction is available in openfl. I don’t think that this can be automated easily because several software have this kind of problem.

The bidi problem of Hebrew and Arabic has always been a pain in flash. Everything I know relates to flash, but I assume it can be applied to openfl, don’t know about other targets, though.
So the straight forward way of dealing with it, is by not embedding fonts for the TextField, this way the text is rendered correctly by the system. But it’s very limiting, of course. You can’t rotate or scale correctly, and there is no antialias.
The other way is using TFL, the “new” text field, witch has a lot of more options, but it’s very heavy and difficult to use.
What I was doing is using a custom made class that switched the characters, using some internal logic to selectively switch only the Hebrew ones.

For flash, these are the options. I guess the on other targets, the text field is rendered, so a global solution should be found.

1 Like

Thanks! It works with the default system fonts. So the problem was with the Arabic font I was trying to embed.

The new text field TFL is no longer in use by flash. CC doesn’t have it and I think openfl doesn’t support it.

I ran into this problem today. Which font did you use? Do you have a minimal example of how you got this working? I tried setting txt.systemFont = “…” with a font I installed, but it renders as left-to-right.

What platforms did your solution work on?

I only tested it on Flash web.

I was loading the font using Flash Cs6 and on the embeded options selected arabic characters.

I think the Flash solution might be TextFormatAlign.START and TextFormatAlign.END, which work with left-to-right and right-to-left languages (or that’s what the documentation says). I don’t know how it detects what language it is, though?