fix prepended space in word wrap

This commit is contained in:
Frank DeMarco 2020-05-28 05:19:23 -04:00
parent b9bdbc5787
commit 74cb3c7b1e
1 changed files with 5 additions and 3 deletions

View File

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