Skip to content

Commit

Permalink
Fix compatibility with pillow >= 10.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
e2dk4r committed Aug 18, 2024
1 parent 204b709 commit cbdefe5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fabulous/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ def __init__(self, text, fsize=23, color="#0099ff", shadow=False,
self.color = grapefruit.Color.NewFromHtml(color)
self.font = ImageFont.truetype(resolve_font(font), fsize)
skew = skew or 0
size = tuple([n + 3 + skew for n in self.font.getsize(self.text)])
if hasattr(self.font, 'getsize'):
size = tuple([n + 3 + skew for n in self.font.getsize(self.text)])
else:
size = tuple([n + 3 + skew for n in self.font.getbbox(self.text)[2:4]])
self.img = Image.new("RGBA", size, (0, 0, 0, 0))
cvs = ImageDraw.Draw(self.img)
if shadow:
Expand Down

0 comments on commit cbdefe5

Please sign in to comment.