[reportlab-users] Bug when importing TrueType fonts with names containing blanks

Robin Becker robin at reportlab.com
Thu Nov 29 10:18:21 EST 2007


Dinu Gherman wrote:

> Hi,

>

> I'm getting an error when trying to use TrueType fonts containing

> blanks in their font names. See the following traceback:

>

........

>

> I can workaround this with the following simple minded patch to

> reportlab/pdfbase/ttfonts.py, but I'm not sure if this is a proper

> solution:

>

> --- ttfonts0.py 2007-11-29 15:43:25.000000000 +0100

> +++ ttfonts.py 2007-11-29 15:45:29.000000000 +0100

> @@ -478,6 +478,7 @@

> names[nameId] = N

> nameCount -= 1

> if nameCount==0: break

> + names[6] = names[6].replace(" ", "-") # FIX(?) DCG

> psName = names[6]

> if not psName:

> raise TTFError, "Could not find PostScript font name"

>

....

I have a strong feeling that the font postscript names aren't supposed to
contain blanks I think because they're supposed to be simple tokens in ps or
somesuch. I'm not an expert on TTF or postscript so perhaps someone else should
enlighten us.

It shouldn't matter for us as we're subsetting anyhow, but presumably the font
author wants his font name as specified.
--
Robin Becker


More information about the reportlab-users mailing list