[reportlab-users] OTF fonts supported by Reportlab?

Mike Driscoll mike at pythonlibrary.org
Tue Jul 23 09:47:28 EDT 2013


After writing a tutorial on fonts in Reportlab, I got a comment asking if
OTF fonts are supported. So far, I've found conflicting information.

This old thread seems to indicate that it should work:

While this one says that if the font uses CFF format, Reportlab will spit
out an error:


So I tried it. I went to http://www.fontsquirrel.com/ and downloaded the
first OTF font on there, specifically "Source Sans Pro Black". Then I ran
the attached code which gave me the following traceback:

reportlab.pdfbase.ttfonts.TTFError: TTF file
postscript outlines are not supported
File "c:\Users\mdriscoll\Desktop\rep-fonts\otfDemo.py", line 29, in <module>
File "c:\Users\mdriscoll\Desktop\rep-fonts\otfDemo.py", line 17, in embedOTF
pdfmetrics.registerFont(TTFont("Source Sans Pro Black", otf_font))
File "C:\Python26\Lib\site-packages\reportlab\pdfbase\ttfonts.py", line
1009, in __init__
self.face = TTFontFace(filename, validate=validate,
File "C:\Python26\Lib\site-packages\reportlab\pdfbase\ttfonts.py", line
915, in __init__
TTFontFile.__init__(self, filename, validate=validate,
File "C:\Python26\Lib\site-packages\reportlab\pdfbase\ttfonts.py", line
412, in __init__
TTFontParser.__init__(self, file,
File "C:\Python26\Lib\site-packages\reportlab\pdfbase\ttfonts.py", line
190, in __init__
isCollection = self.readHeader()
File "C:\Python26\Lib\site-packages\reportlab\pdfbase\ttfonts.py", line
253, in readHeader
raise TTFError('%s file "%s": postscript outlines are not

Is there a way to make Reportlab accept this font or fonts like it?

Mike Driscoll
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20130723/5df70c34/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: otfDemo.py
Type: application/octet-stream
Size: 1074 bytes
Desc: not available
Url : <http://two.pairlist.net/pipermail/reportlab-users/attachments/20130723/5df70c34/attachment.obj>

More information about the reportlab-users mailing list