From 74cb3c7b1eed0b71185ea0aeda195839c8af78cf Mon Sep 17 00:00:00 2001 From: Frank DeMarco Date: Thu, 28 May 2020 05:19:23 -0400 Subject: [PATCH] fix prepended space in word wrap --- pgfw/extension.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pgfw/extension.py b/pgfw/extension.py index 8e13027..69c864e 100644 --- a/pgfw/extension.py +++ b/pgfw/extension.py @@ -256,13 +256,15 @@ def get_wrapped_text_surface(font, text, width, antialias=True, color=(0, 0, 0), lines.append(line) line_text = "" else: - line_text += " " + words[ii] + if ii > 0: + line_text += " " + line_text += words[ii] ii += 1 font.set_italic(False) top = 0 surface = Surface((width, height), pygame.SRCALPHA) - if background: - surface.fill(background) + # if background: + # surface.fill(background) rect = surface.get_rect() for line in lines: line_rect = line.get_rect()