ttf fonts are having bad offsets?

A project to port LÖVE to Android handhelds
Locked
utunnels
Citizen
Posts: 75
Joined: Fri Jan 06, 2012 5:20 pm

ttf fonts are having bad offsets?

Post by utunnels »

I know it has been discussed before.

When I tried that last time, all my images were displayed as white boxes if I printed something.

So I edited Gpyph.cpp to add glBindTexture(GL_TEXTURE_2D, 0) after glDisableClientState. The white box problem was fixed, but for some reason, I noticed the texts had wrong offsets.

For example, if I draw a string at (0, 10), on windows its upper border is at 10, but on android, its lower border is at 10. Any ideas?

Code: Select all

	void Glyph::draw(float x, float y, float angle, float sx, float sy, float ox, float oy) const
	{
		static Matrix t;
		
		t.setTransformation(x, y, angle, sx, sy, ox, oy);

		if(texture != 0)
			glBindTexture(GL_TEXTURE_2D,texture);

		glPushMatrix();

		glMultMatrixf((const GLfloat*)t.getElements());
		glTranslatef(static_cast<float>(data->getBearingX()), static_cast<float>(-data->getBearingY()), 0.0f);

		glEnableClientState(GL_VERTEX_ARRAY);
		glEnableClientState(GL_TEXTURE_COORD_ARRAY);
		glVertexPointer(2, GL_FLOAT, sizeof(vertex), (GLvoid*)&vertices[0].x);
		glTexCoordPointer(2, GL_FLOAT, sizeof(vertex), (GLvoid*)&vertices[0].s);
		glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
		glDisableClientState(GL_TEXTURE_COORD_ARRAY);
		glDisableClientState(GL_VERTEX_ARRAY);
		glBindTexture(GL_TEXTURE_2D, 0);

		glPopMatrix();

	}

User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: ttf fonts are having bad offsets?

Post by bartbes »

That's because the android port is based on an older version of love.
utunnels
Citizen
Posts: 75
Joined: Fri Jan 06, 2012 5:20 pm

Re: ttf fonts are having bad offsets?

Post by utunnels »

Oh thank you.
Now I recall it is based on 0.7...
User avatar
hagish
Citizen
Posts: 85
Joined: Thu May 01, 2008 12:51 pm
Contact:

Re: ttf fonts are having bad offsets?

Post by hagish »

Yes currently it is 0.7.2.
Locked

Who is online

Users browsing this forum: No registered users and 2 guests