Skip to content

Commit e90bb15

Browse files
committed
Rearranged code
1 parent 4b90888 commit e90bb15

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/PIL/ImageText.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,11 @@ def get_length(self) -> float:
130130
131131
:return: Either width for horizontal text, or height for vertical text.
132132
"""
133-
if "\n" in self.text if isinstance(self.text, str) else b"\n" in self.text:
133+
if isinstance(self.text, str):
134+
multiline = "\n" in self.text
135+
else:
136+
multiline = b"\n" in self.text
137+
if multiline:
134138
msg = "can't measure length of multiline text"
135139
raise ValueError(msg)
136140
return self.font.getlength(

0 commit comments

Comments
 (0)