AE43: Rückentext skaliert, Titel 5,76 → 8,16 pt
This commit is contained in:
1 parent
39957cd531
commit
d2107e8226
1 file changed
+8
-4
@@ -232,8 +232,12 @@ def draw_spine(width: int, height: int, art: Image.Image) -> Image.Image:
|
||||
# Rotated text: read bottom→top when book stands (common DE trade convention:
|
||||
# when flat front-up, spine text reads left-to-right from top of book — we use
|
||||
# rotate 90° CCW so title reads correctly on shelf for most EU paperbacks).
|
||||
title_f = font(BASK, 4, max(14, min(24, width - 8)))
|
||||
author_f = font(AVEN, 5, max(11, min(16, width - 10)))
|
||||
# Title size sets the block: author size and both offsets follow it, so the
|
||||
# 2 px gap between title and author ink holds at larger sizes (AE-43).
|
||||
title_px = max(14, min(34, width - 8))
|
||||
author_px = max(11, round(0.6 * title_px))
|
||||
title_f = font(BASK, 4, title_px)
|
||||
author_f = font(AVEN, 5, author_px)
|
||||
|
||||
# Build horizontal text image then rotate
|
||||
text_h = max(height - inches(0.6), 100)
|
||||
@@ -247,11 +251,11 @@ def draw_spine(width: int, height: int, art: Image.Image) -> Image.Image:
|
||||
tw = td.textlength(title, font=title_f)
|
||||
aw = td.textlength(author, font=author_f)
|
||||
y_mid = (text_canvas_h - 20) // 2
|
||||
td.text(((text_canvas_w - tw) / 2, max(0, y_mid - 12)), title, font=title_f, fill=(238, 242, 248, 245))
|
||||
td.text(((text_canvas_w - tw) / 2, max(0, y_mid - round(0.5 * title_px))), title, font=title_f, fill=(238, 242, 248, 245))
|
||||
# Author only if spine is wide enough
|
||||
if width >= inches(0.45):
|
||||
td.text(
|
||||
((text_canvas_w - aw) / 2, min(text_canvas_h - 18, y_mid + 14)),
|
||||
((text_canvas_w - aw) / 2, min(text_canvas_h - 18, y_mid + round(0.6 * title_px))),
|
||||
author,
|
||||
font=author_f,
|
||||
fill=(180, 196, 214, 230),
|
||||
|
||||
Reference in new issue
Block a user