Skip to content

Commit

Permalink
Fix breaking change in default pillow font
Browse files Browse the repository at this point in the history
  • Loading branch information
mike8699 committed Apr 2, 2024
1 parent 597d25d commit ffde6a7
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions base/data/_title_screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,16 @@ def insert_title_screen(

if version_string:
draw = ImageDraw.Draw(img)
draw.fontmode = '1' # disable anti-aliasing on text

# Calculate size/location to put version string
img_width, img_height = img.size
_, _, text_width, text_height = draw.textbbox((0, 0), version_string)
_, _, text_width, text_height = draw.textbbox(xy=(0, 0), text=version_string, font_size=10)
x = img_width - text_width - 2
y = img_height - text_height

# draw rectangle to go behind text
draw.rectangle(
(x - 4, y - 2, x + text_width + 3, y + text_height),
fill=(209, 36, 37),
)
y = img_height - text_height - 2

# draw text
draw.text((x, y), version_string, fill=(20, 68, 115), stroke_width=4, stroke_fill=(0, 0, 0))
draw.text((x, y), version_string, fill=(20, 68, 115), font_size=10)

image_data = AutoList()
palette_data: list[tuple[int, int, int]] = []
Expand Down

0 comments on commit ffde6a7

Please sign in to comment.