[reportlab-users] WYSIWYG with reportlab and pygtk
Tobias Ceglarek
dev at ceglarek.org
Mon Feb 5 18:59:25 EST 2007
hello,
my goal is to create a little tool to interactively produce simple
documents with the principle of "What You See Is What You Get".
1. the user interface i have implemented with pygtk:
there is a textview connected to a textbuffer with a fonttag:
size:
myTextView.set_size_request(298,210) # = 10.5*cm,7.4*cm
font:
myFontTag.set_property("font","Century Schoolbook L 10")
2. i register a type-1 font and use it within a paragraphstyle
folder = '/usr/share/fonts/type1/gsfonts/'
afmFile = folder + 'c059013l.afm'
pfbFile = folder + 'c059013l.pfb'
justFace = pdfmetrics.EmbeddedType1Face(afmFile, pfbFile)
faceName = 'CenturySchL-Roma' # pulled from AFM file
pdfmetrics.registerTypeFace(justFace)
justFont = pdfmetrics.Font('CenturySchL-Roma', faceName,
'WinAnsiEncoding')
pdfmetrics.registerFont(justFont)
...
docPagesize = (10.5*cm,7.4*cm)
...
style1 = ParagraphStyle(
"VorderseiteStyle",
fontName="CenturySchL-Roma",
fontSize=10,
#leading=16,
leftIndent=0,
rightIndent=0,
firstLineIndent=0,
alignment=TA_CENTER,
spaceBefore=0,
spaceAfter=0,
bulletFontName="CenturySchL-Roma",
bulletFontSize=10,
bulletIndent=0,
textColor=black,
backColor=None
)
the effect is the same font (in the user interface and the pdf output).
but the fonts have not exactly the same size and/or spaces between words
and/or letters.
i would be glad if anyone can help me or just give a hint.
perhaps my attempt is wrong/too complicated - how would you make a
simple wysiwyg document?
regards,
prinz igor
More information about the reportlab-users
mailing list