mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Merge pull request #3114 from tianyu139/hotfix
Fixed bug in ImageDraw.multiline_textsize()
This commit is contained in:
commit
abae745da1
|
@ -231,6 +231,11 @@ class TestImageFont(PillowTestCase):
|
|||
self.assertEqual(draw.textsize(TEST_TEXT, font=ttf),
|
||||
draw.multiline_textsize(TEST_TEXT, font=ttf))
|
||||
|
||||
# Test that multiline_textsize corresponds to ImageFont.textsize()
|
||||
# for single line text
|
||||
self.assertEqual(ttf.getsize('A'),
|
||||
draw.multiline_textsize('A', font=ttf))
|
||||
|
||||
# Test that textsize() can pass on additional arguments
|
||||
# to multiline_textsize()
|
||||
draw.textsize(TEST_TEXT, font=ttf, spacing=4)
|
||||
|
|
|
@ -271,7 +271,7 @@ class ImageDraw(object):
|
|||
line_width, line_height = self.textsize(line, font, spacing,
|
||||
direction, features)
|
||||
max_width = max(max_width, line_width)
|
||||
return max_width, len(lines)*line_spacing
|
||||
return max_width, len(lines)*line_spacing - spacing
|
||||
|
||||
|
||||
def Draw(im, mode=None):
|
||||
|
|
Loading…
Reference in New Issue
Block a user