Minor improvement to text wrapping

When text flows onto a new line, don't put the space between words at
the start of the new line.
This commit is contained in:
jacksonmj 2012-06-14 01:04:47 +01:00
parent bf8435bf81
commit 1f05aa7f21

View File

@ -1082,6 +1082,8 @@ int drawtextwrap(pixel *vid, int x, int y, int w, const char *s, int r, int g, i
rw = 0; rw = 0;
y+=FONT_H+2; y+=FONT_H+2;
rh+=FONT_H+2; rh+=FONT_H+2;
if (*s==' ')
continue;
} }
x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a); x = drawchar(vid, x, y, *(unsigned char *)s, r, g, b, a);
} }
@ -1194,6 +1196,8 @@ void textnpos(char *s, int n, int w, int *cx, int *cy)
{ {
x = 0; x = 0;
y += FONT_H+2; y += FONT_H+2;
if (*s==' ')
continue;
} }
n--; n--;
} }
@ -1236,6 +1240,8 @@ int textposxy(char *s, int width, int w, int h)
if (x>=width) { if (x>=width) {
x = 0; x = 0;
y += FONT_H+2; y += FONT_H+2;
if (*s==' ')
continue;
} }
n++; n++;
} }
@ -1274,6 +1280,8 @@ int textwrapheight(char *s, int width)
{ {
x = 0; x = 0;
height += FONT_H+2; height += FONT_H+2;
if (*s==' ')
continue;
} }
x += cw; x += cw;
} }