PIL font encoding

Laszlo Nagy gandalf at shopzeus.com
Mon Apr 21 05:28:22 EDT 2008


def getfnt(size):
    return ImageFont.truetype("cartoon.ttf",size,encoding='unic')

Using the above function, I cannot draw special german characters. E.g.

u'L\xfctgendorf'


It will print "Lutgendorf" instead of "Lütgendorf". Much more 
interesting is that I can also do this:

def getfnt(size):
    return 
ImageFont.truetype("cartoon.ttf",size,encoding='put_somethin_here_it_has_no_effect 
WHAT?????? ')

Same results. Shouldn't the truetype constructor raise an exception if 
the encoding is invalid and/or not available with the selected font?

BTW my "cartoon.ttf" font is able to print "Lütgendorf". I have tested 
it from GIMP. So I'm 100% sure that the problem is with PIL.

Thank you,

   Laszlo





More information about the Python-list mailing list