mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-10-27 22:21:33 +03:00
Rearranged code
This commit is contained in:
parent
4b90888a7d
commit
e90bb1559c
|
|
@ -130,7 +130,11 @@ class Text:
|
|||
|
||||
:return: Either width for horizontal text, or height for vertical text.
|
||||
"""
|
||||
if "\n" in self.text if isinstance(self.text, str) else b"\n" in self.text:
|
||||
if isinstance(self.text, str):
|
||||
multiline = "\n" in self.text
|
||||
else:
|
||||
multiline = b"\n" in self.text
|
||||
if multiline:
|
||||
msg = "can't measure length of multiline text"
|
||||
raise ValueError(msg)
|
||||
return self.font.getlength(
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user