aboutsummaryrefslogtreecommitdiff
path: root/app/converter/cover.py
diff options
context:
space:
mode:
authorhistoria <historiavg@proton.me>2026-09-01 14:32:05 -0400
committerhistoria <historiavg@proton.me>2026-09-01 14:32:05 -0400
commit6cfcd564c0684c52618235e6366f4a81c02b9a5b (patch)
tree55321760a8103bc6b5d79489fac4135a60e6e3ba /app/converter/cover.py
parentdc6e7cd43029da62dabe2513fb5aa8a34df1bd6d (diff)
downloadtts-audiobook-generator-6cfcd564c0684c52618235e6366f4a81c02b9a5b.tar.gz
slop refactor/dedup
Diffstat (limited to 'app/converter/cover.py')
-rw-r--r--app/converter/cover.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/converter/cover.py b/app/converter/cover.py
index b2d3cb5..9bf9237 100644
--- a/app/converter/cover.py
+++ b/app/converter/cover.py
@@ -122,6 +122,10 @@ _FONT = {
_GLYPH_WIDTH = 5
_GLYPH_HEIGHT = 7
+# Any character outside the embedded font (accented letters, CJK,
+# Cyrillic, ...) renders as an empty box: silently dropping it would
+# blank those titles while still counting their width for centering.
+_UNKNOWN_GLYPH = [0x1F, 0x11, 0x11, 0x11, 0x11, 0x11, 0x1F]
_TEXT_SCALE = 6 # render each font pixel as a 6x6 block
_TEXT_MARGIN = 60 # horizontal padding when wrapping
_TEXT_COLOR = (255, 255, 255)
@@ -194,9 +198,7 @@ def _render_line(pixels: List[List[Tuple[int, int, int]]], text: str, x0: int, y
stays tinted by the gradient behind it).
"""
for char_index, char in enumerate(text):
- glyph = _FONT.get(char)
- if glyph is None:
- continue
+ glyph = _FONT.get(char, _UNKNOWN_GLYPH)
x_off = x0 + char_index * (_GLYPH_WIDTH + 1) * _TEXT_SCALE
for gy, bits in enumerate(glyph):
for gx in range(_GLYPH_WIDTH):