You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Previously, the ``size`` methods returned a ``height`` that included the vertical
256
+
offset of the text, while the new ``bbox`` methods distinguish this as a ``top``
257
+
offset.
258
+
259
+
.. image:: ./example/size_vs_bbox.png
260
+
:alt:In bbox methods, top measures the vertical distance above the text, while bottom measures that plus the vertical distance of the text itself. In size methods, height also measures the vertical distance above the text plus the vertical distance of the text itself.
261
+
:align:center
262
+
263
+
If you are using these methods for aligning text, consider using :ref:`text-anchors` instead
264
+
which avoid issues that can occur with non-English text or unusual fonts.
265
+
For example, instead of the following code::
266
+
267
+
from PIL import Image, ImageDraw, ImageFont
268
+
269
+
font = ImageFont.truetype("Tests/fonts/FreeMono.ttf")
Previously, the ``size`` methods returned a ``height`` that included the vertical
93
+
offset of the text, while the new ``bbox`` methods distinguish this as a ``top``
94
+
offset.
95
+
96
+
.. image:: ../example/size_vs_bbox.png
97
+
:alt:In bbox methods, top measures the vertical distance above the text, while bottom measures that plus the vertical distance of the text itself. In size methods, height also measures the vertical distance above the text plus the vertical distance of the text itself.
98
+
:align:center
99
+
100
+
If you are using these methods for aligning text, consider using :ref:`text-anchors` instead
101
+
which avoid issues that can occur with non-English text or unusual fonts.
102
+
For example, instead of the following code::
103
+
104
+
from PIL import Image, ImageDraw, ImageFont
105
+
106
+
font = ImageFont.truetype("Tests/fonts/FreeMono.ttf")
0 commit comments