From 69d3fb1825ae2d208650eab8e90f2c9cfe3b77b2 Mon Sep 17 00:00:00 2001 From: Allanis Date: Sat, 8 Mar 2014 01:54:23 +0000 Subject: [PATCH] [Change] Some more font tweaks. --- src/font.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/font.c b/src/font.c index b1eb38f..9d70d38 100644 --- a/src/font.c +++ b/src/font.c @@ -457,10 +457,13 @@ static void glFontMakeDList(FT_Face face, char ch, GLuint list_base, 0 : bitmap.buffer[i + bitmap.width*j]; } } + /* Create the GL texture. */ glBindTexture(GL_TEXTURE_2D, tex_base[(int)ch]); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, expanded_data); @@ -472,7 +475,7 @@ static void glFontMakeDList(FT_Face face, char ch, GLuint list_base, /* Corrects a spacing flaw between letters and */ /* downwards correction for letters like g or y. */ glPushMatrix(); - glTranslated(slot->bitmap_left, slot->bitmap_top - bitmap.rows, 0); + glTranslated((double)slot->bitmap_left, (double)(slot->bitmap_top-bitmap.rows), 0); /* Take the opengl POT wrapping into account. */ x = (double)bitmap.width/(double)w; @@ -481,18 +484,18 @@ static void glFontMakeDList(FT_Face face, char ch, GLuint list_base, /* Draw the texture mapped quad. */ glBindTexture(GL_TEXTURE_2D, tex_base[(int)ch]); glBegin(GL_QUADS); - glTexCoord2d(0, 0); - glVertex2d(0, bitmap.rows); - glTexCoord2d(x, 0); - glVertex2d(bitmap.width, bitmap.rows); - glTexCoord2d(x, y); - glVertex2d(bitmap.width, 0); - glTexCoord2d(0, y); - glVertex2d(0, 0); + glTexCoord2d(0., 0.); + glVertex2d(0., (double)bitmap.rows); + glTexCoord2d(x, 0.); + glVertex2d((double)bitmap.width, (double)bitmap.rows); + glTexCoord2d(x, y); + glVertex2d((double)bitmap.width, 0.); + glTexCoord2d(0., y); + glVertex2d(0., 0.); glEnd(); glPopMatrix(); - glTranslated(slot->advance.x >> 6, slot->advance.y >> 6, 0); + glTranslated((double)(slot->advance.x >> 6), (double)(slot->advance.y >> 6), 0); width_base[(int)ch] = slot->advance.x >> 6; /* End of the display list. */