+# This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Wolne Lektury. See NOTICE for more information.
+#
import PIL.ImageFont
from librarian import get_resource
from librarian.cover import Metric
author_font = PIL.ImageFont.truetype(
get_resource('fonts/SourceSans3VF-Roman.ttf'),
self.m.font_size,
- layout_engine=PIL.ImageFont.LAYOUT_BASIC
+ layout_engine=PIL.ImageFont.Layout.BASIC
)
author_font.set_variation_by_axes([600])
translator_font = PIL.ImageFont.truetype(
get_resource('fonts/SourceSans3VF-Roman.ttf'),
self.m.font_size,
- layout_engine=PIL.ImageFont.LAYOUT_BASIC
+ layout_engine=PIL.ImageFont.Layout.BASIC
)
translator_font.set_variation_by_axes([400])
authors = [a.readable() for a in self.cover.book_info.authors]
translators = [a.readable() for a in self.cover.book_info.translators]
+ self.textboxes = []
if authors and translators:
# Try with two boxes.
self.textboxes = [author_box]
- self.margin_top = self.textboxes[0].margin_top
+ if self.textboxes:
+ self.margin_top = self.textboxes[0].margin_top
def build(self, w, h):
img = PIL.Image.new('RGBA', (self.width, self.m.leading * 2))