fix some fonts not rendering fully(getting cropped)

This commit is contained in:
Rusty Striker 2024-01-26 15:27:10 +02:00
parent 2f98d26842
commit 83eb229189
Signed by: RustyStriker
GPG key ID: 9DBDBC7C48FC3C31

View file

@ -3,7 +3,7 @@ import numpy as np
def text_to_matrix(text, size, font):
pil_font = ImageFont.truetype(font, size=size // len(text), encoding="unic")
canvas = Image.new('RGB', [size + 20, size + 20], (255, 255, 255))
canvas = Image.new('RGB', [size * 2, size * 2], (255, 255, 255))
draw = ImageDraw.Draw(canvas)
black = "#000000"
draw.text((10, 10), text, font=pil_font, fill=black)