Unicode characters not rendering with PIL ImageFont
I'm trying to write tiff images using box drawing characters, but all of
the characters in question show up as:
The box draw characters (e.g. "©°©¤©´©¦©¸©¼¨b¨T¨e¨h¨k¨\¨_") were pasted
directly into the source code, and they show up correctly when saved to a
text file, but I don't understand why they're not showing up on the image.
Here is an example of the code I'm using to draw the image:
# coding=utf-8
text = "©°©¤©´©¦©¸©¼¨b¨T¨e¨h¨k¨\¨_"
from PIL import Image, ImageDraw, ImageFont, TiffImagePlugin
img = Image.new("1",(1200,1600),1)
font = ImageFont.truetype("cour.ttf",14,encoding="unic")
draw = ImageDraw.Draw(img)
draw.text((40,0), text, font=font, fill=0)
img.save("imagefile.tif","TIFF")
I'm using python version 2.7.2 on Windows 7.
No comments:
Post a Comment