Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documented deprecation in individual methods #17

Merged
merged 1 commit into from
Jun 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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