using fribidi and Pango
Tomas Frydrych <[email protected]>
| Newsgroups | gmane.emacs.bidi |
|---|---|
| Message-ID | <[email protected]> |
>> Date: Mon, 21 Nov 2005 02:56:37 +0330 >> From: Hossein Noorikhah <address@hidden> >> >> I want to know more about using Pango for text rendering that can >> solve these kind of problems. I read in mailing list achieves that >> Emacs developers have tried Pango for text rendering, but they found >> it not suitable for Emcas. I want to know why? > I once wrote here the reason: Pango, like fribidi, is a batch-mode > reordering library: you hand it a buffer with text and it returns it > reordered for display. This is not really to do with Pango or fribidi, but with the nature of the bidirectional problem. The Unicode bidirectional algorithm requires text of entire paragraph as an input, and you will not get satisfactory results otherwise. > By contrast, Emacs needs a reordering function that could be called > repeatedly, and will on every call return the next character in the > visual order. This is because the Emacs display engine walks the > buffer one character at a time and decides how to display it based on > data structures built by the application. You can do that easily with fribidi; the fribidi_log2vis() function generates a map that allows you to translate logical index into a visual one, and you can use it to walk over your buffer. (AbiWord, which too has complex data structures associated with its text buffer, uses fribidi without any great difficulties.). Pango is a slightly different story; its primary api is not suited to an application that needs to control the layout more precisely; you can use the low level (engine specific) api with bit more work, but as said elsewhere in the original thread, you would probably need to significantly redesign how things are handled internally; again, this might not be simply because of Pango, but because of the nature of the problem that Pango addresses. It really boils down to how much i18n matters, but you will not get decent support for 'exotic' languages unless you do use something like Pango. Tomas ___________________________________________________________ Yahoo! Model Search 2005 - Find the next catwalk superstars - http://uk.news.yahoo.com/hot/model-search/