fix some fonts not rendering fully(getting cropped)
This commit is contained in:
parent
2f98d26842
commit
83eb229189
1 changed files with 1 additions and 1 deletions
|
@ -3,7 +3,7 @@ import numpy as np
|
||||||
|
|
||||||
def text_to_matrix(text, size, font):
|
def text_to_matrix(text, size, font):
|
||||||
pil_font = ImageFont.truetype(font, size=size // len(text), encoding="unic")
|
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)
|
draw = ImageDraw.Draw(canvas)
|
||||||
black = "#000000"
|
black = "#000000"
|
||||||
draw.text((10, 10), text, font=pil_font, fill=black)
|
draw.text((10, 10), text, font=pil_font, fill=black)
|
||||||
|
|
Loading…
Reference in a new issue