From 149839aedc0a167116ff687d76238e5dbb61f43a Mon Sep 17 00:00:00 2001 From: Jan-Henrik Bruhn Date: Sat, 5 Oct 2024 22:50:44 +0200 Subject: [PATCH] Do not remove anchor when drawing multiline text I am not sure why this was done in the first place, maybe because support for it was only added in Pillow v8? This way, multiline text can properly be drawn if for example the text is fully centered. --- custom_components/open_epaper_link/imagegen.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/custom_components/open_epaper_link/imagegen.py b/custom_components/open_epaper_link/imagegen.py index a503535..4176749 100644 --- a/custom_components/open_epaper_link/imagegen.py +++ b/custom_components/open_epaper_link/imagegen.py @@ -224,7 +224,6 @@ def customimage(entity_id, service, hass): stroke_fill = element.get('stroke_fill', 'white') if "max_width" in element: text = get_wrapped_text(str(element['value']), font, line_length=element['max_width']) - anchor = None else: text = str(element['value']) d.text((element['x'], akt_pos_y), text, fill=getIndexColor(color), font=font, anchor=anchor, align=align, spacing=spacing, stroke_width=stroke_width, stroke_fill=stroke_fill) @@ -846,4 +845,4 @@ def rounded_corners(corner_string): if corner in corner_map: result[corner_map[corner]] = True - return tuple(result) \ No newline at end of file + return tuple(result)