[reportlab-users] RTL Support

Muayyad AlSadi alsadi at gmail.com
Sun Apr 4 16:51:24 EDT 2010

> I have done it before on a Arabic scripts only, but I think I could improve it to support the

Unicode standard.

pyfribidi does that.

the problem now with the following issues:
1. setting the main direction to RTL not just align to right
2. align to right by default (it seems we have a problem with this)
3. problem with justified text

you may get patched report lab and pyfribdi2


I test it with this (and text is shaped correctly but it not aligned
to right correctly )

with the following modification

# -*- coding: UTF-8 -*-
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont

styles.add(ParagraphStyle(name='Right', alignment=TA_RIGHT))

ptext="<font size=12>%s</font>" % " ".join([(u"%d. كلام كثير الجمال.
الخط العربي جميل" % i) for i in range(99)])
Story.append(Paragraph(ptext, styles["Right"]))

More information about the reportlab-users mailing list