Remove FreeTypeFont.getmask2 fill parameter, deprecated in 9.2.0

This commit is contained in:
Hugo van Kemenade 2023-04-02 21:40:39 +03:00
parent 575a038f97
commit c9f11565f1
3 changed files with 10 additions and 31 deletions

View File

@ -1083,14 +1083,6 @@ def test_woff2(layout_engine):
assert_image_similar_tofile(im, "Tests/images/test_woff2.png", 5) assert_image_similar_tofile(im, "Tests/images/test_woff2.png", 5)
def test_fill_deprecation(font):
with pytest.warns(DeprecationWarning):
font.getmask2("Hello world", fill=Image.core.fill)
with pytest.warns(DeprecationWarning):
with pytest.raises(TypeError):
font.getmask2("Hello world", fill=None)
def test_render_mono_size(): def test_render_mono_size():
# issue 4177 # issue 4177

View File

@ -12,14 +12,6 @@ Deprecated features
Below are features which are considered deprecated. Where appropriate, Below are features which are considered deprecated. Where appropriate,
a ``DeprecationWarning`` is issued. a ``DeprecationWarning`` is issued.
FreeTypeFont.getmask2 fill parameter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. deprecated:: 9.2.0
The undocumented ``fill`` parameter of :py:meth:`.FreeTypeFont.getmask2` has been
deprecated and will be removed in Pillow 10 (2023-07-01).
PhotoImage.paste box parameter PhotoImage.paste box parameter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -207,6 +199,15 @@ FitsStubImagePlugin
The stub image plugin ``FitsStubImagePlugin`` has been removed. The stub image plugin ``FitsStubImagePlugin`` has been removed.
FITS images can be read without a handler through :mod:`~PIL.FitsImagePlugin` instead. FITS images can be read without a handler through :mod:`~PIL.FitsImagePlugin` instead.
FreeTypeFont.getmask2 fill parameter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. deprecated:: 9.2.0
.. versionremoved:: 10.0.0
The undocumented ``fill`` parameter of :py:meth:`.FreeTypeFont.getmask2` has been
removed.
PyQt5 and PySide2 PyQt5 and PySide2
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~

View File

@ -51,9 +51,6 @@ except ImportError as ex:
core = DeferredError(ex) core = DeferredError(ex)
_UNSPECIFIED = object()
# FIXME: add support for pilfont2 format (see FontFile.py) # FIXME: add support for pilfont2 format (see FontFile.py)
# -------------------------------------------------------------------- # --------------------------------------------------------------------
@ -654,7 +651,6 @@ class FreeTypeFont:
self, self,
text, text,
mode="", mode="",
fill=_UNSPECIFIED,
direction=None, direction=None,
features=None, features=None,
language=None, language=None,
@ -680,12 +676,6 @@ class FreeTypeFont:
.. versionadded:: 1.1.5 .. versionadded:: 1.1.5
:param fill: Optional fill function. By default, an internal Pillow function
will be used.
Deprecated. This parameter will be removed in Pillow 10
(2023-07-01).
:param direction: Direction of the text. It can be 'rtl' (right to :param direction: Direction of the text. It can be 'rtl' (right to
left), 'ltr' (left to right) or 'ttb' (top to bottom). left), 'ltr' (left to right) or 'ttb' (top to bottom).
Requires libraqm. Requires libraqm.
@ -738,10 +728,6 @@ class FreeTypeFont:
:py:mod:`PIL.Image.core` interface module, and the text offset, the :py:mod:`PIL.Image.core` interface module, and the text offset, the
gap between the starting coordinate and the first marking gap between the starting coordinate and the first marking
""" """
if fill is _UNSPECIFIED:
fill = Image.core.fill
else:
deprecate("fill", 10)
size, offset = self.font.getsize( size, offset = self.font.getsize(
text, mode, direction, features, language, anchor text, mode, direction, features, language, anchor
) )
@ -750,7 +736,7 @@ class FreeTypeFont:
size = tuple(math.ceil(size[i] + stroke_width * 2 + start[i]) for i in range(2)) size = tuple(math.ceil(size[i] + stroke_width * 2 + start[i]) for i in range(2))
offset = offset[0] - stroke_width, offset[1] - stroke_width offset = offset[0] - stroke_width, offset[1] - stroke_width
Image._decompression_bomb_check(size) Image._decompression_bomb_check(size)
im = fill("RGBA" if mode == "RGBA" else "L", size, 0) im = Image.core.fill("RGBA" if mode == "RGBA" else "L", size, 0)
if min(size): if min(size):
self.font.render( self.font.render(
text, text,