Documented deprecation in individual methods

This commit is contained in:
Andrew Murray 2022-06-30 22:40:40 +10:00 committed by Ondrej Baranovič
parent 7691231aa7
commit 65020e7c7c
3 changed files with 17 additions and 0 deletions

View File

@ -436,6 +436,8 @@ Methods
.. py:method:: ImageDraw.textsize(text, font=None, spacing=4, direction=None, features=None, language=None, stroke_width=0) .. py:method:: ImageDraw.textsize(text, font=None, spacing=4, direction=None, features=None, language=None, stroke_width=0)
.. deprecated:: 9.2.0
Return the size of the given string, in pixels. Return the size of the given string, in pixels.
Use :py:meth:`textlength()` to measure the offset of following text with Use :py:meth:`textlength()` to measure the offset of following text with
@ -484,6 +486,8 @@ Methods
.. py:method:: ImageDraw.multiline_textsize(text, font=None, spacing=4, direction=None, features=None, language=None, stroke_width=0) .. py:method:: ImageDraw.multiline_textsize(text, font=None, spacing=4, direction=None, features=None, language=None, stroke_width=0)
.. deprecated:: 9.2.0
Return the size of the given string, in pixels. Return the size of the given string, in pixels.
Use :py:meth:`textlength()` to measure the offset of following text with Use :py:meth:`textlength()` to measure the offset of following text with

View File

@ -173,6 +173,8 @@ class Draw:
def textsize(self, text, font): def textsize(self, text, font):
""" """
.. deprecated:: 9.2.0
Return the size of the given string, in pixels. Return the size of the given string, in pixels.
.. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.textsize` .. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.textsize`

View File

@ -137,6 +137,8 @@ class ImageFont:
def getsize(self, text, *args, **kwargs): def getsize(self, text, *args, **kwargs):
""" """
.. deprecated:: 9.2.0
Returns width and height (in pixels) of given text. Returns width and height (in pixels) of given text.
:param text: Text to measure. :param text: Text to measure.
@ -424,6 +426,8 @@ class FreeTypeFont:
__internal__=False, __internal__=False,
): ):
""" """
.. deprecated:: 9.2.0
Returns width and height (in pixels) of given text if rendered in font with Returns width and height (in pixels) of given text if rendered in font with
provided direction, features, and language. provided direction, features, and language.
@ -493,6 +497,8 @@ class FreeTypeFont:
stroke_width=0, stroke_width=0,
): ):
""" """
.. deprecated:: 9.2.0
Returns width and height (in pixels) of given text if rendered in font Returns width and height (in pixels) of given text if rendered in font
with provided direction, features, and language, while respecting with provided direction, features, and language, while respecting
newline characters. newline characters.
@ -548,6 +554,8 @@ class FreeTypeFont:
def getoffset(self, text): def getoffset(self, text):
""" """
.. deprecated:: 9.2.0
Returns the offset of given text. This is the gap between the Returns the offset of given text. This is the gap between the
starting coordinate and the first marking. Note that this gap is starting coordinate and the first marking. Note that this gap is
included in the result of :py:func:`~PIL.ImageFont.FreeTypeFont.getsize`. included in the result of :py:func:`~PIL.ImageFont.FreeTypeFont.getsize`.
@ -837,6 +845,9 @@ class TransposedFont:
self.orientation = orientation # any 'transpose' argument, or None self.orientation = orientation # any 'transpose' argument, or None
def getsize(self, text, *args, **kwargs): def getsize(self, text, *args, **kwargs):
"""
.. deprecated:: 9.2.0
"""
if not kwargs.get("__internal__"): if not kwargs.get("__internal__"):
deprecate("getsize", 10, "getbbox or getlength") deprecate("getsize", 10, "getbbox or getlength")
try: try: