urwid / urwid

Console user interface library for Python (official repo)
urwid.org
GNU Lesser General Public License v2.1
2.82k stars 315 forks source link

Bidirectional text support #44

Open wardi opened 10 years ago

wardi commented 10 years ago

trac ticket https://excess.org/urwid/ticket/14

When someone tries using Urwid with Arabic or Hebrew text it is displayed in the wrong order.

Automatic switching of text order and handling or UTF-8 order-declaring codes would be a very nice thing to have. The structures used by StandardTextLayout should support the addition of this feature, but some changes will likely be necessary for efficient BiDi handling.

yarons commented 3 years ago

Now that Urwid is used in Subiquity (The Ubuntu Server Installer) it's becoming increasingly more important, how can I help?

yarons commented 3 years ago

This is an example of a patch to support BiDi in Ubuntu's gfxboot-theme: https://code.launchpad.net/~shlomister/gfxboot-theme-ubuntu/hebrew-fix

It's a perl script that replaces each and every string with the reversed (RTLed) version of it.

FriBiDi is highly sensitive to Unicode directional guidance thus not reversing LTR (English) strings, which allows enabling it by default without consequences (when configured correctly).

It will still require reversing the menus and the widgets on screen but at least the text is covered.

BTW. How can I help testing your proposed RTL implementation? https://gist.github.com/wardi/4113436

You may want to look at libfribidi for reversing the text, you don't have to implement it yourself.