[Change] Added round() in font system to try improving the quality of
fonts.
This commit is contained in:
parent
9b60974891
commit
56df183914
11
src/font.c
11
src/font.c
@ -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. */
|
||||||
|
|
||||||
|
@ -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. */
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user