Skip to content

Commit

Permalink
Documented deprecation in individual methods
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere authored and nulano committed Jun 30, 2022
1 parent 7691231 commit 65020e7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/reference/ImageDraw.rst
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,8 @@ Methods

.. 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.

Use :py:meth:`textlength()` to measure the offset of following text with
Expand Down Expand Up @@ -484,6 +486,8 @@ Methods

.. 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.

Use :py:meth:`textlength()` to measure the offset of following text with
Expand Down
2 changes: 2 additions & 0 deletions src/PIL/ImageDraw2.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ def text(self, xy, text, font):

def textsize(self, text, font):
"""
.. deprecated:: 9.2.0
Return the size of the given string, in pixels.
.. seealso:: :py:meth:`PIL.ImageDraw.ImageDraw.textsize`
Expand Down
11 changes: 11 additions & 0 deletions src/PIL/ImageFont.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ def _load_pilfont_data(self, file, image):

def getsize(self, text, *args, **kwargs):
"""
.. deprecated:: 9.2.0
Returns width and height (in pixels) of given text.
:param text: Text to measure.
Expand Down Expand Up @@ -424,6 +426,8 @@ def getsize(
__internal__=False,
):
"""
.. deprecated:: 9.2.0
Returns width and height (in pixels) of given text if rendered in font with
provided direction, features, and language.
Expand Down Expand Up @@ -493,6 +497,8 @@ def getsize_multiline(
stroke_width=0,
):
"""
.. deprecated:: 9.2.0
Returns width and height (in pixels) of given text if rendered in font
with provided direction, features, and language, while respecting
newline characters.
Expand Down Expand Up @@ -548,6 +554,8 @@ def getsize_multiline(

def getoffset(self, text):
"""
.. deprecated:: 9.2.0
Returns the offset of given text. This is the gap between the
starting coordinate and the first marking. Note that this gap is
included in the result of :py:func:`~PIL.ImageFont.FreeTypeFont.getsize`.
Expand Down Expand Up @@ -837,6 +845,9 @@ def __init__(self, font, orientation=None):
self.orientation = orientation # any 'transpose' argument, or None

def getsize(self, text, *args, **kwargs):
"""
.. deprecated:: 9.2.0
"""
if not kwargs.get("__internal__"):
deprecate("getsize", 10, "getbbox or getlength")
try:
Expand Down

0 comments on commit 65020e7

Please sign in to comment.