Reputation: 3461
I have been working with Tcl/Tk for a week now and I understood from the documentation that it is supposed to prvoide platform independence, in that, a Tcl/Tk widget will behave the same on Linux and on Windows.
Strangely, I had a different experience. If I type some text in Hebrew or Arabic (complex scripts, in general, I assume) in a Tcl/Tk widget, running once in windows and once in Linux, I get different results.
On Ubuntu the glyphs are NOT joined together in the widget. On Windows they are, but sometimes not properly.
Tcl/Tk does have an inherent internationalization support since v.8.1 as per their documentation.
Has someone had some experience in this area? I mean, does Tcl/Tk really have internationalization support and platform independence?
Upvotes: 2
Views: 252
Reputation: 137627
Tcl's had internationalization support since Tcl 8.1, though there are a few current issues still (notably with characters outside the Unicode BMP, some string operations that need to be made locale-aware, and the lack of normalization engine; none of these apply in this situation). Tk's not in quite such a good state.
Tk delegates display of a string of characters to a font rendering engine, which is platform-specific (and on Unix/X11, build specific too). It is the font rendering engine which is responsible for turning the sequence of characters into a collection of glyphs (it has to be, since different fonts produce different glyphs) which are then drawn on the screen to produce the rendering of the text. In some writing systems (especially the European and East Asian ones) this is mostly relatively straight forward, but in others it is quite difficult due to the very large number of ligatures used; Arabic is one of the most difficult cases here!
The classic font rendering engine used in old X11 builds doesn't cope with rendering complex font systems like Arabic at all. This is unlikely to change. The newer X11 font rendering engine builds on top of Xft (and in fact delegates almost all the work to that library) and so might do a better job. On Windows and OSX/Aqua, the font rendering engines use the system libraries, whatever quality they are. (The OSX one looks pretty good to me, but I don't claim to know for sure.) If someone were to contribute a font rendering engine for Unix based on Pango, it would be looked at very favourably; it's probably a lot of work though.
It's also possible that things look worse in an editable widget (entry
, text
), as those may well feed characters through one at a time. Non-editable widgets (label
, button
, etc.) ought to look better as they can at least pass more than one character at a time without worrying about retaining information about where cursors should go. I also suspect that Tk's got some fairly hard-coded assumptions in places relating to text going left-to-right; I've got no idea what to do about them.
Upvotes: 2