diff --git a/src/PIL/ImageFont.py b/src/PIL/ImageFont.py index c2956213519..1324f8b4e6f 100644 --- a/src/PIL/ImageFont.py +++ b/src/PIL/ImageFont.py @@ -790,6 +790,10 @@ def truetype(font=None, size=10, index=0, encoding="", layout_engine=None): :exception OSError: If the file could not be read. """ + if size <= 0: + msg = "font size must be positive" + raise ValueError(msg) + def freetype(font): return FreeTypeFont(font, size, index, encoding, layout_engine)