[reportlab-users] nbsp and justification problem
robin at reportlab.com
Thu Apr 29 06:19:53 EDT 2010
On 29/04/2010 09:52, Anton Petrushenkov wrote:
> Robin, thanks for such a fast answer.
> Actually, I realize what  is ;)
> I've dug some sources, and now suppose, that problem is (in my opinion) in
> algorithm that counts "extraspace" parameter (in xpreformatted.py).
> I mean it doesn't know width of this very symbol and that is why returns
> faulty number.
I think the issue here is that we may or may not be doing the right thing a) wrt
counting spaces and b) ensuring that PDF does the right thing.
In the text
aaaaa bbbbb ccccc ddddd
we normally count three spaces; if we're justifying then what happens is that we
take the total observed length of the line w0 and work out how much extra space
has to be added to make the line reach its target wt; that is wt - w0, to make
use of PDF we issue an extra command which adjusts all the spaces in the line by
the required amount ie we set wxs = (wt-w0)/ns where ns is the number of spaces
ie 3 in the above case.
Unfortunately I believe that we may make mistakes in the rendering of the above
simple idea when hard spaces are used. I don't think PDF has a separate hard
space character so our count would be low adding extra space to an extra space
would make the line jut out on the right (for normal left-right text). If that
is the problem we'll need to think how to organize the count better; the code is
already fairly painful and it uses string splitting for speed and to make the
space counting easier :(
> I'm continuing to dig deeper now, but if I'm completely wrong on this one
> please tell me.
> Is there any way to perform a search on this mail-list's archives? Googling
> on "reportlab intra-word breaking" doesn't help :(
Unfortunately the users list is simple mailman and I don't think that supports
However, I googled for reportlab bargen +paragraph and this appeared
I know that Henning v Bargen is interested in this area. If you go to
you'll see quite an active project.
More information about the reportlab-users