From 56df18391487719df4e17762b57f39cbeb523d82 Mon Sep 17 00:00:00 2001 From: Allanis Date: Tue, 11 Mar 2014 22:29:34 +0000 Subject: [PATCH] [Change] Added round() in font system to try improving the quality of fonts. --- src/font.c | 11 +++++++---- src/lephisto.h | 2 +- src/toolkit.c | 8 ++++---- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/font.c b/src/font.c index 5dabf78..247b297 100644 --- a/src/font.c +++ b/src/font.c @@ -141,7 +141,8 @@ void gl_print(const glFont* ft_font, const double x, const double y, glMatrixMode(GL_MODELVIEW); 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.); 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. */ 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.); 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. */ 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.); 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. */ glPushMatrix(); /* Translation matrix. */ - glTranslated(x, y, 0); + glTranslated(round(x), round(y), 0); glCallLists(i, GL_UNSIGNED_BYTE, &txt[p]); /* The actual displaying. */ diff --git a/src/lephisto.h b/src/lephisto.h index f6004d8..89b65ab 100644 --- a/src/lephisto.h +++ b/src/lephisto.h @@ -19,7 +19,7 @@ #define pow2(x) ((x)*(x)) /**< ^2 */ -#define DATA_NAME "ldata" /**M Default data name. */ +#define DATA_NAME "ldata" /**< Default data name. */ #ifndef DATA_DEF #define DATA_DEF DATA_NAME /**< Default data packfile. */ diff --git a/src/toolkit.c b/src/toolkit.c index 74e86a4..74a5f2a 100644 --- a/src/toolkit.c +++ b/src/toolkit.c @@ -1132,13 +1132,13 @@ static void toolkit_renderText(Widget* txt, double bx, double by) { if(txt->dat.txt.centered) gl_printMid(txt->dat.txt.font, txt->w, - round(bx + (double)SCREEN_W/2. + txt->x), - round(by + (double)SCREEN_H/2. + txt->y), + bx + (double)SCREEN_W/2. + txt->x, + by + (double)SCREEN_H/2. + txt->y, txt->dat.txt.colour, txt->dat.txt.text); else gl_printText(txt->dat.txt.font, txt->w, txt->h, - round(bx + (double)SCREEN_W/2. + txt->x), - round(by + (double)SCREEN_H/2. + txt->y), + bx + (double)SCREEN_W/2. + txt->x, + by + (double)SCREEN_H/2. + txt->y, txt->dat.txt.colour, txt->dat.txt.text); }