added border between font letters to avoid rendering artifacts

This commit is contained in:
Zeno Rogue 2021-03-07 21:12:12 +01:00
parent 0ceddf03a0
commit 69f16c45b1
1 changed files with 6 additions and 2 deletions

View File

@ -436,7 +436,7 @@ void sdltogl(SDL_Surface *txt, glfont_t& f, int ch) {
int otheight = txt->h;
#endif
if(otwidth+curx > FONTTEXTURESIZE) curx = 0, cury += theight, theight = 0;
if(otwidth+curx+1 > FONTTEXTURESIZE) curx = 0, cury += theight+1, theight = 0;
theight = max(theight, otheight);
@ -458,7 +458,7 @@ void sdltogl(SDL_Surface *txt, glfont_t& f, int ch) {
c.tx1 = (float) (curx+otwidth) / (float) FONTTEXTURESIZE;
c.ty0 = (float) cury;
c.ty1 = (float) (cury+otheight);
curx += otwidth;
curx += otwidth+1;
}
EX void init_glfont(int size) {
@ -486,6 +486,10 @@ EX void init_glfont(int size) {
white.r = white.g = white.b = 255;
#endif
for(int y=0; y<FONTTEXTURESIZE; y++)
for(int x=0; x<FONTTEXTURESIZE; x++)
fontdata[y][x] = 0;
#if CAP_TABFONT
resetTabFont();
#endif