I would like to add Russian text to the image. I am using PIL 1.1.7 and Python 2.7 on a Windows computer. Since the PIL is compiled without the libfreetype library , I use the following on the development server:
font_text = ImageFont.load('helvR24.pil') draw.text((0, 0), ' ', font=font_text)
( helvR24.pil taken from http://effbot.org/media/downloads/pilfonts.zip )
In a production environment, I do the following:
font_text = ImageFont.truetype('HelveticaRegular.ttf', 24, encoding="utf-8") draw.text((0, 0), ' ', font=font_text)
(tried to use unic , cp-1251 instead of utf-8 )
In both cases, it does not display Russian characters (instead, squares or dummy characters are displayed). I think this does not work in the development environment, since most likely helvR24.pil does not contain Russian characters (I donโt know how to check this). But HelveticaRegular.ttf surely has this. I also verified that my .py file is gea-8 encoded. And it does not display Russian characters even with the default font:
draw.text((0, 0), ' ', font=ImageFont.load_default())
What else should I try / check? I have looked through https://stackoverflow.com/a/464629/2127/ - this does not help.