From bbf1dabb542e8da3a0147cb1d757f2b84fb969ef Mon Sep 17 00:00:00 2001 From: Alex Faria <3195321+alexfaria@users.noreply.github.com> Date: Tue, 24 Feb 2026 15:30:33 +0000 Subject: [PATCH 1/4] Fix trailing ghost vertical edge on right edge of character on antialiased text --- src/bb_ep_gfx.inl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/bb_ep_gfx.inl b/src/bb_ep_gfx.inl index 349b740..79faa28 100644 --- a/src/bb_ep_gfx.inl +++ b/src/bb_ep_gfx.inl @@ -1147,6 +1147,9 @@ int bbepWriteStringCustom(FASTEPDSTATE *pBBEP, const void *pFont, int x, int y, for (ty=dy; ty= 0) { Scale2Gray(u8Cache, iLineSize, iLineSize); // convert a pair of lines s = u8Cache; From eeae3096664ca4e639ac38324acc3405d9333002 Mon Sep 17 00:00:00 2001 From: Alex Faria <3195321+alexfaria@users.noreply.github.com> Date: Tue, 24 Feb 2026 15:40:19 +0000 Subject: [PATCH 2/4] Invert the gray colours for anti-aliased text if the background is black --- src/bb_ep_gfx.inl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bb_ep_gfx.inl b/src/bb_ep_gfx.inl index 79faa28..7a835b0 100644 --- a/src/bb_ep_gfx.inl +++ b/src/bb_ep_gfx.inl @@ -1156,7 +1156,7 @@ int bbepWriteStringCustom(FASTEPDSTATE *pBBEP, const void *pFont, int x, int y, u8 = *s++; // grab first byte u8Count = 4; for (tx=x+x_off; tx>6]; + u8Color = grayColors[iBG == BBEP_BLACK ? 3 - (u8>>6) : u8>>6]; // invert the color if we're on a black background (*pBBEP->pfnSetPixelFast)(pBBEP, tx/2, ty/2, u8Color); u8 <<= 2; u8Count--; From 866353349d2773eaa6d887455a60dfb8a08478c5 Mon Sep 17 00:00:00 2001 From: Alex Faria <3195321+alexfaria@users.noreply.github.com> Date: Tue, 24 Feb 2026 16:08:39 +0000 Subject: [PATCH 3/4] Clear line buffer before decoding in antialiasing --- src/bb_ep_gfx.inl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bb_ep_gfx.inl b/src/bb_ep_gfx.inl index 7a835b0..e6f270b 100644 --- a/src/bb_ep_gfx.inl +++ b/src/bb_ep_gfx.inl @@ -1146,7 +1146,9 @@ 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 Date: Wed, 25 Feb 2026 00:33:41 +0000 Subject: [PATCH 4/4] Skip background pixels when rendering AA fonts Only call pfnSetPixelFast when the computed font color differs from the background (iBG). This prevents drawing transparent/background pixels, avoiding overlap artifacts (e.g., with italic fonts) and reducing unnecessary pixel writes. --- src/bb_ep_gfx.inl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/bb_ep_gfx.inl b/src/bb_ep_gfx.inl index e6f270b..bb1e941 100644 --- a/src/bb_ep_gfx.inl +++ b/src/bb_ep_gfx.inl @@ -1159,7 +1159,11 @@ int bbepWriteStringCustom(FASTEPDSTATE *pBBEP, const void *pFont, int x, int y, u8Count = 4; for (tx=x+x_off; tx>6) : u8>>6]; // invert the color if we're on a black background - (*pBBEP->pfnSetPixelFast)(pBBEP, tx/2, ty/2, u8Color); + 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) {