basic bidi support using perl

James Cloos cloos+rxvt-unicode at
Tue Aug 22 06:41:14 CEST 2006

>>>>> "Moshe" == Moshe Kamensky <samvimes at> wrote:
>>>>> "Marc"  == Marc Lehmann   <schmorp at> wrote:

Moshe> I added basic bidi support, using the perl interface and the
Moshe> perl FriBidi module:

Marc> Wow, what a wonderful hack! And so small!

Indeed!  Way cool.

Marc> I think (from my limited knowledge) that the only "correct" way
Marc> to implement this is to store text in transmission order and
Marc> only apply bidi when displaying it, which is not trivial.

That is correct.

Marc> I do plan to implement this by relying on pango at one point,
Marc> though, merely storing a flag per line wether it is "complex"
Marc> (== needs a complex layouter like pango) or "simple" (== can
Marc> use urxvts algorithms).

The FriBidi perl module links against libfribi (cf:;
you can call it directly from the C++ as well.  (It is C++ friendly.)

Pango uses it for the bidi stuff, too, so it is a good stepping stone
to full shaping capability.

Although, I do wonder how much shaping a terminal requires?  Is there
a way to help out simpler apps while not getting in the way of apps
which already know how to do shaping?

Marc> That way, I could move the complexity into pango (which is
Marc> likely better maintained than I could do it) while maintaining
Marc> normal speed.

Good call.

And kudos again to Moshe.  Cool script!

James Cloos <cloos at>

More information about the rxvt-unicode mailing list