✨
This commit is contained in:
@ -57,7 +57,7 @@ def make_test_pages(fonts: dict[str, ImageFont.FreeTypeFont]):
|
||||
final_text = []
|
||||
current_text = ""
|
||||
for char in TEST_TEXT:
|
||||
if font.getsize(current_text + char)[0] > (writable_area):
|
||||
if font.getbbox(current_text + char)[2] > (writable_area):
|
||||
final_text.append(current_text)
|
||||
current_text = char
|
||||
else:
|
||||
@ -94,7 +94,7 @@ def make_fonts():
|
||||
font_path = f"./fonts/{font_name}.{file_type}"
|
||||
tmp_font = ImageFont.truetype(font_path, FONT_SIZE)
|
||||
letter_height = int(average([
|
||||
tmp_font.getsize(i)[1] for i in TEST_TEXT
|
||||
tmp_font.getbbox(i)[3] for i in TEST_TEXT
|
||||
]))
|
||||
new_size = (FONT_SIZE**2)//letter_height
|
||||
new_font = ImageFont.truetype(font_path, new_size)
|
||||
|
Reference in New Issue
Block a user