fnp
/
librarian.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add snippets.
[librarian.git]
/
src
/
librarian
/
covers
/
widgets
/
title.py
diff --git
a/src/librarian/covers/widgets/title.py
b/src/librarian/covers/widgets/title.py
index
a5c6522
..
7d070ca
100644
(file)
--- a/
src/librarian/covers/widgets/title.py
+++ b/
src/librarian/covers/widgets/title.py
@@
-10,29
+10,14
@@
class TitleBox(Widget):
leading = 176 # 50pt
tracking = 2.385
leading = 176 # 50pt
tracking = 2.385
- def __init__(self, cover, width, height, lines,
force=False
):
+ def __init__(self, cover, width, height, lines,
scale=1
):
self.width = width
self.height = height
self.lines = lines
self.width = width
self.height = height
self.lines = lines
- self.force = force
- self.m = Metric(self, cover.m._scale)
+ self.m = Metric(self, cover.m._scale * scale)
super().__init__(cover)
def setup(self):
super().__init__(cover)
def setup(self):
- m = self.m
- while True:
- try:
- self.build_box()
- except:
- if self.force:
- self.m = Metric(self, self.m._scale * .99)
- print('lower to', self.m.font_size)
- else:
- raise
- else:
- break
-
- def build_box(self):
title_font = PIL.ImageFont.truetype(
get_resource('fonts/SourceSans3VF-Roman.ttf'),
self.m.font_size,
title_font = PIL.ImageFont.truetype(
get_resource('fonts/SourceSans3VF-Roman.ttf'),
self.m.font_size,