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

Robin Becker robin at reportlab.com
Thu Apr 17 06:05:16 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


More information about the reportlab-users mailing list