feat: Implement interactive font selection by scanning the fonts/ directory for .otf, .ttf, and .ttc files, adding new fonts and updating documentation.

This commit is contained in:
2026-03-15 03:52:10 -07:00
parent e6826c884c
commit 11226872a1
8 changed files with 112 additions and 43 deletions

View File

@@ -57,6 +57,10 @@ _FONT_CACHE = {}
def font():
"""Lazy-load the primary OTF font (path + face index aware)."""
global _FONT_OBJ, _FONT_OBJ_KEY
if not config.FONT_PATH:
raise FileNotFoundError(
f"No primary font selected. Add .otf/.ttf/.ttc files to {config.FONT_DIR}."
)
key = (config.FONT_PATH, config.FONT_INDEX, config.FONT_SZ)
if _FONT_OBJ is None or _FONT_OBJ_KEY != key:
_FONT_OBJ = ImageFont.truetype(