[reportlab-users] valign with large fonts
Arkadi Colson
arkadi at smartbit.be
Wed Dec 22 04:15:03 EST 2010
Is there a way to let the alignment (MIDDLE) take the paragraph fontsize
into account instead of the cellstyle fontsize?
Thanks!
On 06/04/2008 01:09 PM, Arkadi Colson wrote:
> 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.
>>>
>>
>>
> _______________________________________________
> reportlab-users mailing list
> reportlab-users at reportlab.com
> http://two.pairlist.net/mailman/listinfo/reportlab-users
--
Smartbit bvba
Hoogstraat 13
B-3670 Meeuwen
T: +32 11 64 08 80
F: +32 89 46 81 10
W: http://www.smartbit.be
E: arkadi at smartbit.be
More information about the reportlab-users
mailing list