mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
78755c8640
commit
89ce33ebc9
@ -240,7 +240,7 @@ def generate_masthead(title, output_path=None, width=600, height=60):
|
|||||||
font = ImageFont.truetype(font_path, 48)
|
font = ImageFont.truetype(font_path, 48)
|
||||||
except:
|
except:
|
||||||
font = ImageFont.truetype(default_font, 48)
|
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)
|
width, height = draw.textsize(text, font=font)
|
||||||
left = max(int((width - width)/2.), 0)
|
left = max(int((width - width)/2.), 0)
|
||||||
top = max(int((height - height)/2.), 0)
|
top = max(int((height - height)/2.), 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user