This commit is contained in:
Kovid Goyal 2011-12-27 15:00:26 +05:30
parent 78755c8640
commit 89ce33ebc9

View File

@ -240,7 +240,7 @@ def generate_masthead(title, output_path=None, width=600, height=60):
font = ImageFont.truetype(font_path, 48)
except:
font = ImageFont.truetype(default_font, 48)
text = title.encode('utf-8')
text = title.encode('utf-8') if isinstance(title, unicode) else title
width, height = draw.textsize(text, font=font)
left = max(int((width - width)/2.), 0)
top = max(int((height - height)/2.), 0)