Bertram25/ValyriaTear — pull request #411 by authenticate (2014-12-18 00:24:59+00:00)
Title: SDL2 Font Update

Hi,

I updated freetype to version 2.5.4 and everything still looked the same.

So, I looked at the font code and tried to make some progress there.

As a warning, I am not a font expert. I more or less tinkered with things until they started working better. So, this is probably not the perfect solution and/or it could be the completely wrong way to fix this.

Most of the important changes are to the FontGlyph class. I removed the "top_y" variable and renamed to the "max_x" and "max_y" variables to "_tx" and "_ty" respectively (They were storing texture coordinates and not font metrics originally.).

This appeared to clear up a lot of problems. I think the "top_y" variable was originally used to more precisely draw glyphs. In other words, it helped reduce over draw. However, I think something in the libraries changed causing it to clip the bottom of the glyphs. So, removing it causes over draw which alpha testing cleans up later.

Finally, I also changed:

SDL_SetSurfaceBlendMode(initial, SDL_BLENDMODE_BLEND);

Again, I do not fully understand the font code, however, I am not sure how italicized text worked in the originally implementation without blending. Most italicized fonts have glyphs which overlap each other. So, I would have thought glyphs in the middle of a string would potentially get clipped without blending.

Anyways, let me know what you think. I am just trying to keep progress moving on the SDL2 integration. :)

There are definitely some minor placement/alignment bugs in the shop and battle mode.

Thanks.