[reportlab-users] nbsp and justification problem

Robin Becker robin at reportlab.com
Wed May 5 04:35:16 EDT 2010

On 05/05/2010 08:11, Anton Petrushenkov wrote:

> Some minor improvements to code (encountered unicode issues on some machines

> for previous version):


> So, in paragraphs.py, procedure _justifyDrawParaLineX, after line "nSpaces =

> line.wordCount - 1"

> add this:


> # Taking NBSP into account

> for word in line.words:

> nNBSPs = unicode(word.text, 'utf-8').count(u'\xa0')

> if nNBSPs:

> nSpaces += nNBSPs


> And that's it. Justification works fine.

well not quite, since you'll get small errors in underlining/strikethrough
positions etc etc. I have committed a preliminary hack into trunk, but as I've
said before this whole line-breaking layout stuff really needs shooting and
re-doing from scratch.
Robin Becker

More information about the reportlab-users mailing list