change how font is loaded via systemctl - added direct paths

This commit is contained in:
Chuck
2025-08-13 20:36:23 -05:00
parent 8e1b04550b
commit 6bc1039ed6
16 changed files with 132 additions and 90 deletions

View File

@@ -428,7 +428,10 @@ class StockManager:
fallback = Image.new('RGBA', (32, 32), (0, 0, 0, 0))
draw = ImageDraw.Draw(fallback)
try:
font = ImageFont.truetype("assets/fonts/OpenSans-Regular.ttf", 16)
# Resolve font path absolutely to avoid fallback under systemd
script_dir = os.path.dirname(os.path.abspath(__file__))
font_path = os.path.abspath(os.path.join(script_dir, "../assets/fonts/OpenSans-Regular.ttf"))
font = ImageFont.truetype(font_path, 16)
except:
font = ImageFont.load_default()