[reportlab-users] Right-to-Left languages

Andy Robinson reportlab-users@reportlab.com
Wed, 16 Oct 2002 01:21:59 +0100

> Generally you'd want to say "this document is RTL" and occasionally
> "but this specific table/paragraph is LTR", the PageTemplates and
> Frames are just the vehicles to pass this info from the document
> down to the paragraphs.

To my way of thinking the template classes are not 'the document'.
They are, literally, templates used to display the document. The
story itself - the list of paragraphs and tables - is closest to
your sense of 'document'.  Our only model for it now is a
"list of paragraphs".

Example:  we have built a large 'conditional text engine' to do
personalized fund prospectuses for a large customer.  This generates
a sequence of paragraphs which depend on the type of customer (broker or
retail) and what they are investing in.

A separate layer decides if this is to appear in two-column, 7 point
text in a color template; single column in another format; branded
to meet the styles of one of their business partners; in HTML for
the web; or even as a text export into Quark Xpress for professional

Now it's totally plausible to me that they might have customers in Israel
or the Arab world soon.  In this case the information that "this is RTL,
except for these paragraphs and tables in the middle" lives with the story;
the choice of template is made later and relatively disconnected.

We model the "document content" as a simple list at the moment.
Lists don't have attributes.  But there is still a moment in time
when you have constructed this and not yet passed it to a Doctemplate.

How about calling a function
     setTextDirection(story, 'RTL')
which just walked through all paragraphs, nested tables etc. setting it
on the objects to which it applied?

I AM off to bed no, honest.  Don't start reworking any patches, let's
look at what's there first and continue this tomorrow.