From f7014db773c7ddc801398e638110509d8aec3840 Mon Sep 17 00:00:00 2001 From: Timo Korvola Date: Fri, 9 Mar 2018 23:43:49 +0200 Subject: [PATCH] Fix some technical blunders. Font height is not ascent + descent. Ascent + descent = em size, but height may be more if there is extra line spacing (height is from baseline to baseline). Also, off by one in yof computation. --- src/sdl/sf_ftype.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sdl/sf_ftype.c b/src/sdl/sf_ftype.c index 8d4457d..e074bef 100644 --- a/src/sdl/sf_ftype.c +++ b/src/sdl/sf_ftype.c @@ -197,7 +197,7 @@ static void setglyph( MYFONT *f, FT_Face face, int ch) res->h = bitmap->rows; res->dx = slot->advance.x/64; res->xof = slot->bitmap_left; - res->yof = slot->bitmap_top - bitmap->rows; + res->yof = slot->bitmap_top - bitmap->rows + 1; f->glyphs[ch] = res; } @@ -228,7 +228,7 @@ static SFONT * loadftype( char *fname, int size, SFONT *like, int *err) res->ascent = face->size->metrics.ascender/64; res->descent = -face->size->metrics.descender/64; - res->height = res->ascent+res->descent; //face->size->metrics.height/64; + res->height = face->size->metrics.height/64; res->sfont.antialiased = m_aafonts; res->minchar = 32; -- 2.34.1