[reportlab-users] Some of the ttf font can't be registered

Tony Gu digisatori at gmail.com
Wed Sep 16 11:29:08 EDT 2009

I'm trying to register ttf font as stated below. It does work for many
fonts that I tested, but for certain fonts, it just throw AttributeError
as below:

pdfmetrics.registerFont(TTFont('hei', 'Heiti.ttf'))

in extractInfo
psName = names[6].replace(" ", "-") #Dinu Gherman's fix for font names
with spaces
AttributeError: 'NoneType' object has no attribute 'replace'

Also, I tested on reportlab.lib.fontfinder module, it will return empty
list when I do the search in the folder where those above mentioned
'Problematic' fonts located.

so far the 'Problematic' fonts that I tested on are all Chinese fonts,
and probably they contain Chinese type face name. Will this be the
source of the problem? Is there anyway I can workaround this problem?

Thanks and best regards,

Tony Gu

More information about the reportlab-users mailing list