[Image-SIG] PIL and truetype font encoding
fredrik at pythonware.com
Mon Apr 21 19:37:35 CEST 2008
Laszlo Nagy wrote:
> 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?
The current driver ignores the encoding if it isn't exactly four
characters long. Otherwise, it'll raise an error if the underlying
library (FreeType) reports an error.
No idea why Lütgendorf comes out wrong; I'm using Unicode fonts in
deployed applications without any problems.
Feel free to mail me a short test snippet and a copy of the font, and
I'll take a look when I find the time.
More information about the Image-SIG