[reportlab-users] once again with external fonts in pythonpoint

Paul Okop paul_okop at mail.ru
Thu Apr 17 06:31:38 EDT 2008





>

> Paul Okop wrote:

> > Here is the problem:

> > I've got an XML with unicode-strings(in Cyrillic), need to create PDF out of this with uni-font build-in. Since there is no unicode font in reportlab, I want to use some external font(T1 font called CyrveticaExtra). Is there any algorithm for building the font in the pythonpoint or reportlab?

> > Editing the stylesheets is not helpfull - fonts.py raises ValueError:

> >

> > File "fonts.py", line 68, in ps2tt

> > ValueError: Can't map determine family/bold/italic for cyrveticaextra

> >

> > If got my font copied into 'fonts' folder, then tried to 'insert' font's map into fonts.py - didn't help - pdfmetrics.py raised error:

> >

> > File "/usr/lib/python2.5/site-packages/reportlab/pdfbase/pdfmetrics.py", line 617, in getTypeFace

> > return _typefaces[faceName]

> > KeyError: 'cyrveticaextra'

> >

> > What next? As I understand the brute search should be done and the font should be registered, but the script only raises this error.

> >

> >

> > My system(if needed): Ubuntu 7.10 Python 2.5 Reportlab 2.1

> > _________

> > Paul Okop

> .........

> We attempt to locate fonts based on the T1SearchPath in rl_config.py. Before you

> even start with your python point you should try the following.

>

> 1) test this simple script

>

> from reportlab.pdfgen.canvas import Canvas

> c = Canvas('tlerc.pdf')

> c.setFont('LettErrorRobot-Chrome', 12)

> c.drawString(72,72,'Hello World')

> c.showPage()

> c.save()

>

> 2) copy the afm files from your fonts to reportlab/fonts

> 3) change the name LettErrorRobot-Chrome in the above to one of the names in the

> afm file(s)

> 4) retry and see if reportlab finds your file.

> --

> Robin Becker

>

>


This script works well, I've tested it before. Reportlab finds the file(there were no search-errors in log above), reportlab makes a PDF but this PDF rather simple(or should I write a big script for creating reports of 10+ pages with tables and graphics) and this pdf has no font in it.
As I wrote I need to use pythonpoint, to convert XML to PDF, not just creating PDF from code, but converting a large report XML to PDF with my font build in it. Is there any way to do that?

Ok, I guess there is some misunderstanding. Here is the promblem to solve:
- I've got an XML file to convert
- I've got T1 font
- I've got pythonpoint

What should I do to get a PDF based on my XML with my font in it?


More information about the reportlab-users mailing list