mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-04-27 12:33:41 +03:00
Preserve line spacing backwards compatibility
This commit is contained in:
parent
fa6cd4a195
commit
bc0bf5efea
Binary file not shown.
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
|
@ -1220,8 +1220,8 @@ def test_textbbox_stroke():
|
||||||
# Act / Assert
|
# Act / Assert
|
||||||
assert draw.textbbox((2, 2), "A", font, stroke_width=2) == (0, 4, 16, 20)
|
assert draw.textbbox((2, 2), "A", font, stroke_width=2) == (0, 4, 16, 20)
|
||||||
assert draw.textbbox((2, 2), "A", font, stroke_width=4) == (-2, 2, 18, 22)
|
assert draw.textbbox((2, 2), "A", font, stroke_width=4) == (-2, 2, 18, 22)
|
||||||
assert draw.textbbox((2, 2), "ABC\nAaaa", font, stroke_width=2) == (0, 4, 52, 42)
|
assert draw.textbbox((2, 2), "ABC\nAaaa", font, stroke_width=2) == (0, 4, 52, 44)
|
||||||
assert draw.textbbox((2, 2), "ABC\nAaaa", font, stroke_width=4) == (-2, 2, 54, 46)
|
assert draw.textbbox((2, 2), "ABC\nAaaa", font, stroke_width=4) == (-2, 2, 54, 50)
|
||||||
|
|
||||||
|
|
||||||
@skip_unless_feature("freetype2")
|
@skip_unless_feature("freetype2")
|
||||||
|
|
|
@ -431,7 +431,11 @@ class ImageDraw:
|
||||||
return text.split(split_character)
|
return text.split(split_character)
|
||||||
|
|
||||||
def _multiline_spacing(self, font, spacing, stroke_width):
|
def _multiline_spacing(self, font, spacing, stroke_width):
|
||||||
return self.textbbox((0, 0), "A", font, stroke_width=stroke_width)[3] + spacing
|
return (
|
||||||
|
self.textbbox((0, 0), "A", font, stroke_width=stroke_width)[3]
|
||||||
|
+ stroke_width
|
||||||
|
+ spacing
|
||||||
|
)
|
||||||
|
|
||||||
def text(
|
def text(
|
||||||
self,
|
self,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user