[reportlab-users] RTL Patch Committed

Hosam Aly haly at centrivision.com
Mon Nov 23 05:38:14 EST 2009


On Mon, 2009-11-23 at 10:06 +0000, Andy Robinson wrote:

> 2009/11/23 Andy Robinson <andy at reportlab.com>:

> > 8. think about the other contexts where we output text. This works

> > within paragraphs; but what happens if one simply used drawString

> > (e.g. to draw a chapter title at the top of a page), or has a legend

> > in a chart? I'll come back to this in another message.

>

>

> If someone does this...

> canvas.drawString(x, y, 'some text with RTL and maybe LTR')

>

> or even

> textObject.textout('some RTL text')

>

> ...should we magically intercept it and reverse when pyfribidi2 is

> available? Or should we leave it to the programmer?

>

> I haven't done any benchmarking but I would imagine that once you are

> dealing with Unicode text, passing it through the C-based log2vis

> function will be pretty quick and will return LTR text unchanged.

> We'll do some experiments this week to see if there is a measurable

> performance hit. Can anyone see any downside to doing this

> automatically?

>

> - Andy


I think it's fine to intercept all calls, especially since I set the
direction parameter to 'LTR' by default. I don't expect it to have a
large overhead, but I am waiting to see your measurements.

It also seems like a good idea to add an optional direction parameter to
`textObject.textOut` and `canvas.drawString`, having a similar default
value (or None?), so that users of these functions can still request RTL
rendering.


Best regards,

Hosam Aly
Software Engineer
Centrivision



More information about the reportlab-users mailing list