mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-05 04:50:09 +03:00
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.
This commit is contained in:
parent
6a58a1c93e
commit
3aa718002c
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user