mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-11 04:07:21 +03:00
Merge pull request #7587 from radarhere/freetypefont
Moved error from truetype() to FreeTypeFont
This commit is contained in:
commit
b51dcc070b
|
@ -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
|
||||
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user