mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
Fixed some bugs with font drawing and reverted the display list change - it was causing problems with multiple fonts
This commit is contained in:
@@ -126,8 +126,8 @@ namespace font
|
||||
int pw = next_p2(w);
|
||||
int ph = next_p2(h);
|
||||
unsigned char * d = new unsigned char[pw * ph * (format == GlyphData::FORMAT_LUMINOSITY_ALPHA ? 2 : 4)];
|
||||
for (int i = 0; i < pw; i++) {
|
||||
for (int j = 0; j < ph; j++) {
|
||||
for (int j = 0; j < ph; j++) {
|
||||
for (int i = 0; i < pw; i++) {
|
||||
int n = i+j*w;
|
||||
int p = i+j*pw;
|
||||
if (i < w && j < h) {
|
||||
|
||||
@@ -38,10 +38,7 @@ namespace opengl
|
||||
for(unsigned int i = 0; i < MAX_CHARS; i++)
|
||||
{
|
||||
glyphs[i] = new Glyph(data->getGlyphData(i));
|
||||
glyphs[i]->load();
|
||||
glNewList(list + i, GL_COMPILE);
|
||||
glyphs[i]->draw(0, 0, 0, 1, 1, 0, 0);
|
||||
glEndList();
|
||||
glyphs[i]->load();
|
||||
widths[i] = data->getGlyphData(i)->getWidth();
|
||||
spacing[i] = data->getGlyphData(i)->getAdvance();
|
||||
bearingX[i] = data->getGlyphData(i)->getBearingX();
|
||||
@@ -71,16 +68,14 @@ namespace opengl
|
||||
glTranslatef(ceil(x), ceil(y), 0.0f);
|
||||
glRotatef(LOVE_TODEG(angle), 0, 0, 1.0f);
|
||||
glScalef(sx, sy, 1.0f);
|
||||
int first = (int)text[0];
|
||||
int s = -bearingX[first];
|
||||
for (unsigned int i = 0; i < text.size(); i++) {
|
||||
int g = (int)text[i];
|
||||
if (!glyphs[g]) g = 32; // space
|
||||
glPushMatrix();
|
||||
glTranslatef(bearingX[g] + s, -bearingY[g]+height, 0.0f);
|
||||
glCallList(list+g);
|
||||
glTranslatef(0, height, 0);
|
||||
glyphs[g]->draw(0, 0, 0, 1, 1, 0, 0);
|
||||
glPopMatrix();
|
||||
s += spacing[g] * mSpacing;
|
||||
glTranslatef(spacing[g], 0, 0);
|
||||
}
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
@@ -68,6 +68,7 @@ namespace opengl
|
||||
glPushMatrix();
|
||||
|
||||
glMultMatrixf((const GLfloat*)t.getElements());
|
||||
glTranslatef(data->getBearingX(), -data->getBearingY(), 0.0f);
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
||||
Reference in New Issue
Block a user