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:
parent
bf8435bf81
commit
1f05aa7f21
@ -1082,6 +1082,8 @@ int drawtextwrap(pixel *vid, int x, int y, int w, const char *s, int r, int g, i
|
||||
rw = 0;
|
||||
y+=FONT_H+2;
|
||||
rh+=FONT_H+2;
|
||||
if (*s==' ')
|
||||
continue;
|
||||
}
|
||||
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;
|
||||
y += FONT_H+2;
|
||||
if (*s==' ')
|
||||
continue;
|
||||
}
|
||||
n--;
|
||||
}
|
||||
@ -1236,6 +1240,8 @@ int textposxy(char *s, int width, int w, int h)
|
||||
if (x>=width) {
|
||||
x = 0;
|
||||
y += FONT_H+2;
|
||||
if (*s==' ')
|
||||
continue;
|
||||
}
|
||||
n++;
|
||||
}
|
||||
@ -1274,6 +1280,8 @@ int textwrapheight(char *s, int width)
|
||||
{
|
||||
x = 0;
|
||||
height += FONT_H+2;
|
||||
if (*s==' ')
|
||||
continue;
|
||||
}
|
||||
x += cw;
|
||||
}
|
||||
|
Reference in New Issue
Block a user