Fixes the issue that line gap may ruin the text layout.

master
Olli Wang 2020-02-28 16:53:27 +08:00
parent 4ae538b10e
commit 528dc4efb5
1 changed files with 2 additions and 1 deletions

View File

@ -953,10 +953,11 @@ int fonsAddFontMem(FONScontext* stash, const char* name, unsigned char* data, in
// Store normalized line height. The real line height is got
// by multiplying the lineh by font size.
fons__tt_getFontVMetrics( &font->font, &ascent, &descent, &lineGap);
ascent += lineGap;
fh = ascent - descent;
font->ascender = (float)ascent / (float)fh;
font->descender = (float)descent / (float)fh;
font->lineh = (float)(fh + lineGap) / (float)fh;
font->lineh = font->ascender - font->descender;
return idx;