mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 17:24:31 +03:00
Allowed text method to pass on multiline_text method specific arguments
This commit is contained in:
parent
f57e295ce5
commit
89e3758fb8
|
@ -241,9 +241,9 @@ class ImageDraw(object):
|
|||
|
||||
return text.split(split_character)
|
||||
|
||||
def text(self, xy, text, fill=None, font=None, anchor=None):
|
||||
def text(self, xy, text, fill=None, font=None, anchor=None, *args, **kwargs):
|
||||
if self._multiline_check(text):
|
||||
return self.multiline_text(xy, text, fill, font, anchor)
|
||||
return self.multiline_text(xy, text, fill, font, anchor, *args, **kwargs)
|
||||
|
||||
ink, fill = self._getink(fill)
|
||||
if font is None:
|
||||
|
|
|
@ -159,12 +159,20 @@ try:
|
|||
|
||||
self.assert_image_similar(im, target_img, .5)
|
||||
|
||||
# Test that text() can pass on additional arguments
|
||||
# to multiline_text()
|
||||
draw.text((0, 0), TEST_TEXT, fill=None, font=ttf, anchor=None,
|
||||
spacing=4, align="left")
|
||||
draw.text((0, 0), TEST_TEXT, None, ttf, None, 4, "left")
|
||||
del draw
|
||||
|
||||
# Test align center and right
|
||||
for align, ext in {"center": "_center",
|
||||
"right": "_right"}.items():
|
||||
im = Image.new(mode='RGB', size=(300, 100))
|
||||
draw = ImageDraw.Draw(im)
|
||||
draw.multiline_text((0, 0), TEST_TEXT, font=ttf, align=align)
|
||||
del draw
|
||||
|
||||
target = 'Tests/images/multiline_text'+ext+'.png'
|
||||
target_img = Image.open(target)
|
||||
|
|
Loading…
Reference in New Issue
Block a user