[reportlab-users] Paragraph height wrong when using xml font tags

Roberto Alsina ralsina at netmanagers.com.ar
Tue Jun 23 07:59:59 EDT 2009


On Tuesday 23 June 2009 08:12:43 Henning von Bargen wrote:

> > From: Volker Haas <volker.haas at brainbot.com>

> > Subject: Paragraph height wrong when using xml font tags

> >

> > Hi all.

> >

> > The height of a paragraph flowable is not calculated correctly when

> > using xml font tags to change the font size. This only happens if *all*

> > of the text in the paragraph flowable is inside a font tag which

> > changes the size.

> >

> > i.e.

> > * Paragraph('<font size=30>text</font>', someStyle)

> > has an *incorrect* height

> > adding some "plain" text fixes this:

> > * Paragraph('<font size=30>text</font> X', someStyle)

> > has the correct height

> >

> > Obviously it would make more sense in the first example to change

> > the line height of the paragraph style but this is not feasible

> > for my use case.

> >

> > The effect of the wrong height calculation is that consecutive

> > paragraphs overlap.

> >

> > See the attached minimal example for details. I tested this with the

> > current trunk version of reportlab.

> >

> > It would be great if this could be fixed.

> >

> > Thanks,

> > Volker

>

> -1 from me:

>

> Using different font sizes inside a paragraph is considered

> bad typographic style AFAIK.

>

> If you really have to use different font sizes, then

> you should adjust the leading accordingly to prevent overlapping.

>

> If RL did adjust the height calculation automatically

> it would result in an unsteady layout, because the base lines

> wouldn't be equidistant any more.


But the problem here is with a paragraph with a single font size.

--
("\''/").__..-''"`-. . Roberto Alsina
`9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH)
(_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar
_..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia
(l)-'' ((i).' ((!.' according to alexa.com (27/5/2007)
"Our opponent is an alien starship packed with atomic bombs, I said.
We have a protractor. Okay, I’ll go home and see if I can scrounge up a
ruler and a piece of string." — Neal Stephenson


More information about the reportlab-users mailing list