Rearranged code

This commit is contained in:
Andrew Murray 2025-10-20 21:00:29 +11:00
parent 4b90888a7d
commit e90bb1559c

View File

@ -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(