X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/aceaf70338e678b35bffbb377286cf9ce3b5e81d..295a1350b069ee750d2f7430e779e5ac6f23a673:/src/librarian/covers/marquise.py?ds=inline diff --git a/src/librarian/covers/marquise.py b/src/librarian/covers/marquise.py index fb84a79..d0ce49e 100644 --- a/src/librarian/covers/marquise.py +++ b/src/librarian/covers/marquise.py @@ -99,20 +99,25 @@ class MarquiseCover(Cover): (self.m.marquise_xl, None), ] - for marquise_h, lines in layout_options: - title_box_height = marquise_h - self.m.title_box_top - self.m.margin - try: - title_box = TitleBox( - self, - self.m.width - 2 * self.m.margin, - title_box_height, - lines, - force=lines is None - ) - except DoesNotFit: - continue - else: - break + # Trying all the layout options with decreasing scale. + title_box = None + title_scale = 1 + while title_box is None: + for marquise_h, lines in layout_options: + title_box_height = marquise_h - self.m.title_box_top - self.m.margin + try: + title_box = TitleBox( + self, + self.m.width - 2 * self.m.margin, + title_box_height, + lines, + scale=title_scale + ) + except DoesNotFit: + continue + else: + break + title_scale *= .99 self.marquise_height = marquise_h marquise = Marquise(self, marquise_h)