Fix dumbass font problems
The 320x240 font is still one pixel too high, but honestly I don't give a shit. It looks better anyway since the vanilla way is off-centre.
This commit is contained in:
parent
9f353a993e
commit
d52a69b0e6
2 changed files with 6 additions and 4 deletions
|
@ -447,16 +447,18 @@ void InitTextObject(const char *font_name)
|
|||
{
|
||||
//Get font size
|
||||
unsigned int fontWidth, fontHeight;
|
||||
if (gWindowScale == 1)
|
||||
|
||||
// The original did this, but Windows would downscale it to 5/10 anyway.
|
||||
/* if (gWindowScale == 1)
|
||||
{
|
||||
fontWidth = 6;
|
||||
fontHeight = 12;
|
||||
}
|
||||
else
|
||||
{
|
||||
{*/
|
||||
fontWidth = 5 * gWindowScale;
|
||||
fontHeight = 10 * gWindowScale;
|
||||
}
|
||||
// }
|
||||
|
||||
#ifdef WINDOWS
|
||||
// Actually use the font Config.dat specifies
|
||||
|
|
|
@ -228,7 +228,7 @@ void DrawText(FontObject *font_object, SDL_Surface *surface, int x, int y, unsig
|
|||
FT_Bitmap_Convert(font_object->library, &face->glyph->bitmap, &converted, 1);
|
||||
|
||||
const int letter_x = x + pen_x + face->glyph->bitmap_left;
|
||||
const int letter_y = y + ((FT_MulFix(face->ascender, face->size->metrics.y_scale) + (64 - 1)) / 64) - (face->glyph->metrics.horiBearingY / 64);
|
||||
const int letter_y = y + ((FT_MulFix(face->ascender, face->size->metrics.y_scale) - face->glyph->metrics.horiBearingY + (64 / 2)) / 64);
|
||||
|
||||
for (int iy = MAX(-letter_y, 0); letter_y + iy < MIN(letter_y + converted.rows, surface->h); ++iy)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue