3akev / godot-arabic-text

MIT License
22 stars 7 forks source link

Multi-lines ALabel gets lines inverted vertically #7

Closed HanouaJ closed 4 years ago

HanouaJ commented 4 years ago

As the title explains, whenever I try an ALabel that is composed of multiple lines these lines order get inverted when rendered, the first line becomes the last and so on.

3akev commented 4 years ago

Fixed!

HanouaJ commented 4 years ago

Doesn't look like it is fixed to me, pulled the latest code and still facing the same issue. A part from pulling the latest code are there any extra steps that I should do ?

3akev commented 4 years ago

Not that I know of. The latest commit is pending approval for the asset library, but the main branch works. See this specific test: link

Are you doing something differently? Can you provide an example input? Maybe I can whip out a new test case.

nightblade9 commented 4 years ago

@HanouaJ can you provide some additional details - maybe a screenshot of your label in Godot or in-game?

HanouaJ commented 4 years ago

After looking at the test case, I get where the problem come from: in your case you are using explicit end of lines (which works in the same fashion when I try it), however what I am trying to do is using a paragraph without explicit line jumps (which seems to me the most common scenario) and with "Autowrap" enabled on the ALabel. Here is a test I did on the master branch, just replaced the "سلام" with the text "تحتل ويكيبيديا العربية المركز الـ15 من حيث أضخم الويكيبيديات حسب عدد المقالات، والمرتبة 10 من ناحية العمق متجاوزةً بذلك نسبة العمق في ويكيبيديا الفرنسية والألمانية والإسبانية وغيرها،[بحاجة لدقة أكثر] وتلقى نسبة 1.2% من حجم زوار ويكيبيديا حول العالم" :

alabel-test1

In-game :

alabel-test2

nightblade9 commented 4 years ago

Hmm, that's interesting. It could be the auto-wrap. The other thing that sticks out, is that your example uses non-Arabic characters (numbers, ., and percentage sign). Right now, mixing Arabic and non-Arabic characters doesn't really work.

HanouaJ commented 4 years ago

I tried only Arabic letters and that didn't change anything, the lines are always inverted. The auto-wrap works perfectly with latin alphabet.

3akev commented 4 years ago

Appears autowrap assumes LTR. Needs to be implemented with bidi in consideration. Unsure if in scope of project.

3akev commented 4 years ago

@kameloov implemented autowrap in #9, it's merged with a test case. Could probably use more, but this is enough for now. Dunno how well it plays with bidi, though.