diff --git a/src/bb_ep_gfx.inl b/src/bb_ep_gfx.inl index 349b740..bb1e941 100644 --- a/src/bb_ep_gfx.inl +++ b/src/bb_ep_gfx.inl @@ -1146,15 +1146,24 @@ int bbepWriteStringCustom(FASTEPDSTATE *pBBEP, const void *pFont, int x, int y, memset(u8Cache, 0, iLineSize*2); // start with 2 lines of white (gray table is inverted) for (ty=dy; ty= 0) { Scale2Gray(u8Cache, iLineSize, iLineSize); // convert a pair of lines s = u8Cache; u8 = *s++; // grab first byte u8Count = 4; for (tx=x+x_off; tx>6]; - (*pBBEP->pfnSetPixelFast)(pBBEP, tx/2, ty/2, u8Color); + u8Color = grayColors[iBG == BBEP_BLACK ? 3 - (u8>>6) : u8>>6]; // invert the color if we're on a black background + if (u8Color != iBG) { + // draw the pixel if it's not transparent + // avoid overlapping the previous character's pixels if the font is Italic for example + (*pBBEP->pfnSetPixelFast)(pBBEP, tx/2, ty/2, u8Color); + } u8 <<= 2; u8Count--; if (u8Count == 0) {