try to fix rendering of text

This commit is contained in:
Amy G. Bowersox 2019-12-07 23:59:00 -07:00
parent 68c9a64f8d
commit 608fbec2bf
2 changed files with 6 additions and 4 deletions

View File

@ -131,7 +131,6 @@ static void internal_textout(INT32 x, INT32 y, INT32 width, INT32 height, PBYTE
lbuf = (PUINT16)alloca(width * sizeof(UINT16)); lbuf = (PUINT16)alloca(width * sizeof(UINT16));
for (i=0; i<height; i++) for (i=0; i<height; i++)
{ {
Log(LDEBUG, "composing row %d", i);
for (j=0; j<width; j++) for (j=0; j<width; j++)
{ {
b = *gsbits++; b = *gsbits++;
@ -140,7 +139,6 @@ static void internal_textout(INT32 x, INT32 y, INT32 width, INT32 height, PBYTE
lbuf[j] |= ((UINT16)(b >> 3) & 0x1F); lbuf[j] |= ((UINT16)(b >> 3) & 0x1F);
} }
Log(LDEBUG, "rendering row %d", i);
memcpy(dptr, lbuf, width * sizeof(UINT16)); memcpy(dptr, lbuf, width * sizeof(UINT16));
dptr += Fb_Info->width; dptr += Fb_Info->width;
} }

View File

@ -61,9 +61,11 @@ HRESULT FontEng_do_text_out(INT32 x, INT32 y, PCSTR pstr, TEXTOUTFUNC renderfunc
FT_UInt glyph_index; FT_UInt glyph_index;
FT_Error err; FT_Error err;
y += (stdfont->size->metrics.ascender >> 6);
while (*pstr) 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); err = FT_Load_Glyph(stdfont, glyph_index, FT_LOAD_DEFAULT);
if (err != 0) if (err != 0)
{ {
@ -76,9 +78,11 @@ HRESULT FontEng_do_text_out(INT32 x, INT32 y, PCSTR pstr, TEXTOUTFUNC renderfunc
hr = E_FAIL; hr = E_FAIL;
break; 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; x += slot->advance.x >> 6;
y += slot->advance.y >> 6; y += slot->advance.y >> 6;
pstr++;
} }
return hr; return hr;
} }