From d12519a6b62ba938a67b896072c6f73d6bb222f3 Mon Sep 17 00:00:00 2001 From: Open Source Contributor Date: Tue, 5 May 2026 16:21:01 -0600 Subject: [PATCH] Fix multiline text line height calculation The line spacing calculation was using only 'A' which doesn't account for characters that extend below the baseline (like 'p', 'g', 'y'). Using string.ascii_letters ensures we measure the full font height. Fixes #1646 --- src/PIL/ImageText.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/PIL/ImageText.py b/src/PIL/ImageText.py index 008d20d38e1..3251958476a 100644 --- a/src/PIL/ImageText.py +++ b/src/PIL/ImageText.py @@ -2,6 +2,7 @@ import math import re +import string from typing import AnyStr, Generic, NamedTuple from . import ImageFont @@ -353,7 +354,7 @@ def _split( fontmode = self._get_fontmode() line_spacing = ( self.font.getbbox( - "A", + string.ascii_letters, fontmode, None, self.features,