Here's a quick example of a text layout class that displays all text in a right-to-left manner. It almost,sort-of works with the Edit widget too:
https://gist.github.com/4113436 On Sat, Nov 17, 2012 at 9:58 AM, Ian Ward <[email protected]> wrote: > Hello Alejandro, and thank you for Turses! > > On Sat, Nov 17, 2012 at 7:19 AM, Alejandro Gómez <[email protected]> > wrote: >> Hello everybody, >> >> I'm using urwid for building an application and recently a user >> submitted a bug regarding the incorrect display of arabic characters[1]. > > Unfortunately some of the links in the bug report are broken. I'd > love to see real world examples of text to be displayed and how it > should look on the terminal. > >> Another user pointed out a 6 year old issue[2] for implementing >> support for bidirectional text. Its priority is set to "minor" so I >> guess it won't be addressed in the near future. > > It's been on the back-burner because I don't know any RTL languages or > how they should look when mixed in with LTR text, and in Arabic in > particular how to handle ligatures with neighbouring characters. I've > switched the priority back to 'major', as it should be. > >> I would like to ask if someone has any clues about how to include this >> in urwid. I wouldn't mind to spend some time on it myself but I'm >> clueless on how to even get started. > > I would love to get this issue fixed. I see it as a number of related > changes: > > 1. BiDi support in Unicode text displayed with Text widgets > 2. alignment swapping for RTL text in Text widgets (text should be > right-aligned by default) > 3. reordering columns globally when an application is started in a RTL > locale (the first column should be on the right) > > For Turses you might only need #1. > > The best way I see to handle #1 is with a BiDi-aware text layout class > > http://excess.org/urwid/docs/manual/textlayout.html > > StandardTextLayout does left/center/right alignment and space/any/clip > wrapping but doesn't reorder RTL characters. A new BiDiTextLayout > could reorder characters based on their Unicode direction. The data > structure that text layout objects would have to return will be > unwieldy if the whole string is RTL, however. Maybe now is the time > to extend that structure to support ranges of RTL text. > > Please join the IRC channel if you need help working with that code. > > Ian > >> [1]: https://github.com/alejandrogomez/turses/issues/120 >> [2]: http://excess.org/urwid/ticket/14 _______________________________________________ Urwid mailing list [email protected] http://lists.excess.org/mailman/listinfo/urwid
