-
-
Notifications
You must be signed in to change notification settings - Fork 21.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for RTL input and display #982
Comments
the default font does not, but you can set any custom font you like in the https://github.com/okamstudio/godot/wiki/editor_font On Wed, Dec 17, 2014 at 1:53 AM, Suhail Alkowaileet <
|
oh when you change a font, you have to specify it to import unicode, On Wed, Dec 17, 2014 at 1:12 PM, Suhail Alkowaileet <
|
Oh sorry didn't see that.
Also still Thanks reduz. |
this is opengl, so we can't use truetype. Do you know where documentation On Wed, Dec 17, 2014 at 1:40 PM, Suhail Alkowaileet <
|
What about Fribidi? it doesn't need truetype. Its just apply the Bidi-Algorithim. For that you can find it here Unicode Bidirectional Algorithm |
fribidi is LGPL, can't be used on IOS, Android, consoles etc. will probably On Wed, Dec 17, 2014 at 2:01 PM, Suhail Alkowaileet <
|
Hi! |
@Masood-Lapeh Yes, all the languages that written in the Arabic script language system will face same problem. |
by the way, what do you guys use for text input? do you need a special IME popup or the keyboard just inserts the right characters directly? |
@reduz: Arabs have just normal keyboard layouts. The font rendering is a bit special though, as the characters combine into something that looks different. |
what platform are you on? maybe it has something to do with that, for me it On Fri, Jan 2, 2015 at 4:22 PM, Evi1M4chine notifications@github.com
|
@reduz: Might be. This is
I just tested it a bit (trying to enter special characters in a label text field and found at least one character for each mod key combination that worked. It seems to be a case of a limited character set. I could not test advanced layout things though (like Arab or Thai scripts)… Anyway, this is not that important to me. I’m just interested in having GDscript identifiers with Unicode characters in them, and the basic German letters. Everything special can be done by making my own images. :) |
question, what do you do with the NEO keyboard layout with shortcuts such On Fri, Jan 2, 2015 at 7:02 PM, Evi1M4chine notifications@github.com
OkamStudio |
Well, the Ctrl, Alt and Win keys are still available. Maybe the fact that in Germany the Ctrl key is called “Strg” was confusing. So I just press them like normal. [Just that of course I have more other combinations available, as I could set shortcuts to |
@reduz I contacted Behdad programmer of Fribidi for licensing issue on Fribidl , I am waiting for an answer. |
That looks o,k, though I don't really understand how it's supposed to work.
Is there anything else? On Mon, Mar 9, 2015 at 9:05 AM, Mohammad Hadi Aliakbar <
|
1 - in RTL langauges all character go from left to right but digits and LTR characters should go from left to right (it's not like align left) you think we can create from ground up this feature without using any library? if you point me in right direction I think I can make it work at least for Farsi and Arabic. should I change draw function? . |
Ok, but as far as I understand Unicode by default is LTR, so if unicode On Mon, Mar 9, 2015 at 11:07 AM, Mohammad Hadi Aliakbar <
|
every text editor that support RTL has a button to make text RTL or LTR. |
oh so this is external to the text.. you mean that label should have a However, if we were dealing with game translations and we wished to support On Mon, Mar 9, 2015 at 3:51 PM, Mohammad Hadi Aliakbar <
|
This project might be good for understanding Bidi |
it's a little tricky , when I want to use it on web , after translation we should set direction to RTL , here we should have a system that if this language is RTL or not , if it is RTL the Controller should change from LTR to RTL and every object that inherit this should become RTL. in some softwares when you change your layout from LTR to RTL everything change from left to right, It's living in hell to write multi-language software when RTL language is concerned :D I think if labels and text edits can support RTL is fine. @xsoh this code comes from a library called Unicode bidirectional algorithm , and this algorithm is GPL. I don't know much about licensing but @reduz say we can't use it cause in android , ios , consoles you can't use GPL |
Yes you can. :) |
@mohaalak Does the algorithm it self (I don't mean the code. I mean the algorithim) has licensing? What I meant for BidiRenderer is just for understanding not using the code it self. |
I read in fribidI that algorithm has license too. I don't get these
|
I have good news and bad news. Good News :
Bad News :I could not work with harfbuzz , it needs true type support and for that we should use cairo library and font is gonna be change fundamentally. I think @reduz and other main developers should discuss about this change (I could do it but first let's discuss it ) , a post about cairo and bmfonts I used Fribidi ,it's license is LGPL, it means that you can't release it to Android , iOS or anywhere else unless , users can change just Fribidi library ,link it to your code and everything else works again. it can be done.
you can clone my repository and work with it if you want , I don't open a pull request I don't think @reduz wants this changes into main repository. |
by the way we can use BIDI algorithm but I don't know much about licensing , it does not mention anything here about any license but I think I read somewhere in fribidi doc that algorithm is LGPL also. |
above algorithm work for RTL support but we need Ligatures for other languages. I can make something for arabic and persian but I don't know about other languages. |
@mohaalak Gandhi once said "Be the change you want to see in the world". If we don't get help from someone who understands how RTL is used, we simply can't do it. |
Proper Arabic/Indic/etc and RTL support will require a punch of extra dependencies as it is a rather huge amount of work to do from scratch or fork and bundle existing libraries. Are such dependencies something the maintainers are open to? |
@khaledhosny Up to now the general feeling is that the less additional dependencies, the better. We were under the impression that it should be possible to reimplement the BiDi algorithm directly (or via a lightweight library) - but actually the more time passes, the more I think there might be a reason why RTL libraries are so big (especially as Arabic letters need to support mutating based on their context). So if a RTL-aware dev could do some research about what would be a minimal set of dependencies/features needed to support RTL and text shaping properly on all platforms, that would help bringing this issue closer to a fix. |
Minimal dependencies would be FriBiDi for bidirectional support, HarfBuzz for font shaping, FreeType for font rasterization (not a hard requirement) and some code to glue everything together (Raqm can be that glue but it is not absolutely needed). If FriBiDi license is an issue then ICU is another replacement, but otherwise I recommend against just using the sample code from Unicode unless someone has the time an interest in actively maintaining it in this code base. This should give you support for Arabic, Hebrew, lots of Indic and South Asian scripts and more. |
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:
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. |
I have no experience with using SheenBidi and it seems relatively new, but in principle any conforming UBA implementation should be fine. |
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. |
ICU implmentation and Fribidi was pull reqeuested before but denied cause of license and huge library, 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. |
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. |
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): 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). |
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). |
Hopping on this issue, other RTL languages suffer here as well with the same original flipped text problem. |
Maybe these guys can help: https://www.arabeyes.org/Translation_requests |
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. |
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. سلام).
The text was updated successfully, but these errors were encountered: