[reportlab-users] valign with large fonts

Arkadi Colson arkadi at smartbit.be
Wed Jun 4 07:09:44 EDT 2008


Ah ok I see. I use fontsize in the Paragraph style so the "- fontsize" =
"- 0". I will put the fontsize from Paragraph style to Cell style.

Thanks for the info!
Arkadi

Robin Becker wrote:

> Arkadi Colson wrote:

>> So the only option will be detecting the font hight some way and

>> using bottom padding to enlarge the cell?

>>

> .......

>

> Arkadi,

> the code that does the alignment for simple cells looks like this

> just = cellstyle.alignment

> valign = cellstyle.valign

> ........

> vals = string.split(str(cellval), "\n")

> n = len(vals)

> leading = cellstyle.leading

> fontsize = cellstyle.fontsize

> if valign=='BOTTOM':

> y = rowpos + cellstyle.bottomPadding+n*leading-fontsize

> elif valign=='TOP':

> y = rowpos + rowheight - cellstyle.topPadding - fontsize

> elif valign=='MIDDLE':

> #tim roberts pointed out missing fontsize correction 2004-10-04

> y = rowpos + (cellstyle.bottomPadding +

> rowheight-cellstyle.topPadding+n*leading)/2.0 - fontsize

> else:

> raise......

>

> so the valign style attribute should be doing something different. Can

> you send an example piece of text together with the style that's

> supposed to be being used eg font, font size leading etc etc. Then

> I'll try and have a look to see what's going on.

>

>>>>

> ........nt size is variable.

>>>>

>>>>

>>>> Thanks in advance,

>>>> Arkadi

>>>> nfo/reportlab-users

>>>>

>>>

>>> I have a feeling that valign should be middle, but the vertical

>>> alignment has always caused trouble so it might be busted.

>>

>

>



More information about the reportlab-users mailing list