[reportlab-users] Changing fonts for a SimpleDocTemplate
Robin Becker
robin at reportlab.com
Mon Nov 22 05:36:21 EST 2010
On 20/11/2010 06:43, Thejaswi Puthraya wrote:
> Hi,
...........
>
> pdfmetrics.registerFont(TTFont('EurostileExtended',
> "/path/to/fonts/EurostileExtended-Roman-DTC.TTF")))
> doct = doctemplate.SimpleDocTemplate("/path/to/output.pdf",
> pagesize=landscape(A4))
> style_sheet = getSampleStyleSheet()
> style_sheet.add(ParagraphStyle(name='TestStyle',
>
> fontName='EurostileExtended',
> fontSize=12,
> leading=12)
> data = []
> data.append((Paragraph(some_content, style=style_sheet["Title"]),
> Paragraph(story_content,
> style=style_sheet["TestStyle"])))
> style = GRID_STYLE
> style.add(*('VALIGN', (0,0), (-1,-1), 'MIDDLE'))
> style.add(*('LEFTPADDING', (0,0), (-1,-1), 15))
> style.add(*('RIGHTPADDING', (0,0), (-1,-1), 15))
> table = LongTable(data, colWidths=360, rowHeights=215, style=style)
> page_flowables = [table]
> doct.build(page_flowables)
> canvas = doct.canv
> canvas.setTitle("Some title")
> canvas.showPage()
> canvas.save()
>
> On running this piece of code, I get the following error:
>
> redefining named object: 'toUnicodeCMap:AAAAAA+EurostileExtended-Roman-DTC'
>
> I am not sure I understand this error and how I am redefining this object
> when I am calling registerFont only once.
>
> PS: The addFont method not working has still not been answered ;-)
>
.........
I'm getting this error too and I'm not sure I understand it either. However, I
could not use the above so I had to make my own example and use that. Still we
should be able to explain this problem after some more analysis. I see the same
font being added more than once which has to be a problem.
--
Robin Becker
More information about the reportlab-users
mailing list