captca.py: Fix PIL 10 support again

Bug: T354099
Follows-Up: Ia17157d45995b78c6a73f844dfe7d20d09564748
Change-Id: I9d1fe7ad7f12fd79c960574daf79e558d88cb02c
This commit is contained in:
Reedy 2024-01-27 14:26:00 +00:00
parent db932b2ae2
commit bdd127a276

View file

@ -115,7 +115,12 @@ def gen_captcha(text, fontname, fontsize, file_name):
font=font,
fill=fgcolor,
)
offset += font.getsize(c)[0] - random.uniform(5, 6)
if IMAGEFONT_HAS_GETBBOX:
offset += font.getbbox(c)[2:][0]
else:
offset += font.getsize(c)[0]
offset -= random.uniform(5, 6)
for i in range(10):
d.arc(