Skip to content

Commit

Permalink
Moved error from truetype() to FreeTypeFont
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Nov 29, 2023
1 parent e1291b8 commit f23d029
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/PIL/ImageFont.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ class FreeTypeFont:
def __init__(self, font=None, size=10, index=0, encoding="", layout_engine=None):
# FIXME: use service provider instead

if size <= 0:
msg = "font size must be greater than 0"
raise ValueError(msg)

self.path = font
self.size = size
self.index = index
Expand Down Expand Up @@ -791,10 +795,6 @@ def truetype(font=None, size=10, index=0, encoding="", layout_engine=None):
:exception ValueError: If the font size is not greater than zero.
"""

if size <= 0:
msg = "font size must be greater than 0"
raise ValueError(msg)

def freetype(font):
return FreeTypeFont(font, size, index, encoding, layout_engine)

Expand Down

0 comments on commit f23d029

Please sign in to comment.