[reportlab-users] Experimenting with new paragraphs
Dinu Gherman
gherman at darwin.in-berlin.de
Sat Dec 15 06:35:44 EST 2007
Hi,
this is just a status report on my paragraph experiments. After some
debugging help from Robin I'm making good progress with a family of
paragraph classes that implement specific features, like hyphenation,
embedding images, word markers etc.
Here are two samples to enjoy:
1. http://python.net/~gherman/tmp/Macaulay-IconizedParagraph.pdf
2. http://python.net/~gherman/tmp/Macaulay-ColouredParagraph.pdf
The icons in (1) are put after each word containing four different
vowls and the coloured word backgrounds are randomly chosen in (2),
but could be easily restricted to a specific set of words to be high-
lighted.
I'm attaching the code for the coloured paragraph subclass to illu-
strate how simple this can be. With additional methods it could be
even simpler, but this is just the beginning. Maybe I'm mistaken,
but to me it seems like it would be an infinite amount of work to
tweak the standard RL paragraph class to do the same.
The performance depends very much on what additional features are
used. Code that simply tries to reproduce the ReportLab paragraph's
default behaviour is around 2-2.5 times slower for normal sized
text, but can also be faster if the number of line breaks grows
significantly.
I think this could also be used as a basis for some kind of pseudo
RTL (right-to-left or bidirectional) paragraph implementations, if
not even a serious one, who knows... Unfortunately, I don't read
RTL and the Unicode page on this topic seems slightly intimidating:
http://www.unicode.org/reports/tr9/
And, of course, there is some more work to be done on tag support,
which I have delayed for a while, and especially custom tags. It
would be fun e.g. to add PDF annotations described by custom tags.
The code is still changing very much, but I hope to continue my ex-
perimenting with it so I could release something early next year.
Regards,
Dinu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: iconizedparagraph0.py
Type: text/x-python-script
Size: 3108 bytes
Desc: not available
Url : <http://two.pairlist.net/pipermail/reportlab-users/attachments/20071215/adeed885/attachment.bin>
-------------- next part --------------
More information about the reportlab-users
mailing list