Fix some technical blunders.
authorTimo Korvola <tkorvola@iki.fi>
Fri, 9 Mar 2018 21:43:49 +0000 (23:43 +0200)
committerDavid Griffith <dave@661.org>
Sun, 11 Mar 2018 11:48:51 +0000 (04:48 -0700)
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

index 8d4457db6c0dd5ddc149e1921985e961aefc9878..e074bef6ee2507589cba5c1530b7d6dd6818f6ef 100644 (file)
@@ -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;