Open zelhar opened 7 years ago
Termux already sets android:supportsRtl="false"
in the AndroidManifest.xml, I'm not sure how to disable bidi functionality when using the GNU FreeFont (if possible).
Would really appreciate help from anyone more knowledgeable with bidirectional text on Android here.
perhaps it needs to be included in the manifest of termux-styling as well? namely in that file: https://github.com/termux/termux-styling/blob/master/app/src/main/AndroidManifest.xml
I don't believe that this is a bug. This is a must-have feature for showing correctly texts in persian or arabic. If one wants to cat a file in persian or edit it in nano, it is absolutely necessary. Please do not disable this feature. For someone like me it is vital.
does anyone know or can refer me to a source that show how does the font system in termux work?
From the tests I've made it seems that the reason why Termux behaves differently with different fonts depends on whether or not the font contains the right-to-left charset. Because Gnu FreeFont contains Hebrew, Arabic, Hindi and so forth right to left charsets, Termux displays them right to left, but when the cursor is on a line with such scripts it gets completely messed up.
When I use a font without Hebrew glyphs, Termux displays everything left-to-right. The Hebrew letters to my understanding, are displayed from whatever supplamental font is defined by the OS, which I think is NotoSansHeb or something, and it looks terrible on the screen. However in programs with built-in bidi support, namely emacs, the bidi support works (except for the font looking terrible) when the fonts with the missing hebrew script is used. when Liberation mono or freefont is used, the text still gets all messed up in emacs.
@fornwall I think that I have an idea of what might be going on in the code. in "TerminalRenderer.java" there is an object "mTextPaint" which to my understanding reders the text on the screen. I think that the method "setTextDirection" should be set to 'anyRtl' (=2):
mTextPaint.setTextDirection(2)
or to disable rtl completely in case this doesn't work set the value to 'ltr'.
for reference: https://developer.android.com/reference/android/view/View.html#attr_android:textDirection https://developer.android.com/reference/android/view/View.html#setTextDirection(int)
@zelhar Hm, mTextPaint
is an instance of the android.graphics.Paint class, so doesn't have a setTextDirection
method.
In termux the bidi functionality seems to depend on which font is chosen from the termux style. for example when selecting gnu free font Hebrew is displayed right-to-left (although with bugs when typing or editing it), while when chosing default font or inconsolata font bidi is disabled and the text is displayed ltr.
The bidi support in any terminal is not perfect and sometime it is desirable to simply disable it. some of the linux consoles like Konsol and gnome terminal allow the user to choose whether to enable or disable bidi support, is that possible to be done in termux as well?
I think it would be useful to be able to completely disable bidi in termux because that thing never behaves in a predictable way and especially when editing and inserting text I find it easier to just work ltr.