From 608fbec2bf8ab3a47717d2d434e3180f532dff59 Mon Sep 17 00:00:00 2001 From: Amy Gale Ruth Bowersox Date: Sat, 7 Dec 2019 23:59:00 -0700 Subject: [PATCH] try to fix rendering of text --- src/fbprimitive.c | 2 -- src/fontengine.c | 8 ++++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/fbprimitive.c b/src/fbprimitive.c index a7f0ea0..189c62d 100644 --- a/src/fbprimitive.c +++ b/src/fbprimitive.c @@ -131,7 +131,6 @@ static void internal_textout(INT32 x, INT32 y, INT32 width, INT32 height, PBYTE lbuf = (PUINT16)alloca(width * sizeof(UINT16)); for (i=0; i> 3) & 0x1F); } - Log(LDEBUG, "rendering row %d", i); memcpy(dptr, lbuf, width * sizeof(UINT16)); dptr += Fb_Info->width; } diff --git a/src/fontengine.c b/src/fontengine.c index 6ed7ec7..f392706 100644 --- a/src/fontengine.c +++ b/src/fontengine.c @@ -61,9 +61,11 @@ HRESULT FontEng_do_text_out(INT32 x, INT32 y, PCSTR pstr, TEXTOUTFUNC renderfunc FT_UInt glyph_index; FT_Error err; + y += (stdfont->size->metrics.ascender >> 6); + while (*pstr) { - glyph_index = FT_Get_Char_Index(stdfont, *pstr++); + glyph_index = FT_Get_Char_Index(stdfont, *pstr); err = FT_Load_Glyph(stdfont, glyph_index, FT_LOAD_DEFAULT); if (err != 0) { @@ -76,9 +78,11 @@ HRESULT FontEng_do_text_out(INT32 x, INT32 y, PCSTR pstr, TEXTOUTFUNC renderfunc hr = E_FAIL; break; } - (*renderfunc)(x, y, slot->bitmap.width, slot->bitmap.rows, slot->bitmap.buffer); + (*renderfunc)(x + slot->bitmap_left, y - slot->bitmap_top, slot->bitmap.width, + slot->bitmap.rows, slot->bitmap.buffer); x += slot->advance.x >> 6; y += slot->advance.y >> 6; + pstr++; } return hr; }