deprecate fill in imageFont

This commit is contained in:
nulano 2022-04-16 17:07:32 +02:00
parent 535c45717f
commit a766b5b0d5
No known key found for this signature in database
GPG Key ID: B650CDF63B705766
2 changed files with 12 additions and 1 deletions

View File

@ -977,6 +977,11 @@ class TestImageFont:
assert_image_similar_tofile(im, "Tests/images/colr_bungee_mask.png", 22)
def test_fill_deprecation(self):
font = self.get_font()
with pytest.warns(DeprecationWarning):
font.getmask2("Hello world", fill=Image.core.fill)
@skip_unless_feature("raqm")
class TestImageFont_RaqmLayout(TestImageFont):

View File

@ -602,7 +602,7 @@ class FreeTypeFont:
self,
text,
mode="",
fill=Image.core.fill,
fill=None,
direction=None,
features=None,
language=None,
@ -627,6 +627,8 @@ class FreeTypeFont:
.. versionadded:: 1.1.5
:param fill: Fill function. Deprecated.
:param direction: Direction of the text. It can be 'rtl' (right to
left), 'ltr' (left to right) or 'ttb' (top to bottom).
Requires libraqm.
@ -674,6 +676,10 @@ class FreeTypeFont:
:py:mod:`PIL.Image.core` interface module, and the text offset, the
gap between the starting coordinate and the first marking
"""
if fill is not None:
deprecate("fill", 10)
else:
fill = Image.core.fill
size, offset = self.font.getsize(
text, mode, direction, features, language, anchor
)