godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.64k stars 21.11k forks source link

Support for RTL input and display #982

Closed xsoh closed 4 years ago

xsoh commented 9 years ago

The editor doesn't recognize the non-latin characters (it writes nothing) even with changing the font of the editor. Also trying to paste a word of non-latin will print the Unicode representation (e.g. \u2320\u3433...etc) not the real word (e.g. سلام).

akien-mga commented 7 years ago

FriBiDi is licensed under the LGPL, which is (AFAIU) a bit tricky when you link it statically as we do in Godot for our thirdparty libraries. I think it may be fine, but we'd have to double check with a lawyer:

A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License.

The problem of ICU is that it's huge and provides a lot more than just the BiDi algorithm, so it would bloat the engine unnecessarily.

An alternative could be the Apache-licensed SheenBidi.

For FreeType, it's included already. HarfBuzz could be added, it seems to be the go-to solution for font shaping.

khaledhosny commented 7 years ago

I have no experience with using SheenBidi and it seems relatively new, but in principle any conforming UBA implementation should be fine.

khaledhosny commented 7 years ago

I looked into the text layout code briefly and I’m afraid it is not an easy task since the code seem to be written with the assumption that text is laid sequentially from left to right, which is obviously not the case for most complex scripts. Fixing that will require quite some refactoring and deeper understanding of the code.

mohaalak commented 7 years ago

ICU implmentation and Fribidi was pull reqeuested before but denied cause of license and huge library, I don't know if it's possible to add ICU as extensioin using GDNative or not? I didnot read GDNative docs yet

I used fribidi and ICU implementation and even released games in Iran, maybe after version 3 release I fork and add ICU to it so every major version have a RTL Support.

akien-mga commented 6 years ago

Just mentioning that this is still a wanted feature, but it's a complex one to implement properly (especially font shaping). Current WIP in #10546 with discussion on how it should be done with the minimal impact for languages which can print chars one by one as done currently.

nightblade9 commented 6 years ago

I am also interested in this. Just tried a custom font with Arabic letter support and it shows up broken and left-to-right. (I didn't read this entire thread, just the top few and bottom few posts.)

If anyone's interested, this is how it looks in Godot 3.0.4 (letters are left-to-right and broken):

image

This is how it should appear:

القرآن الكريم

I can definitely help with testing, but probably not much help with implementation. I've heard HarfBuzz is a very good solution (used in HaxeFlixel/OpenFL).

nightblade9 commented 6 years ago

I just realized that the ICU-support WIP sample here sort of works. Is there any possibility of merging it in and swapping it out later?

If we wait for proper support of this feature, we may end up waiting a long time; this WIP would at least get us something we can use for now (even if it's not well-supported or ideal).

g--o commented 5 years ago

Hopping on this issue, other RTL languages suffer here as well with the same original flipped text problem. So there's localization to the editor but it's just useless when the entire thing is flipped!

golddotasksquestions commented 4 years ago

Maybe these guys can help: https://www.arabeyes.org/Translation_requests Also this technical dictionary might be of use: https://www.arabeyes.org/techdict/techdict.pdf

akien-mga commented 4 years ago

As we're moving all feature requests to the new godot-proposals repository, I'll close this as superseded by godotengine/godot-proposals#4.

Note that fixing these issues is one of our priorities for Godot 4.0, as we can take the opportunity of a compatibility breakage to properly rethink our text layout controls to accommodate the requirements of RTL display and font shaping.