mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
b42671831e
commit
dd0905ad3f
@ -933,7 +933,6 @@ class BasicNewsRecipe(Recipe):
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
import Image, ImageDraw, ImageFont
|
import Image, ImageDraw, ImageFont
|
||||||
font_path = P('fonts/liberation/LiberationSerif-Bold.ttf')
|
font_path = P('fonts/liberation/LiberationSerif-Bold.ttf')
|
||||||
font = ImageFont.truetype(font_path, 48)
|
|
||||||
title = self.title if isinstance(self.title, unicode) else \
|
title = self.title if isinstance(self.title, unicode) else \
|
||||||
self.title.decode(preferred_encoding, 'replace')
|
self.title.decode(preferred_encoding, 'replace')
|
||||||
date = strftime(self.timefmt)
|
date = strftime(self.timefmt)
|
||||||
@ -943,6 +942,7 @@ class BasicNewsRecipe(Recipe):
|
|||||||
img = Image.new('RGB', (COVER_WIDTH, COVER_HEIGHT), 'white')
|
img = Image.new('RGB', (COVER_WIDTH, COVER_HEIGHT), 'white')
|
||||||
draw = ImageDraw.Draw(img)
|
draw = ImageDraw.Draw(img)
|
||||||
# Title
|
# Title
|
||||||
|
font = ImageFont.truetype(font_path, 44)
|
||||||
width, height = draw.textsize(title, font=font)
|
width, height = draw.textsize(title, font=font)
|
||||||
left = max(int((COVER_WIDTH - width)/2.), 0)
|
left = max(int((COVER_WIDTH - width)/2.), 0)
|
||||||
top = 15
|
top = 15
|
||||||
|
Loading…
x
Reference in New Issue
Block a user