termux-app icon indicating copy to clipboard operation
termux-app copied to clipboard

[Feature]: add support for right-to-left languages

Open Anonymous2716 opened this issue 2 years ago • 30 comments

Feature description

This works on any input field and in the slide on extra keys too. But not in the actual terminal . the charecters gets individually displayed instead of merged into a word. Don't know if it is possible bcs its a terminal not an usual text input field.

Example : Screenshot_20220824-023344

Additional information

This would help a lot . cant text edit or write this kinda languages in termux terminal.also left to right, right to left directions.

Anonymous2716 avatar Aug 23 '22 20:08 Anonymous2716

A possible font problem?
I can display non-english characters but, I think that you are confusing this with Unicode Combining Characters not displaying correctly?

please post which font your using and type the actual text here and not only a screen-shot

ChiefMikeK avatar Aug 26 '22 16:08 ChiefMikeK

@ChiefMikeK androids default fonts. And yeah maybe you are right Unicode combining characters. BTW I showed an example . the same text is written in the terminal and right above the keyboard . here صباح الخير and I can show you other languages if you need.

Anonymous2716 avatar Aug 26 '22 16:08 Anonymous2716

الخير

صباح


These 2words do not have any combining characters possibly? related to harfbuzz as i've tred diff fonts.

ChiefMikeK avatar Aug 26 '22 17:08 ChiefMikeK

@ChiefMikeK when they are written without space the characters gets combined into الخير but individually they are ا ل خ ي ر .btw this language writes right to left . but in terminal they gets as English left to right.

Anonymous2716 avatar Aug 26 '22 17:08 Anonymous2716

Termux doesn't really support right-to-left languages. More issues related to this one:

  • https://github.com/termux/termux-app/issues/1256
  • https://github.com/termux/termux-app/issues/296

sylirre avatar Aug 26 '22 19:08 sylirre

Screenshot_2022-09-18-19-19-58-895_com termux The true thing will shown: "سلام سلام خداحافظ خداحافظ گوگولی مگولی :)" (Still the smily face is in wrong direction cuz of html roles. But you can see the best result in this picture: Screenshot_2022-09-30-08-26-35-739_com google android apps messaging

mablue avatar Sep 18 '22 14:09 mablue

Should fix with this method: https://bugzilla.xfce.org/show_bug.cgi?id=12576

mablue avatar Sep 18 '22 14:09 mablue

If anyone wants to test bidi support, you can try my branch: https://github.com/MatanZ/termux-app/tree/bidi1

MatanZ avatar Sep 20 '22 12:09 MatanZ

If anyone wants to test bidi support, you can try my branch: https://github.com/MatanZ/termux-app/tree/bidi1

Thanks It's fucking good news.🎉 But We have no compilers Just merge it to mainstream branch and wait to see your updates on f-droid It's not a simple update if you fixed working with RTL languages It will be merged.

mablue avatar Sep 30 '22 04:09 mablue

If anyone wants to test bidi support, you can try my branch: MatanZ/termux-app@bidi1

@MatanZ i tested it, it works, but it made the app so slow and the font is a bit off Screenshot_20221004-182659_Termux

ghost avatar Oct 04 '22 16:10 ghost

@ELWAER-M I can't build right now. Can you share the apk?

Anonymous2716 avatar Oct 04 '22 16:10 Anonymous2716

https://github.com/ELWAER-M/termux-app/actions/runs/3183478955

ghost avatar Oct 04 '22 16:10 ghost

Wow amazing 😍 we need it in iran too for persian typing But why first character bigger than others??🤦🏻😑 Also why my termux have not colorfull like that? Please make termux more stylish too. IMG_20221004_200956

mablue avatar Oct 04 '22 16:10 mablue

@ELWAER-M before you say slow keep in mind that they are all debug builds. Build a release version and then try it.

Anonymous2716 avatar Oct 04 '22 16:10 Anonymous2716

@ELWAER-M before you say slow keep in mind that they are all debug builds. Build a release version and then try it.

they are the same thing lol

ghost avatar Oct 04 '22 16:10 ghost

If anyone wants to test bidi support, you can try my branch: MatanZ/termux-app@bidi1

@MatanZ i tested it, it works, but it made the app so slow and the font is a bit off Screenshot_20221004-182659_Termux

Is the Arabic font you use monospace? If it is not, then termux stretches thin letters, which may explain the weirdness. It is possible to avoid stretching, but then the letters will not connect. The best is to use a monospace font. Please note that even if you use a monospace font, the Arabic letters might come from a different font, and thus not be monospace.

About the slowness - I did not notice this, and my phone is quite slow (MT6753). I also do not see much reason for it since:

  1. The shaping/reordering code is not very slow, and it only needs to run 60 times a second.
  2. It runs only on lines that include Arabic/Hebrew letters, so for most lines there is no change.

Possibly the commit https://github.com/MatanZ/termux-app/commit/51c4ac262b81b1a92e0534bdfe5881764a8a9e1a is the problem, so you can try to revert it and rebuild.

MatanZ avatar Oct 04 '22 17:10 MatanZ

Possibly the commit MatanZ@51c4ac2 is the problem, so you can try to revert it and rebuild.

yes after disabling the logging the issue solved!

Is the Arabic font you use monospace? If it is not, then termux stretches thin letters, which may explain the weirdness. It is possible to avoid stretching, but then the letters will not connect. The best is to use a monospace font. Please note that even if you use a monospace font, the Arabic letters might come from a different font, and thus not be monospace.

even with a monospaced arabic font (https://makkuk.com/kawkab-mono/) it still the same "the first letter is big"

Screenshot_20221004-215256_Termux

ghost avatar Oct 04 '22 19:10 ghost

I do not read Arabic well enough. Please include the same text in text format, so I may work on this. Also a correct rendering in the same font (from a browser, or something like that. If you have the patience to mark the meaningful mis-rendering, it will be even better.

MatanZ avatar Oct 04 '22 21:10 MatanZ

some samples: السلام عليكم صباح الخير شمس قمر سماء أرض ماء نار هواء شروق غروب a monospaced arabic font

If you have the patience to mark the meaningful mis-rendering, it will be even better.

Screenshot_20221005-013110_Termux

most the render problems is oh the letter ا and when ر and و are together رو

ghost avatar Oct 04 '22 23:10 ghost

This is not our problem (not nessesery to solve too) (also not bidi problem) we have problem on orginal termux. And will work on it. Also when the word is not selected it deferent with when its selected(I name it: end character shooting problem 🎉ECSP🎉 ):

mablue avatar Oct 05 '22 03:10 mablue

The font thickness issues may be somehow related to #2539

agnostic-apollo avatar Oct 05 '22 07:10 agnostic-apollo

The font thickness issues may be somehow related to #2539

maybe it is? i tested it on a samsung phone

ghost avatar Oct 05 '22 14:10 ghost

I tried a few fonts from termux styles and GNU FreeFont was the only one found that displayed correctly from right margin and also did not embolden the ARABIC ALEF U+0627

ltr-samples

ChiefMikeK avatar Oct 05 '22 15:10 ChiefMikeK

Please What should I do to get installed bidi? It is not clear what is required in #2953

alprofmahmoud avatar Apr 05 '24 23:04 alprofmahmoud