Right to left text alignment

Well, I am trying to make my app multi-user language problem is, some languages such as Arabic have to be written from right to left, the align parameter for text when is set to “right” it just changes the position of text and not how it is written,

so how to make the text appear from right to left ?

Hi @andrew_wahid,

For this, you’ll probably need to use a bitmap font generator tool. There are various available, including these which I just quickly searched for (you may want to look for others as well):

https://github.com/autismuk/Font-Manager

https://71squared.com/glyphdesigner (Mac)

https://71squared.com/gdx (Windows)

Brent

These will work like APIs, or do I have to edit all the texts inside the files again ? :confused:

Hi @Nerox,

I cannot go into details about how these products function exactly. Perhaps a community member who has used them can answer your specific questions, or you can contact the author(s) of these products directly.

Best regards,

Brent

I’ve tried this one https://github.com/autismuk/Font-Manager but sadly it doesn’t work…

Making an bitmap arabic font and changing the encoding to both utf8 and utf-8 doesn’t work…

Thanks for searching for those tools, but they don’t help with what am trying to do…

I’ve came with an idea but still don’t know if it would work or not and there is a problem…

The idea is to make the text in HTML and make the alignment RTL(right-to-left) then inserting the HTML Text in the scrollView…

The problem is that the HTML text doesn’t automatically wrap into a new line when the width of a line is full of text…

so any idea on how to fix that ?

Hi @Nerox,

That’s a good idea to use a local HTML file and a web view. But, it won’t wrap automatically to the size… you’d need to insert line breaks into the actual HTML at the places you want the lines to wrap, based on the font size and your display on the mobile device.

Take care,

Brent

is there a way to calculate with the screen width and text length where the line ends and then split it into some parts and create a text for each part so they work like auto-wrapping ?

Hi @Nerox,

In this last instance, do you still mean using an HTML web view? Or do you want to create the text by Corona display objects?

Brent

using an HTML web view :slight_smile:

Hi @Nerox,

I suppose you could actually “edit” the HTML file within your code and insert line breaks, then display it via a web view. This would require knowledge of working with strings and files. Perhaps this will help:

https://docs.coronalabs.com/guide/data/readWriteFiles/index.html

Brent

Problem is its more than 500-600 files, so editing one by one won’t happen…

Also they are normal strings but converted to html text, using mltext (a plugin for coronasdk)

more detail about RTL problem in this topic,

The RTL problem must be solved.

Hi @andrew_wahid,

For this, you’ll probably need to use a bitmap font generator tool. There are various available, including these which I just quickly searched for (you may want to look for others as well):

https://github.com/autismuk/Font-Manager

https://71squared.com/glyphdesigner (Mac)

https://71squared.com/gdx (Windows)

Brent

These will work like APIs, or do I have to edit all the texts inside the files again ? :confused:

Hi @Nerox,

I cannot go into details about how these products function exactly. Perhaps a community member who has used them can answer your specific questions, or you can contact the author(s) of these products directly.

Best regards,

Brent

I’ve tried this one https://github.com/autismuk/Font-Manager but sadly it doesn’t work…

Making an bitmap arabic font and changing the encoding to both utf8 and utf-8 doesn’t work…

Thanks for searching for those tools, but they don’t help with what am trying to do…

I’ve came with an idea but still don’t know if it would work or not and there is a problem…

The idea is to make the text in HTML and make the alignment RTL(right-to-left) then inserting the HTML Text in the scrollView…

The problem is that the HTML text doesn’t automatically wrap into a new line when the width of a line is full of text…

so any idea on how to fix that ?

Hi @Nerox,

That’s a good idea to use a local HTML file and a web view. But, it won’t wrap automatically to the size… you’d need to insert line breaks into the actual HTML at the places you want the lines to wrap, based on the font size and your display on the mobile device.

Take care,

Brent

is there a way to calculate with the screen width and text length where the line ends and then split it into some parts and create a text for each part so they work like auto-wrapping ?

Hi @Nerox,

In this last instance, do you still mean using an HTML web view? Or do you want to create the text by Corona display objects?

Brent

using an HTML web view :slight_smile: