RTL langauages aren't displayed correctly inside reportlab's tables

Viewed 130

I cannot correctly display Arabic text inside a table despite being displayed correctly using drawCentredString!!

Here's an example:

from arabic_reshaper import reshape
from bidi.algorithm import get_display


def arabic(text):
    return get_display(reshape(text))
# This works
_canvas.setFont("NotoNaskhArabic-Regular", 24)
_canvas.drawCentredString(x=A4[0] / 2 - 10, y=760, text=arabic("نص عربي"))
# But this doesn't work
_canvas.setFont("NotoNaskhArabic-Regular", 18)
_head = Table([ [arabic("نص عربي")] ])
_head.wrapOn(_canvas, 0, 0)
_head.drawOn(_canvas, 10, 700)

After rendering

Python Reportlab Arabic bug

1 Answers
Related