Skip to content

Commit ad5271d

Browse files
committed
Document replacements for individual deprecated font methods
1 parent 65020e7 commit ad5271d

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

docs/reference/ImageDraw.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -437,13 +437,12 @@ Methods
437437
.. py:method:: ImageDraw.textsize(text, font=None, spacing=4, direction=None, features=None, language=None, stroke_width=0)
438438
439439
.. deprecated:: 9.2.0
440+
Use :py:meth:`textlength()` to measure the offset of following text with
441+
1/64 pixel precision.
442+
Use :py:meth:`textbbox()` to get the exact bounding box based on an anchor.
440443

441444
Return the size of the given string, in pixels.
442445

443-
Use :py:meth:`textlength()` to measure the offset of following text with
444-
1/64 pixel precision.
445-
Use :py:meth:`textbbox()` to get the exact bounding box based on an anchor.
446-
447446
.. note:: For historical reasons this function measures text height from
448447
the ascender line instead of the top, see :ref:`text-anchors`.
449448
If you wish to measure text height from the top, it is recommended
@@ -487,6 +486,7 @@ Methods
487486
.. py:method:: ImageDraw.multiline_textsize(text, font=None, spacing=4, direction=None, features=None, language=None, stroke_width=0)
488487
489488
.. deprecated:: 9.2.0
489+
Use :py:meth:`.multiline_textbbox` instead.
490490

491491
Return the size of the given string, in pixels.
492492

src/PIL/ImageFont.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ def _load_pilfont_data(self, file, image):
138138
def getsize(self, text, *args, **kwargs):
139139
"""
140140
.. deprecated:: 9.2.0
141+
Use :py:meth:`.getbbox` or :py:meth:`.getlength` instead.
141142
142143
Returns width and height (in pixels) of given text.
143144
@@ -427,14 +428,13 @@ def getsize(
427428
):
428429
"""
429430
.. deprecated:: 9.2.0
431+
Use :py:meth:`getlength()` to measure the offset of following text with
432+
1/64 pixel precision.
433+
Use :py:meth:`getbbox()` to get the exact bounding box based on an anchor.
430434
431435
Returns width and height (in pixels) of given text if rendered in font with
432436
provided direction, features, and language.
433437
434-
Use :py:meth:`getlength()` to measure the offset of following text with
435-
1/64 pixel precision.
436-
Use :py:meth:`getbbox()` to get the exact bounding box based on an anchor.
437-
438438
.. note:: For historical reasons this function measures text height from
439439
the ascender line instead of the top, see :ref:`text-anchors`.
440440
If you wish to measure text height from the top, it is recommended
@@ -498,6 +498,7 @@ def getsize_multiline(
498498
):
499499
"""
500500
.. deprecated:: 9.2.0
501+
Use :py:meth:`.ImageDraw.multiline_textbbox` instead.
501502
502503
Returns width and height (in pixels) of given text if rendered in font
503504
with provided direction, features, and language, while respecting
@@ -555,6 +556,7 @@ def getsize_multiline(
555556
def getoffset(self, text):
556557
"""
557558
.. deprecated:: 9.2.0
559+
Use :py:meth:`.getbbox` instead.
558560
559561
Returns the offset of given text. This is the gap between the
560562
starting coordinate and the first marking. Note that this gap is
@@ -847,6 +849,7 @@ def __init__(self, font, orientation=None):
847849
def getsize(self, text, *args, **kwargs):
848850
"""
849851
.. deprecated:: 9.2.0
852+
Use :py:meth:`.getbbox` or :py:meth:`.getlength` instead.
850853
"""
851854
if not kwargs.get("__internal__"):
852855
deprecate("getsize", 10, "getbbox or getlength")

0 commit comments

Comments
 (0)