Re: Setting TrueType fonts in table cell

Tim Roberts <[email protected]>
Newsgroups gmane.comp.python.reportlab.user
Organization Providenza & Boekelheide, Inc.
Message-ID <[email protected]>
Nils Smeds wrote:
> Here is a simple test case:
> Modify the base_style array as indicated to expose the problem I see.

I can give you a workaround for this, although it is somewhat unsatisfying.

The root of the issue, I think, is that you have a document serving two
masters.  You are using SimpleDocTemplate to create a document object. 
That document object expects to be in charge.  When you call "build", he
does the drawing, he does a showPage, and he does a saveFile.  He thinks
he's done.  Then, you go fetch his canvas, do additional drawing, do
another showPage and another saveFile.  At that point, the fonts get
enumerated again and confusion results.

To work around this problem, you can just tell the document to forget
about the fonts it already handled.  So, add one line:
    PDFdoc.build(PDCdoc_elements)
    PDFcanvas=PDFdoc.canv
    PDFcanvas._doc.delayedFonts = []    # <<<

I'm afraid I will have to leave it to the ReportLab folks to figure out
whether this is preventable, or if this is a usage problem.

-- 
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.