Page 1 of 1

Having Trouble Showing Text in Arabic

Posted: Mon Jan 14, 2019 11:11 am
by ARBTECH
Hey! Is there any way to show Arabic text in Love? My code:

Code: Select all

function love.load()
  
  love.graphics.setNewFont("Font.ttf", 36)

end

function love.draw()
  
  love.graphics.print("عَرَبِيّ")

end
Result:
Image

Re: Having Trouble Showing Text in Arabic

Posted: Mon Jan 14, 2019 12:18 pm
by zorg
Apart from you using a file hoster that doesn't support hotlinking and probably infects computers with viruses, i don't see the issue in your image; is your issue related to the text not having the correct writing direction, or to the glyphs not using their correctly connected forms?

Edit: From what i can see from google translate, seems to be both of those issues simultaneously.

Re: Having Trouble Showing Text in Arabic

Posted: Mon Jan 14, 2019 2:44 pm
by pgimeno
LÖVE doesn't support RTL rendering, or Arabic character joining. It uses only FreeType, not something that is Arabic-aware like Harfbuzz.

You could try to implement a library that is able to render Arabic.

Re: Having Trouble Showing Text in Arabic

Posted: Mon Jan 14, 2019 4:13 pm
by ivan
In addition to the letters being reversed, for Arabic I think they are disjointed into individual characters. I believe with Arabic the individual glyphs should be joined.

It's a real nightmare, I had to do a Hebrew translation of Super Chains and was forced to reverse the characters manually. The worst is where bidirectional text is involved! In that case you have to split the string into LTR and RTL (based on the UTF8 code range) and reverse each part individually!!!

While I admit this is a rare issue it would be good if this is addressed in future versions of Love2D.

Re: Having Trouble Showing Text in Arabic

Posted: Mon Jan 14, 2019 4:55 pm
by ARBTECH
zorg wrote: Mon Jan 14, 2019 12:18 pm Apart from you using a file hoster that doesn't support hotlinking and probably infects computers with viruses, i don't see the issue in your image;
:ultraglee:
Edit: From what i can see from google translate, seems to be both of those issues simultaneously.
You are right! Yes, both of those issues simultaneously.

Re: Having Trouble Showing Text in Arabic

Posted: Mon Jan 14, 2019 4:58 pm
by ARBTECH
pgimeno wrote: Mon Jan 14, 2019 2:44 pm LÖVE doesn't support RTL rendering, or Arabic character joining. It uses only FreeType, not something that is Arabic-aware like Harfbuzz.

You could try to implement a library that is able to render Arabic.
Thanks!

Re: Having Trouble Showing Text in Arabic

Posted: Mon Jan 14, 2019 5:00 pm
by ARBTECH
ivan wrote: Mon Jan 14, 2019 4:13 pm In addition to the letters being reversed, for Arabic I think they are disjointed into individual characters. I believe with Arabic the individual glyphs should be joined.

It's a real nightmare, I had to do a Hebrew translation of Super Chains and was forced to reverse the characters manually. The worst is where bidirectional text is involved! In that case you have to split the string into LTR and RTL (based on the UTF8 code range) and reverse each part individually!!!

While I admit this is a rare issue it would be good if this is addressed in future versions of Love2D.
I'm gonna look in to it, Thanks!