Having Trouble Showing Text in Arabic

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
ARBTECH
Prole
Posts: 6
Joined: Mon Jan 14, 2019 9:25 am

Having Trouble Showing Text in Arabic

Post by ARBTECH » Mon Jan 14, 2019 11:11 am

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

User avatar
zorg
Party member
Posts: 2653
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Having Trouble Showing Text in Arabic

Post by zorg » 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; 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.
Attachments
Capture.png
Capture.png (8.45 KiB) Viewed 1770 times
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.

User avatar
pgimeno
Party member
Posts: 1736
Joined: Sun Oct 18, 2015 2:58 pm

Re: Having Trouble Showing Text in Arabic

Post by pgimeno » 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.

User avatar
ivan
Party member
Posts: 1468
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Having Trouble Showing Text in Arabic

Post by ivan » 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.

ARBTECH
Prole
Posts: 6
Joined: Mon Jan 14, 2019 9:25 am

Re: Having Trouble Showing Text in Arabic

Post by ARBTECH » Mon Jan 14, 2019 4:55 pm

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.

ARBTECH
Prole
Posts: 6
Joined: Mon Jan 14, 2019 9:25 am

Re: Having Trouble Showing Text in Arabic

Post by ARBTECH » Mon Jan 14, 2019 4:58 pm

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!

ARBTECH
Prole
Posts: 6
Joined: Mon Jan 14, 2019 9:25 am

Re: Having Trouble Showing Text in Arabic

Post by ARBTECH » Mon Jan 14, 2019 5:00 pm

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!

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests