From e6f1f77ec38463f97f79840c352efa1019e33053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= Date: Thu, 8 Dec 2022 21:16:41 +0000 Subject: [PATCH] Font via DAV --- api/advent22_api/routers/_misc.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/advent22_api/routers/_misc.py b/api/advent22_api/routers/_misc.py index 3e099ae..54a25eb 100644 --- a/api/advent22_api/routers/_misc.py +++ b/api/advent22_api/routers/_misc.py @@ -92,11 +92,14 @@ async def get_auto_image( image = await load_image(images[index]) rnd = await Random.get(index) + lena_ttf = await dav_get_file("fonts/Lena.ttf") + lena_ttf.seek(0) + # Buchstabe verstecken await image.hide_text( xy=tuple(rnd.choices(range(30, 470), k=2)), text=letter, - font=ImageFont.truetype("Lena.ttf", 50), + font=ImageFont.truetype(lena_ttf, 50), ) return image