Skip to content

Commit

Permalink
Make sure Pillow uses ImageFont.LAYOUT_BASIC because of python-pillow…
Browse files Browse the repository at this point in the history
  • Loading branch information
rczajka committed Oct 7, 2020
1 parent d04e618 commit 6079357
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/librarian/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ def image(self):
)

author_font = ImageFont.truetype(
self.author_font_ttf, metr.author_font_size)
self.author_font_ttf, metr.author_font_size,
layout_engine=ImageFont.LAYOUT_BASIC)
for pa in self.pretty_authors():
tbox.text(pa, self.author_color, author_font, metr.author_lineskip,
self.author_shadow)
Expand All @@ -204,7 +205,8 @@ def image(self):
metr.height - top,
)
title_font = ImageFont.truetype(
self.title_font_ttf, metr.title_font_size)
self.title_font_ttf, metr.title_font_size,
layout_engine=ImageFont.LAYOUT_BASIC)
tbox.text(self.pretty_title(), self.title_color, title_font,
metr.title_lineskip, self.title_shadow)
text_img = tbox.image()
Expand Down Expand Up @@ -335,7 +337,8 @@ def add_box(self, img):
box = TextBox(metr.title_box_width, metr.height,
padding_y=metr.box_padding_y)
author_font = ImageFont.truetype(
self.author_font_ttf, metr.author_font_size)
self.author_font_ttf, metr.author_font_size,
layout_engine=ImageFont.LAYOUT_BASIC)
for pa in self.pretty_authors():
box.text(pa, font=author_font, line_height=metr.author_lineskip,
color=self.author_color, shadow_color=self.author_shadow)
Expand All @@ -349,7 +352,8 @@ def add_box(self, img):

# Write title.
title_font = ImageFont.truetype(
self.title_font_ttf, metr.title_font_size)
self.title_font_ttf, metr.title_font_size,
layout_engine=ImageFont.LAYOUT_BASIC)
box.text(self.pretty_title(),
line_height=metr.title_lineskip,
font=title_font,
Expand Down

0 comments on commit 6079357

Please sign in to comment.