[reportlab-users] Right to Left support

Andy Robinson andy at reportlab.com
Mon May 1 17:58:45 EDT 2006

soosho wrote:
> Hi
> hope u r all fine.
> as I understood, ReportLab does not support Persian(farsi)
> Language(center asian language).
> the language is right-to-left
> I wanna know,
>   1. what should I do to add persian support to ReportLab?
>   2. is it passible in resonable time?

You would need to produce a new paragraph class, or paragraph
wrapping algorithm, which could render right-to-left.  We will do our 
best to help you and anyone else working on this as there are frequent 
demands for middle eastern languages.

Ury Marshak produced some working code several years ago for Hebrew 
which is here:

However we never managed to merge this with other concerns and 
developments in our code, and our own paragraphs have evolved since then.

If you want to roll your sleeves up and try, we welcome help!
I urge you to look at the code on the trunk of our repository, which is 
about to get labelled 'ReportLab 2.0' "any day now" - we're just arguing 
over the documentation and what promises we make about Unicode ;-)

The code is now utf8 throughout so it's trivial to convert to Unicode 
for wrapping, and has a basic Asian text wrapping algorithm; the code 
base is in use for a pretty huge multilingual
project now with Japanese and 5 European languages.  The latter is no 
use for RTL, but it does show you how to make the wrapping 'pluggable'; 
we have a ParagraohStyle property 'wordWrap' which can be set to 'CJK' 
(Chinese-Japanese-Korean) to invoke their word wrapping, and one could 
also imagine a value of 'RTL' to invoke an alternative right-to-left 
wrapping algorithm.

We do not yet have a generic all-languages-of-the-world-in-one-paragraph 
Unicode wrapping algorithm.  That's a bigger project and I would only 
want to tackle it if some people could do RTL in isolation first.

Best Regards,

Andy Robinson
ReportLab Europe Ltd.

More information about the reportlab-users mailing list