Language and direction propagation in and between PangoLayouts
Submitted by Behdad Esfahbod
Link to original bug (#345386)
Description
Currently Gtk+ propagates paragraph base direction from neighbouring paragraphs such that paragraphs with no strong direction take the direction of adjacent paragraphs. That works really good.
Same thing should happen with language selection for characters in the Common script. The goal is to fix having something like this:
https://bugzilla.redhat.com/bugzilla/attachment.cgi?id=103679
Now that case cannot be solved completely, but can be improved.
And while doing this, makes sense to do these:
- implement propagation in PangoLayout
- add API to allow propagation to happen automatically (link PangoLayout's together?)
#2 (closed) is needed, as Gtk+ uses one PangoLayout per paragraph. Even if it was not, it definitely makes sense to break a long document into multiple PangoLayouts, so it's not unusual. Anyway, I'm not sure how to approach #2 (closed). What comes to my mind is to add callback functions to context for getting "previous" and "next" layouts of a PangoLayout. We can also add a couple convenience functions that implement those for in-memory text buffers. We don't have any callback API in Pango currently.
With that in place, the direction propagation logic in Gtk+ can be removed and everybody use the Pango API.
Owen, how would you approach this problem?