[reportlab-users] Right-to-Left languages
Ury Marshak
reportlab-users@reportlab.com
Tue, 15 Oct 2002 18:16:05 +0200
Aaron Watters wrote:
> It's probably crazy but could we "mirror image the fonts" then
> lay them out left to right and then mirror image the whole paragraph
> just using transforms? What am I missing?
Unfortunately it's not that easy - the geometrical transforms don't cut
it. The problem is that not _all_ characters shall be reversed; when
we have "ReportLab" embedded in a Hebrew text we don't want it to
come out as "baLtropeR". If we have something like
"firstHebrewWord secondHebrewWord 500 thirdHebrewWord" in memory
we need it to come out as
"thirdHebrewWord 500 secondHebrewWord firstHebrewWord", but if the
second word is in English we want a different output:
"thirdHebrewWord BMW 500 firstHebrewWord" . Now if this comes in
a paragraph that has a basic Left-to-Right orientation; for example
it is a quotation in the middle of otherwise English text; then
the rules are changed again..
Also there are issues with mirrored characters - '[' becomes ']'
when it surrounds a right-to-left word, and it gets worse when
such a character falls on the border between languages ...
There's a lot of hairy stuff there, for gory details see
http://www.unicode.org/unicode/reports/tr9/ . The good part is that
there already are [free] implementations of this hairy stuff, and
that the higher level layout code - wrapping paragraphs etc - works
with the logical representation, i.e. as it is in memory, and can
ignore the bidirectinal stuff (mostly; good enough for initial
implementation)
Ury