mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-10-28 14:41:07 +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.
|
: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"
|
msg = "can't measure length of multiline text"
|
||||||
raise ValueError(msg)
|
raise ValueError(msg)
|
||||||
return self.font.getlength(
|
return self.font.getlength(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user