From bdc5a71e8a7e227a7b3c36f16e957d350b467da5 Mon Sep 17 00:00:00 2001 From: kijai <40791699+kijai@users.noreply.github.com> Date: Sun, 7 Apr 2024 16:03:48 +0300 Subject: [PATCH] Update nodes.py --- nodes.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/nodes.py b/nodes.py index 29082c1..677b5e0 100644 --- a/nodes.py +++ b/nodes.py @@ -744,12 +744,10 @@ creates animation between them. try: #new pillow # Iterate through words to create lines for word in words: - left, _, right, _ = font.getbbox(word) - font_width = right - left - word_width = font_width * len(word) # Assuming each character is the same width + word_width = font.getbbox(word)[2] if current_line_width + word_width <= width - 2 * text_x: current_line.append(word) - current_line_width += word_width + font_width # Add space width + current_line_width += word_width + font.getbbox(" ")[2] # Add space width else: lines.append(" ".join(current_line)) current_line = [word]