[Change] Some more font tweaks.
This commit is contained in:
parent
bbf18f5a66
commit
69d3fb1825
23
src/font.c
23
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];
|
0 : bitmap.buffer[i + bitmap.width*j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create the GL texture. */
|
/* Create the GL texture. */
|
||||||
glBindTexture(GL_TEXTURE_2D, tex_base[(int)ch]);
|
glBindTexture(GL_TEXTURE_2D, tex_base[(int)ch]);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
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_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,
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_LUMINANCE_ALPHA,
|
||||||
GL_UNSIGNED_BYTE, expanded_data);
|
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 */
|
/* Corrects a spacing flaw between letters and */
|
||||||
/* downwards correction for letters like g or y. */
|
/* downwards correction for letters like g or y. */
|
||||||
glPushMatrix();
|
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. */
|
/* Take the opengl POT wrapping into account. */
|
||||||
x = (double)bitmap.width/(double)w;
|
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. */
|
/* Draw the texture mapped quad. */
|
||||||
glBindTexture(GL_TEXTURE_2D, tex_base[(int)ch]);
|
glBindTexture(GL_TEXTURE_2D, tex_base[(int)ch]);
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glTexCoord2d(0, 0);
|
glTexCoord2d(0., 0.);
|
||||||
glVertex2d(0, bitmap.rows);
|
glVertex2d(0., (double)bitmap.rows);
|
||||||
glTexCoord2d(x, 0);
|
glTexCoord2d(x, 0.);
|
||||||
glVertex2d(bitmap.width, bitmap.rows);
|
glVertex2d((double)bitmap.width, (double)bitmap.rows);
|
||||||
glTexCoord2d(x, y);
|
glTexCoord2d(x, y);
|
||||||
glVertex2d(bitmap.width, 0);
|
glVertex2d((double)bitmap.width, 0.);
|
||||||
glTexCoord2d(0, y);
|
glTexCoord2d(0., y);
|
||||||
glVertex2d(0, 0);
|
glVertex2d(0., 0.);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
glPopMatrix();
|
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;
|
width_base[(int)ch] = slot->advance.x >> 6;
|
||||||
|
|
||||||
/* End of the display list. */
|
/* End of the display list. */
|
||||||
|
Loading…
Reference in New Issue
Block a user