X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/28532fa3b437bb36b9d5c582851d3cdcf8d772ab..aca6edb838d8f31fc1c72eb06891845eb9e28828:/src/librarian/covers/widgets/title.py diff --git a/src/librarian/covers/widgets/title.py b/src/librarian/covers/widgets/title.py index 7d070ca..b9dc8cb 100644 --- a/src/librarian/covers/widgets/title.py +++ b/src/librarian/covers/widgets/title.py @@ -1,3 +1,6 @@ +# 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 @@ -21,9 +24,18 @@ class TitleBox(Widget): title_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 ) title_font.set_variation_by_axes([800]) + title_font_2 = PIL.ImageFont.truetype( + get_resource('fonts/OpenSans-VariableFont_wdth,wght.ttf'), + self.m.font_size, + layout_engine=PIL.ImageFont.Layout.BASIC + ) + title_font_2.set_variation_by_axes([700, 700]) + font_fallbacks = { + ('\u0590', '\u05FF'): title_font_2, + } lines = self.lines or (int(self.height * (176/200) / self.m.leading) - 0) @@ -35,7 +47,8 @@ class TitleBox(Widget): lines, self.m.leading, self.m.tracking, - .5, .5 + .5, .5, + font_fallbacks=font_fallbacks ) self.margin_top = self.tb.margin_top