[reportlab-users] TTF error

Peter Sagerson psagers at ignorare.net
Sat Jul 23 14:42:09 EDT 2016


Hello,

I just tried instantiating a TTFont object and got this error: "psName='\xf8' contains invalid character '\xf8’”. I stepped through TTFontFile.extractInfo and found that the names dict ended up with this rather unpromising set of values:

{1: '\xf8', 2: '\xf8', 3: '\xf8', 4: 'venti-cf-medium WebFont', 6: '\xf8’}

Just to push past it, I added a hack to replace all of the ‘\xf8’ values with None and everything worked fine from there.

I don’t know anything about TrueType, so I don’t know if we can call this a malformed font or if it’s more properly considered a bug in reportlab. Either way, there may be an opportunity to be a little more robust here. For instance, using the invalid-character test to quietly ignore bogus names instead of raising an exception.

Any thoughts about the most appropriate course here?

Thanks,
Peter



More information about the reportlab-users mailing list