[reportlab-users] registerFont

Thomas Kremmel thomasspin at gmail.com
Sun Apr 4 19:41:45 EDT 2010


Hi,

i'm using the following lines of code to register a font from a ttf file and
consequently setting the font from a canvas to the registered font.

pdfmetrics.registerFont(TTFont('Calibri', settings.MEDIA_ROOT +
'/fonts/calibri.ttf'))
p.setFont("Calibri", 7)


This worked always fine on my dev. settings and now in production it shows
some strange behavior. Now and then a call to this function crashes on the
p.setFont() line with the following error message: KeyError: 'Calibri'

This tells me that the font Calibri was not registered correct, at least
that is how I would interpet it. But that seems strange to me since I think
if registering fails, the error should be thrown on the registerFont line.
Thus it seems as the registerFont call succeeds.
Interestingly it crashes just sometimes, not always...

Any ideas?
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20100405/beaf5756/attachment.htm>


More information about the reportlab-users mailing list