Merge pull request #7021 from radarhere/getmask2

Do not render text if image has zero width or height
This commit is contained in:
Andrew Murray 2023-04-01 09:26:06 +11:00 committed by GitHub
commit eeaee75a6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -767,18 +767,19 @@ class FreeTypeFont:
offset = offset[0] - stroke_width, offset[1] - stroke_width
Image._decompression_bomb_check(size)
im = fill("RGBA" if mode == "RGBA" else "L", size, 0)
self.font.render(
text,
im.id,
mode,
direction,
features,
language,
stroke_width,
ink,
start[0],
start[1],
)
if min(size):
self.font.render(
text,
im.id,
mode,
direction,
features,
language,
stroke_width,
ink,
start[0],
start[1],
)
return im, offset
def font_variant(