From 528dc4efb57de101c2aac2403fe1133a073a1257 Mon Sep 17 00:00:00 2001 From: Olli Wang Date: Fri, 28 Feb 2020 16:53:27 +0800 Subject: [PATCH] Fixes the issue that line gap may ruin the text layout. --- src/fontstash.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/fontstash.h b/src/fontstash.h index 0b07889..c4a8f14 100644 --- a/src/fontstash.h +++ b/src/fontstash.h @@ -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;