fix prepended space in word wrap
This commit is contained in:
parent
b9bdbc5787
commit
74cb3c7b1e
|
@ -256,13 +256,15 @@ def get_wrapped_text_surface(font, text, width, antialias=True, color=(0, 0, 0),
|
||||||
lines.append(line)
|
lines.append(line)
|
||||||
line_text = ""
|
line_text = ""
|
||||||
else:
|
else:
|
||||||
line_text += " " + words[ii]
|
if ii > 0:
|
||||||
|
line_text += " "
|
||||||
|
line_text += words[ii]
|
||||||
ii += 1
|
ii += 1
|
||||||
font.set_italic(False)
|
font.set_italic(False)
|
||||||
top = 0
|
top = 0
|
||||||
surface = Surface((width, height), pygame.SRCALPHA)
|
surface = Surface((width, height), pygame.SRCALPHA)
|
||||||
if background:
|
# if background:
|
||||||
surface.fill(background)
|
# surface.fill(background)
|
||||||
rect = surface.get_rect()
|
rect = surface.get_rect()
|
||||||
for line in lines:
|
for line in lines:
|
||||||
line_rect = line.get_rect()
|
line_rect = line.get_rect()
|
||||||
|
|
Loading…
Reference in New Issue