[Image-SIG] PIL and truetype font encoding
Laszlo Nagy
gandalf at shopzeus.com
Mon Apr 21 17:40:07 CEST 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 result. 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 handle "Lütgendorf" - I have tested it from GIMP. It can handle ü é ß and other non-ascii characters. So I'm 100% sure that the problem is either with PIL and/or my program, not the truetype font.
System info:
Linux saturnus 2.6.22-14-generic #1 SMP Tue Feb 12 07:42:25 UTC 2008 i686 GNU/Linux
Python 2.5.1 (r251:54863, Mar 7 2008, 04:10:12)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
PIL was installed with apt-get: python-imaging 1.1.6-1
I can send the truetype font file if needed (AFAIK it is not copyrighted.)
Thank you,
Laszlo
More information about the Image-SIG
mailing list