mod letter

This commit is contained in:
l.gabrysiak 2025-03-02 16:38:49 +01:00
parent 010f983531
commit 0cfcafeb27
1 changed files with 2 additions and 2 deletions

View File

@ -386,7 +386,7 @@ class UsersTable:
font_size = get_font_size(size, letter, font_path) font_size = get_font_size(size, letter, font_path)
font = ImageFont.truetype(font_path, font_size) font = ImageFont.truetype(font_path, font_size)
except IOError: except IOError:
font_url = "https://fonts.gstatic.com/s/roboto/v30/KFOmCnqEu92Fr1Mu4mxKKTU1Kg.woff2" font_url = "https://fonts.gstatic.com/s/readexpro/v21/SLXYc1bJ7HE5YDoGPuzj_dh8uc7wUy8ZQQyX2IwwZEzehiB9.woff2"
response = requests.get(font_url) response = requests.get(font_url)
font_data = response.content font_data = response.content
font_size = get_font_size(size, letter, font_data) font_size = get_font_size(size, letter, font_data)
@ -396,7 +396,7 @@ class UsersTable:
bbox = font.getbbox(letter) bbox = font.getbbox(letter)
text_width = bbox[2] - bbox[0] text_width = bbox[2] - bbox[0]
x = (size[0] - text_width) // 2 x = (size[0] - text_width) // 2
y = (size[1] - bbox[1]) // 2 # Poprawione obliczenie pozycji y y = (size[1] - bbox[1]) #// 2 # Poprawione obliczenie pozycji y
draw.text((x, y), letter, font=font, fill=text_color) draw.text((x, y), letter, font=font, fill=text_color)
buffered = io.BytesIO() buffered = io.BytesIO()