From 3aa718002caebbc82ad2f4177b5c82d51583f209 Mon Sep 17 00:00:00 2001 From: allo Date: Tue, 8 Apr 2014 19:16:22 +0200 Subject: [PATCH] changed multiline text spacing from pixels to em the spacing is now a float, which will be multiplied with the width of a letter "m" in the chosen font. --- PIL/ImageDraw.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PIL/ImageDraw.py b/PIL/ImageDraw.py index 193e3a7a6..c2417589e 100644 --- a/PIL/ImageDraw.py +++ b/PIL/ImageDraw.py @@ -279,6 +279,10 @@ class ImageDraw: spacing=0, align="left"): widths, heights = [], [] max_width = 0 + # spacing in em (multiples of the width of a "m") + if spacing != 0: + m_width, m_height = self.textsize("m", font) + spacing = float(spacing) * m_width lines = text.split("\n") for line in lines: line_width, line_height = self.textsize(line, font)