diff --git a/PIL/ImageDraw.py b/PIL/ImageDraw.py index f5b72efb7..21b2cbb87 100644 --- a/PIL/ImageDraw.py +++ b/PIL/ImageDraw.py @@ -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: diff --git a/Tests/test_imagefont.py b/Tests/test_imagefont.py index a64eb68ef..1f4621362 100644 --- a/Tests/test_imagefont.py +++ b/Tests/test_imagefont.py @@ -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)