X-Git-Url: https://jasonwoof.com/gitweb/?p=vor.git;a=blobdiff_plain;f=SFont.c;h=e5d78632bea00014909b9114933bac158e06caaa;hp=e03be40c0c73838639d282f80a3c3d97b013c578;hb=a2af96e68b210b7c3db90b7ec474498c5611a3a7;hpb=dfbd909f8f87040e9c19f45462b216f4fc5739d7 diff --git a/SFont.c b/SFont.c index e03be40..e5d7863 100644 --- a/SFont.c +++ b/SFont.c @@ -1,4 +1,5 @@ #include +#include #include "SFont.h" #include "string.h" @@ -83,12 +84,11 @@ int SFont_wide(char *text) { while (text[i]) { if (text[i]==' ') { xwide += (int)(Font->CharPos[2]-Font->CharPos[1]); - } - else { - ofs = (text[i]-33)*2+1; + } else { + ofs = (text[i]-33)*2+1; xwide += (int)(Font->CharPos[ofs+1]-Font->CharPos[ofs]); - } - i++; + } + i++; } return xwide; } @@ -156,14 +156,12 @@ int TextWidth2(SFont_FontInfo *Font, char *text) unsigned char ofs = 0; while (text[i]!='\0') { if (text[i]==' ') { - x+=Font->CharPos[2]-Font->CharPos[1]; - i++; - } - else { - ofs=(text[i]-33)*2+1; - x+=Font->CharPos[ofs+1]-Font->CharPos[ofs]; - i++; - } + x+=Font->CharPos[2]-Font->CharPos[1]; + } else { + ofs=(text[i]-33)*2+1; + x+=Font->CharPos[ofs+1]-Font->CharPos[ofs]; + } + i++; } return x+Font->CharPos[ofs+2]-Font->CharPos[ofs+1]; }