[Change] Added round() in font system to try improving the quality of

fonts.
This commit is contained in:
Allanis 2014-03-11 22:29:34 +00:00
parent 9b60974891
commit 56df183914
3 changed files with 12 additions and 9 deletions

View File

@ -141,7 +141,8 @@ void gl_print(const glFont* ft_font, const double x, const double y,
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glPushMatrix(); /* Translation matrix. */ glPushMatrix(); /* Translation matrix. */
glTranslated(x - (double)SCREEN_W/2., y - (double)SCREEN_H/2., 0); glTranslated(round(x - (double)SCREEN_W/2.),
round(y - (double)SCREEN_H/2.), 0);
if(c == NULL) glColor4d(1., 1., 1., 1.); if(c == NULL) glColor4d(1., 1., 1., 1.);
else COLOUR(*c); else COLOUR(*c);
@ -193,7 +194,8 @@ int gl_printMax(const glFont* ft_font, const int max,
glMatrixMode(GL_MODELVIEW); /* Projection gets full fast using modelview. */ glMatrixMode(GL_MODELVIEW); /* Projection gets full fast using modelview. */
glPushMatrix(); /* Translation matrix. */ glPushMatrix(); /* Translation matrix. */
glTranslated(x - (double)SCREEN_W/2., y - (double)SCREEN_H/2., 0); glTranslated(round(x - (double)SCREEN_W/2.),
round(y - (double)SCREEN_H/2.), 0);
if(c == NULL) glColor4d(1., 1., 1., 1.); if(c == NULL) glColor4d(1., 1., 1., 1.);
else COLOUR(*c); else COLOUR(*c);
@ -253,7 +255,8 @@ int gl_printMid(const glFont* ft_font, const int width, double x, const double y
glMatrixMode(GL_MODELVIEW); /* Projection gets full fast using modelview. */ glMatrixMode(GL_MODELVIEW); /* Projection gets full fast using modelview. */
glPushMatrix(); /* Translation matrix. */ glPushMatrix(); /* Translation matrix. */
glTranslated(x - (double)SCREEN_W/2., y - (double)SCREEN_H/2., 0); glTranslated(round(x - (double)SCREEN_W/2.),
round(y - (double)SCREEN_H/2.), 0);
if(c == NULL) glColor4d(1., 1., 1., 1.); if(c == NULL) glColor4d(1., 1., 1., 1.);
else COLOUR(*c); else COLOUR(*c);
@ -318,7 +321,7 @@ int gl_printText(const glFont* ft_font, const int width, const int height,
glMatrixMode(GL_MODELVIEW); /* Using MODELVIEW, PROJECTION gets full fast. */ glMatrixMode(GL_MODELVIEW); /* Using MODELVIEW, PROJECTION gets full fast. */
glPushMatrix(); /* Translation matrix. */ glPushMatrix(); /* Translation matrix. */
glTranslated(x, y, 0); glTranslated(round(x), round(y), 0);
glCallLists(i, GL_UNSIGNED_BYTE, &txt[p]); /* The actual displaying. */ glCallLists(i, GL_UNSIGNED_BYTE, &txt[p]); /* The actual displaying. */

View File

@ -19,7 +19,7 @@
#define pow2(x) ((x)*(x)) /**< ^2 */ #define pow2(x) ((x)*(x)) /**< ^2 */
#define DATA_NAME "ldata" /**M Default data name. */ #define DATA_NAME "ldata" /**< Default data name. */
#ifndef DATA_DEF #ifndef DATA_DEF
#define DATA_DEF DATA_NAME /**< Default data packfile. */ #define DATA_DEF DATA_NAME /**< Default data packfile. */

View File

@ -1132,13 +1132,13 @@ static void toolkit_renderText(Widget* txt, double bx, double by) {
if(txt->dat.txt.centered) if(txt->dat.txt.centered)
gl_printMid(txt->dat.txt.font, txt->w, gl_printMid(txt->dat.txt.font, txt->w,
round(bx + (double)SCREEN_W/2. + txt->x), bx + (double)SCREEN_W/2. + txt->x,
round(by + (double)SCREEN_H/2. + txt->y), by + (double)SCREEN_H/2. + txt->y,
txt->dat.txt.colour, txt->dat.txt.text); txt->dat.txt.colour, txt->dat.txt.text);
else else
gl_printText(txt->dat.txt.font, txt->w, txt->h, gl_printText(txt->dat.txt.font, txt->w, txt->h,
round(bx + (double)SCREEN_W/2. + txt->x), bx + (double)SCREEN_W/2. + txt->x,
round(by + (double)SCREEN_H/2. + txt->y), by + (double)SCREEN_H/2. + txt->y,
txt->dat.txt.colour, txt->dat.txt.text); txt->dat.txt.colour, txt->dat.txt.text);
} }