[reportlab-users] Hebrew Support Patch

Hosam Aly haly at centrivision.com
Tue Nov 17 13:19:59 EST 2009


Hello,


I have been reading through Moshe's patch, and I noticed a few things.


First, the code that Moshe suggested for `Canvas.drawString` should
actually be placed at the very beginning of `PDFTextObject._formatText`,
because that's where all string writing methods eventually go (as far as
I understand).


Second, paragraph direction should not be associated with paragraph
alignment. Any paragraph can be aligned left or right, and that does not
change its direction, being LTR or RTL. So we need to have a flag that
tells the paragraph direction, and this flag should be set by the
caller. This is the same as what is done in HTML: you can specify
`dir="RTL"` as an attribute on most tags, and it does not affect text
alignment. So I suggest adding a "direction" property to
`platypus.paragraph`, whose value by default is LTR.


Moreover, there is no need for the code in `platypus.paragraph`. It is
sufficient to use `pyfribidi.log2vis` in `PDFTextObject._formatText`
with automatic detection for most cases, but we should pass the
paragraph direction to the pyfribidi function so as to get correct
output for some corner cases (e.g. when symbols come at the end of the
line).

I am working on supporting RTL functionality right now, and I will
follow up with a patch very soon.


Best regards,

Hosam Aly
Software Engineer
Centrivision (http://www.centrivision.com/)
http://www.linkedin.com/in/hosamaly



More information about the reportlab-users mailing list