[reportlab-users] FontSize in new para.py

Dirk Holtwick reportlab-users@reportlab.com
Mon, 26 May 2003 19:02:16 +0200


the size command doesn't seem to work if it isn't at the beginnig of a 
new line. therefore <super> and <sub> do not work in the right way. Here 
is an example:

from reportlab.platypus import *
from reportlab.lib.styles import *
from reportlab.rl_config import *
from reportlab.lib.units import *
from reportlab.platypus.para import *

import os

styles = getSampleStyleSheet()

text = """
Hallo <super>hoch</super>
<a href="test.html">Verweis</a>
<b>Fett <u>Unterstrichen <i>Italic</i> weg </u> weg</b>"""

program = [
     ("push",),
     "Start ",
     ("size", 5),
     "Test ",
     ("size", 10),
     "Ende",
     ("pop",),
     #('nextLine', 0),
     ]

def test():
     doc = SimpleDocTemplate("test.pdf")
     story = []
     #story.append(Paragraph(text, styles["Normal"]))
     # story.append(Paragraph(program, styles["Normal"]))
     p = Para(styles["Normal"], parsedText="", bulletText=None, state=None)
     p.program = program
     story.append(p)
     p = Para(styles["Normal"], parsedText="", bulletText=None, state=None)
     p.program = program
     #print "before", p.getSpaceBefore(), "after", p.getSpaceAfter()
     story.append(p)
     story.append(Paragraph(text, styles["Normal"]))
     story.append(Paragraph(text, styles["Normal"]))
     from reportlab.platypus.paragraph import *
     story.append(Paragraph(text, styles["Normal"]))
     story.append(Paragraph(text, styles["Normal"]))
     doc.build(story)

if __name__=="__main__":
     test()
     os.system("start test.pdf")


-- 

Mit freundlichen Grüßen

Dirk Holtwick
Geschäftsführer

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

spirito GmbH
Lerchenstr. 8
D-47057 Duisburg

fon: +49 203 3187778
mbx: holtwick@spirito.de
web: http://www.spirito.de