commit 83a5b9706c7c8f6c3b8567d46dc47b3e5a417eae
Author: Jon Bell <j.to.the.bell@gmail.com>
AuthorDate: Fri Jan 2 13:28:18 2026 -0700
Commit: Jon Bell <j.to.the.bell@gmail.com>
CommitDate: Fri Jan 2 13:28:18 2026 -0700
Fix for custom font sizes and screen palette mapping out of range colors
---
platform/3ds/source/3dsHost.cpp | 2 +-
platform/SDL2Common/source/sdl2basehost.cpp | 4 +++-
platform/bittboy/source/BittBoyHost.cpp | 28 ++++++++++++++--------------
platform/funkey-s/source/FunkeyHost.cpp | 2 +-
platform/gcw0/source/ODHost.cpp | 28 ++++++++++++++--------------
platform/libretro/libretro.cpp | 4 ++--
platform/miyoomini/source/MiyooMiniHost.cpp | 14 +++++++-------
platform/wiiu/source/WiiUHost.cpp | 2 +-
source/graphics.cpp | 15 ++++++++++++---
source/printHelper.cpp | 8 ++++++--
test/endtoendtests.cpp | 2 +-
11 files changed, 62 insertions(+), 47 deletions(-)
diff --git a/platform/3ds/source/3dsHost.cpp b/platform/3ds/source/3dsHost.cpp
index 68c6e36..acf3e2b 100644
--- a/platform/3ds/source/3dsHost.cpp
+++ b/platform/3ds/source/3dsHost.cpp
@@ -517,7 +517,7 @@ void Host::drawFrame(uint8_t* picoFb, uint8_t* screenPaletteMap, uint8_t drawMod
size_t pixIdx = 0;
for (pixIdx = 0; pixIdx < pico_pixel_buffer_size; pixIdx++){
- pico_pixel_buffer[pixIdx] = _rgb565Colors[screenPaletteMap[getPixelNibble(pixIdx % 128, pixIdx / 128, picoFb)]];
+ pico_pixel_buffer[pixIdx] = _rgb565Colors[screenPaletteMap[getPixelNibble(pixIdx % 128, pixIdx / 128, picoFb)] & 0x8f];
}
//not sure if this is necessary?
diff --git a/platform/SDL2Common/source/sdl2basehost.cpp b/platform/SDL2Common/source/sdl2basehost.cpp
index d60802c..07d568b 100644
--- a/platform/SDL2Common/source/sdl2basehost.cpp
+++ b/platform/SDL2Common/source/sdl2basehost.cpp
@@ -333,7 +333,9 @@ void Host::drawFrame(uint8_t* picoFb, uint8_t* screenPaletteMap, uint8_t drawMod
for (int y = 0; y < PicoScreenHeight; y ++){
for (int x = 0; x < PicoScreenWidth; x ++){
uint8_t c = getPixelNibble(x, y, picoFb);
- Color col = _paletteColors[screenPaletteMap[c]];
+ // Apply 0x8F mask per PICO-8 spec: system color indices are masked with 0x8F
+ // This maps values like 149 to valid palette indices (149 & 0x8F = 133)
+ Color col = _paletteColors[screenPaletteMap[c] & 0x8f];
base = ((Uint8 *)pixels) + (4 * ( y * PicoScreenHeight + x));
base[0] = col.Blue;
diff --git a/platform/bittboy/source/BittBoyHost.cpp b/platform/bittboy/source/BittBoyHost.cpp
index 35e47ed..2ddc748 100644
--- a/platform/bittboy/source/BittBoyHost.cpp
+++ b/platform/bittboy/source/BittBoyHost.cpp
@@ -450,7 +450,7 @@ void Host::drawFrame(uint8_t* picoFb, uint8_t* screenPaletteMap, uint8_t drawMod
for (int y = 0; y < PicoScreenHeight; y ++){
for (int x = 0; x < PicoScreenWidth; x ++){
uint8_t c = getPixelNibble(x, y, picoFb);
- uint16_t col = _mapped16BitColors[screenPaletteMap[c]];
+ uint16_t col = _mapped16BitColors[screenPaletteMap[c] & 0x8f];
base = ((uint16_t *)pixels) + ( y * PicoScreenHeight + (127 - x));
base[0] = col;
@@ -462,7 +462,7 @@ void Host::drawFrame(uint8_t* picoFb, uint8_t* screenPaletteMap, uint8_t drawMod
for (int y = 0; y < PicoScreenHeight; y ++){
for (int x = 0; x < PicoScreenWidth; x ++){
uint8_t c = getPixelNibble(x, y, picoFb);
- uint16_t col = _mapped16BitColors[screenPaletteMap[c]];
+ uint16_t col = _mapped16BitColors[screenPaletteMap[c] & 0x8f];
base = ((uint16_t *)pixels) + ((127 - y) * PicoScreenHeight + x);
base[0] = col;
@@ -474,7 +474,7 @@ void Host::drawFrame(uint8_t* picoFb, uint8_t* screenPaletteMap, uint8_t drawMod
for (int y = 0; y < PicoScreenHeight; y ++){
for (int x = 0; x < PicoScreenWidth; x ++){
uint8_t c = getPixelNibble(x, y, picoFb);
- uint16_t col = _mapped16BitColors[screenPaletteMap[c]];
+ uint16_t col = _mapped16BitColors[screenPaletteMap[c] & 0x8f];
base = ((uint16_t *)pixels) + ((127 - y) * PicoScreenHeight + (127 - x));
base[0] = col;
@@ -486,7 +486,7 @@ void Host::drawFrame(uint8_t* picoFb, uint8_t* screenPaletteMap, uint8_t drawMod
for (int y = 0; y < PicoScreenHeight; y ++){
for (int x = 0; x < PicoScreenWidth; x ++){
uint8_t c = getPixelNibble(x, y, picoFb);
- uint16_t col = _mapped16BitColors[screenPaletteMap[c]];
+ uint16_t col = _mapped16BitColors[screenPaletteMap[c] & 0x8f];
base = ((uint16_t *)pixels) + (x * PicoScreenHeight + (127 - y));
base[0] = col;
@@ -498,7 +498,7 @@ void Host::drawFrame(uint8_t* picoFb, uint8_t* screenPaletteMap, uint8_t drawMod
for (int y = 0; y < PicoScreenHeight; y ++){
for (int x = 0; x < PicoScreenWidth; x ++){
uint8_t c = getPixelNibble(x, y, picoFb);
- uint16_t col = _mapped16BitColors[screenPaletteMap[c]];
+ uint16_t col = _mapped16BitColors[screenPaletteMap[c] & 0x8f];
base = ((uint16_t *)pixels) + ((127 - y) * PicoScreenHeight + (127 - x));
base[0] = col;
@@ -510,7 +510,7 @@ void Host::drawFrame(uint8_t* picoFb, uint8_t* screenPaletteMap, uint8_t drawMod
for (int y = 0; y < PicoScreenHeight; y ++){
for (int x = 0; x < PicoScreenWidth; x ++){
uint8_t c = getPixelNibble(x, y, picoFb);
- uint16_t col = _mapped16BitColors[screenPaletteMap[c]];
+ uint16_t col = _mapped16BitColors[screenPaletteMap[c] & 0x8f];
base = ((uint16_t *)pixels) + ((127 - x) * PicoScreenHeight + y);
base[0] = col;
@@ -531,14 +531,14 @@ void Host::drawFrame(uint8_t* picoFb, uint8_t* screenPaletteMap, uint8_t drawMod
int b = (eightPix >> 4) & 0x0f;
int a = (eightPix) & 0x0f;
- int32_t cola = _mapped16BitColors[screenPaletteMap[a]];
- int32_t colb = _mapped16BitColors[screenPaletteMap[b]];
- int32_t colc = _mapped16BitColors[screenPaletteMap[c]];
- int32_t cold = _mapped16BitColors[screenPaletteMap[d]];
- int32_t cole = _mapped16BitColors[screenPaletteMap[e]];
- int32_t colf = _mapped16BitColors[screenPaletteMap[f]];
- int32_t colg = _mapped16BitColors[screenPaletteMap[g]];
- int32_t colh = _mapped16BitColors[screenPaletteMap[h]];
+ int32_t cola = _mapped16BitColors[screenPaletteMap[a] & 0x8f];
+ int32_t colb = _mapped16BitColors[screenPaletteMap[b] & 0x8f];
+ int32_t colc = _mapped16BitColors[screenPaletteMap[c] & 0x8f];
+ int32_t cold = _mapped16BitColors[screenPaletteMap[d] & 0x8f];
+ int32_t cole = _mapped16BitColors[screenPaletteMap[e] & 0x8f];
+ int32_t colf = _mapped16BitColors[screenPaletteMap[f] & 0x8f];
+ int32_t colg = _mapped16BitColors[screenPaletteMap[g] & 0x8f];
+ int32_t colh = _mapped16BitColors[screenPaletteMap[h] & 0x8f];
base = ((uint16_t *)pixels + (y * PicoScreenHeight + x * 8));
diff --git a/platform/funkey-s/source/FunkeyHost.cpp b/platform/funkey-s/source/FunkeyHost.cpp
index adb9511..61029d1 100644
--- a/platform/funkey-s/source/FunkeyHost.cpp
+++ b/platform/funkey-s/source/FunkeyHost.cpp
@@ -268,7 +268,7 @@ void Host::drawFrame(uint8_t* picoFb, uint8_t* screenPaletteMap, uint8_t drawMod
for (int y = 0; y < (PicoScreenHeight); y ++){
for (int x = 0; x < PicoScreenWidth; x ++){
uint8_t c = getPixelNibble(x, y, picoFb);
- uint16_t col = _mapped16BitColors[screenPaletteMap[c]];
+ uint16_t col = _mapped16BitColors[screenPaletteMap[c] & 0x8f];
base = ((uint16_t *)pixels) + ( y * PicoScreenHeight + x);
base[0] = col;
diff --git a/platform/gcw0/source/ODHost.cpp b/platform/gcw0/source/ODHost.cpp
index b0f3554..430b6a1 100644
--- a/platform/gcw0/source/ODHost.cpp
+++ b/platform/gcw0/source/ODHost.cpp
@@ -495,7 +495,7 @@ void Host::drawFrame(uint8_t* picoFb, uint8_t* screenPaletteMap, uint8_t drawMod
for (int y = 0; y < PicoScreenHeight; y ++){
for (int x = 0; x < PicoScreenWidth; x ++){
uint8_t c = getPixelNibble(x, y, picoFb);
- uint16_t col = _mapped16BitColors[screenPaletteMap[c]];
+ uint16_t col = _mapped16BitColors[screenPaletteMap[c] & 0x8f];
base = ((uint16_t *)pixels) + ( y * PicoScreenHeight + (127 - x));
base[0] = col;
@@ -507,7 +507,7 @@ void Host::drawFrame(uint8_t* picoFb, uint8_t* screenPaletteMap, uint8_t drawMod
for (int y = 0; y < PicoScreenHeight; y ++){
for (int x = 0; x < PicoScreenWidth; x ++){
uint8_t c = getPixelNibble(x, y, picoFb);
- uint16_t col = _mapped16BitColors[screenPaletteMap[c]];
+ uint16_t col = _mapped16BitColors[screenPaletteMap[c] & 0x8f];
base = ((uint16_t *)pixels) + ((127 - y) * PicoScreenHeight + x);
base[0] = col;
@@ -519,7 +519,7 @@ void Host::drawFrame(uint8_t* picoFb, uint8_t* screenPaletteMap, uint8_t drawMod
for (int y = 0; y < PicoScreenHeight; y ++){
for (int x = 0; x < PicoScreenWidth; x ++){
uint8_t c = getPixelNibble(x, y, picoFb);
- uint16_t col = _mapped16BitColors[screenPaletteMap[c]];
+ uint16_t col = _mapped16BitColors[screenPaletteMap[c] & 0x8f];
base = ((uint16_t *)pixels) + ((127 - y) * PicoScreenHeight + (127 - x));
base[0] = col;
@@ -531,7 +531,7 @@ void Host::drawFrame(uint8_t* picoFb, uint8_t* screenPaletteMap, uint8_t drawMod
for (int y = 0; y < PicoScreenHeight; y ++){
for (int x = 0; x < PicoScreenWidth; x ++){
uint8_t c = getPixelNibble(x, y, picoFb);
- uint16_t col = _mapped16BitColors[screenPaletteMap[c]];
+ uint16_t col = _mapped16BitColors[screenPaletteMap[c] & 0x8f];
base = ((uint16_t *)pixels) + (x * PicoScreenHeight + (127 - y));
base[0] = col;
@@ -543,7 +543,7 @@ void Host::drawFrame(uint8_t* picoFb, uint8_t* screenPaletteMap, uint8_t drawMod
for (int y = 0; y < PicoScreenHeight; y ++){
for (int x = 0; x < PicoScreenWidth; x ++){
uint8_t c = getPixelNibble(x, y, picoFb);
- uint16_t col = _mapped16BitColors[screenPaletteMap[c]];
+ uint16_t col = _mapped16BitColors[screenPaletteMap[c] & 0x8f];
base = ((uint16_t *)pixels) + ((127 - y) * PicoScreenHeight + (127 - x));
base[0] = col;
@@ -555,7 +555,7 @@ void Host::drawFrame(uint8_t* picoFb, uint8_t* screenPaletteMap, uint8_t drawMod
for (int y = 0; y < PicoScreenHeight; y ++){
for (int x = 0; x < PicoScreenWidth; x ++){
uint8_t c = getPixelNibble(x, y, picoFb);
- uint16_t col = _mapped16BitColors[screenPaletteMap[c]];
+ uint16_t col = _mapped16BitColors[screenPaletteMap[c] & 0x8f];
base = ((uint16_t *)pixels) + ((127 - x) * PicoScreenHeight + y);
base[0] = col;
@@ -576,14 +576,14 @@ void Host::drawFrame(uint8_t* picoFb, uint8_t* screenPaletteMap, uint8_t drawMod
int b = (eightPix >> 4) & 0x0f;
int a = (eightPix) & 0x0f;
- int32_t cola = _mapped16BitColors[screenPaletteMap[a]];
- int32_t colb = _mapped16BitColors[screenPaletteMap[b]];
- int32_t colc = _mapped16BitColors[screenPaletteMap[c]];
- int32_t cold = _mapped16BitColors[screenPaletteMap[d]];
- int32_t cole = _mapped16BitColors[screenPaletteMap[e]];
- int32_t colf = _mapped16BitColors[screenPaletteMap[f]];
- int32_t colg = _mapped16BitColors[screenPaletteMap[g]];
- int32_t colh = _mapped16BitColors[screenPaletteMap[h]];
+ int32_t cola = _mapped16BitColors[screenPaletteMap[a] & 0x8f];
+ int32_t colb = _mapped16BitColors[screenPaletteMap[b] & 0x8f];
+ int32_t colc = _mapped16BitColors[screenPaletteMap[c] & 0x8f];
+ int32_t cold = _mapped16BitColors[screenPaletteMap[d] & 0x8f];
+ int32_t cole = _mapped16BitColors[screenPaletteMap[e] & 0x8f];
+ int32_t colf = _mapped16BitColors[screenPaletteMap[f] & 0x8f];
+ int32_t colg = _mapped16BitColors[screenPaletteMap[g] & 0x8f];
+ int32_t colh = _mapped16BitColors[screenPaletteMap[h] & 0x8f];
base = ((uint16_t *)pixels + (y * PicoScreenHeight + x * 8));
diff --git a/platform/libretro/libretro.cpp b/platform/libretro/libretro.cpp
index 6c30a3c..589d4f2 100644
--- a/platform/libretro/libretro.cpp
+++ b/platform/libretro/libretro.cpp
@@ -481,7 +481,7 @@ EXPORT void retro_run()
for (unsigned scrx = 0; scrx < width; scrx++) {
int picox = (scrx + crop_h_left) / drawModeScaleX;
int picoy = (scry + crop_v_top) / drawModeScaleY;
- uint16_t color = _rgb565Colors[screenPaletteMap[getPixelNibble(picox, picoy, picoFb)]];
+ uint16_t color = _rgb565Colors[screenPaletteMap[getPixelNibble(picox, picoy, picoFb)] & 0x8f];
for (int y = 0; y < scale; y++) {
for (int x = 0; x < scale; x++) {
@@ -498,7 +498,7 @@ EXPORT void retro_run()
for (unsigned scrx = 0; scrx < width; scrx++) {
int picox = (scrx + crop_h_left) / drawModeScaleX;
int picoy = (scry + crop_v_top) / drawModeScaleY;
- screenBuffer[scry*width+scrx] = _rgb565Colors[screenPaletteMap[getPixelNibble(picox, picoy, picoFb)]];
+ screenBuffer[scry*width+scrx] = _rgb565Colors[screenPaletteMap[getPixelNibble(picox, picoy, picoFb)] & 0x8f];
}
}
diff --git a/platform/miyoomini/source/MiyooMiniHost.cpp b/platform/miyoomini/source/MiyooMiniHost.cpp
index dcd8ce8..b272aef 100644
--- a/platform/miyoomini/source/MiyooMiniHost.cpp
+++ b/platform/miyoomini/source/MiyooMiniHost.cpp
@@ -496,7 +496,7 @@ void Host::drawFrame(uint8_t* picoFb, uint8_t* screenPaletteMap, uint8_t drawMod
for (int y = 0; y < PicoScreenHeight; y ++){
for (int x = 0; x < PicoScreenWidth; x ++){
uint8_t c = getPixelNibble(x, y, picoFb);
- uint32_t col = _mapped32BitColors[screenPaletteMap[c]];
+ uint32_t col = _mapped32BitColors[screenPaletteMap[c] & 0x8f];
base = ((uint32_t *)pixels) + ( y * PicoScreenHeight + (127 - x));
base[0] = col;
@@ -508,7 +508,7 @@ void Host::drawFrame(uint8_t* picoFb, uint8_t* screenPaletteMap, uint8_t drawMod
for (int y = 0; y < PicoScreenHeight; y ++){
for (int x = 0; x < PicoScreenWidth; x ++){
uint8_t c = getPixelNibble(x, y, picoFb);
- uint32_t col = _mapped32BitColors[screenPaletteMap[c]];
+ uint32_t col = _mapped32BitColors[screenPaletteMap[c] & 0x8f];
base = ((uint32_t *)pixels) + ((127 - y) * PicoScreenHeight + x);
base[0] = col;
@@ -520,7 +520,7 @@ void Host::drawFrame(uint8_t* picoFb, uint8_t* screenPaletteMap, uint8_t drawMod
for (int y = 0; y < PicoScreenHeight; y ++){
for (int x = 0; x < PicoScreenWidth; x ++){
uint8_t c = getPixelNibble(x, y, picoFb);
- uint32_t col = _mapped32BitColors[screenPaletteMap[c]];
+ uint32_t col = _mapped32BitColors[screenPaletteMap[c] & 0x8f];
base = ((uint32_t *)pixels) + ((127 - y) * PicoScreenHeight + (127 - x));
base[0] = col;
@@ -532,7 +532,7 @@ void Host::drawFrame(uint8_t* picoFb, uint8_t* screenPaletteMap, uint8_t drawMod
for (int y = 0; y < PicoScreenHeight; y ++){
for (int x = 0; x < PicoScreenWidth; x ++){
uint8_t c = getPixelNibble(x, y, picoFb);
- uint32_t col = _mapped32BitColors[screenPaletteMap[c]];
+ uint32_t col = _mapped32BitColors[screenPaletteMap[c] & 0x8f];
base = ((uint32_t *)pixels) + (x * PicoScreenHeight + (127 - y));
base[0] = col;
@@ -544,7 +544,7 @@ void Host::drawFrame(uint8_t* picoFb, uint8_t* screenPaletteMap, uint8_t drawMod
for (int y = 0; y < PicoScreenHeight; y ++){
for (int x = 0; x < PicoScreenWidth; x ++){
uint8_t c = getPixelNibble(x, y, picoFb);
- uint32_t col = _mapped32BitColors[screenPaletteMap[c]];
+ uint32_t col = _mapped32BitColors[screenPaletteMap[c] & 0x8f];
base = ((uint32_t *)pixels) + ((127 - y) * PicoScreenHeight + (127 - x));
base[0] = col;
@@ -556,7 +556,7 @@ void Host::drawFrame(uint8_t* picoFb, uint8_t* screenPaletteMap, uint8_t drawMod
for (int y = 0; y < PicoScreenHeight; y ++){
for (int x = 0; x < PicoScreenWidth; x ++){
uint8_t c = getPixelNibble(x, y, picoFb);
- uint32_t col = _mapped32BitColors[screenPaletteMap[c]];
+ uint32_t col = _mapped32BitColors[screenPaletteMap[c] & 0x8f];
base = ((uint32_t *)pixels) + ((127 - x) * PicoScreenHeight + y);
base[0] = col;
@@ -567,7 +567,7 @@ void Host::drawFrame(uint8_t* picoFb, uint8_t* screenPaletteMap, uint8_t drawMod
for (int y = 0; y < PicoScreenHeight; y ++){
for (int x = 0; x < PicoScreenWidth; x ++){
uint8_t c = getPixelNibble(x, y, picoFb);
- uint32_t col = _mapped32BitColors[screenPaletteMap[c]];
+ uint32_t col = _mapped32BitColors[screenPaletteMap[c] & 0x8f];
#ifdef _DESKTOP
base = ((uint32_t *)pixels) + (y * PicoScreenHeight + x);
diff --git a/platform/wiiu/source/WiiUHost.cpp b/platform/wiiu/source/WiiUHost.cpp
index 0fbaa31..c189aa5 100644
--- a/platform/wiiu/source/WiiUHost.cpp
+++ b/platform/wiiu/source/WiiUHost.cpp
@@ -442,7 +442,7 @@ void Host::drawFrame(uint8_t* picoFb, uint8_t* screenPaletteMap, uint8_t drawMod
for (int y = 0; y < PicoScreenHeight; y ++){
for (int x = 0; x < PicoScreenWidth; x ++){
uint8_t c = getPixelNibble(x, y, picoFb);
- Color col = _paletteColors[screenPaletteMap[c]];
+ Color col = _paletteColors[screenPaletteMap[c] & 0x8f];
base = ((Uint8 *)pixels) + (4 * ( y * PicoScreenHeight + x));
base[0] = col.Red;
diff --git a/source/graphics.cpp b/source/graphics.cpp
index f88e6a5..86423c2 100644
--- a/source/graphics.cpp
+++ b/source/graphics.cpp
@@ -589,7 +589,7 @@ void Graphics::_setPixelFromPen(int x, int y) {
}
//finalC = getDrawPalMappedColor(finalC);
- finalC = drawState.drawPaletteMap[finalC & 0x0f] & 0x0f;
+ finalC = drawState.drawPaletteMap[finalC & 0x0f] & 0x0f;
//from pico 8 wiki:
//dst_color = (dst_color & ~write_mask) | (src_color & write_mask & read_mask)
@@ -1580,10 +1580,19 @@ std::tuple<int, int> Graphics::drawCharacterFromBytes(
fgColor &= 0x0f;
bgColor &= 0x0f;
+ // Font data is always 8 bytes per character (8 rows of 8 pixels), even if charHeight or charWidth > 8
+ // Rows/Cols beyond 8 should be blank (charHeight > 8 affects line spacing, not glyph size)
+ const int maxFontDataRows = 8;
+
for (int relDestY = 0; relDestY < charHeight * hFactor; relDestY++) {
for(int relDestX = 0; relDestX < charWidth * wFactor; relDestX++) {
-
- bool on = BITMASK(relDestX / wFactor) & chBytes[relDestY / hFactor];
+ // Only read from font data if within the 8x8 limit
+ int fontRow = relDestY / hFactor;
+ int fontCol = relDestX / wFactor;
+ if ((fontRow >= maxFontDataRows || fontCol >= maxFontDataRows)) {
+ continue;
+ }
+ bool on = BITMASK(fontCol) & chBytes[fontRow];
on &= hFactor == 1 || !evenPxOnly || (relDestY % 2 == 0);
on &= wFactor == 1 || !evenPxOnly || (relDestX % 2 == 0);
diff --git a/source/printHelper.cpp b/source/printHelper.cpp
index 5cb05c6..b4298db 100644
--- a/source/printHelper.cpp
+++ b/source/printHelper.cpp
@@ -3,7 +3,6 @@
#include "printHelper.h"
#include "nibblehelpers.h"
-#include <string>
#include "graphics.h"
#include "vm.h"
#include "Audio.h"
@@ -467,9 +466,13 @@ int print(std::string str, int x, int y, uint8_t c) {
}
else if (ch == 14) { //"\014" Turn on custom font stored at 0x5600
printMode |= PRINT_MODE_CUSTOM_FONT;
+ charWidth = _ph_mem->data[0x5600];
+ charHeight = _ph_mem->data[0x5602];
}
else if (ch == 15) { //"\015" Turn off custom font stored at 0x5600
printMode &= ~(PRINT_MODE_CUSTOM_FONT);
+ charWidth = 4;
+ charHeight = 6;
}
else if (ch == '\n') {
x = homeX;
@@ -529,7 +532,7 @@ int print(std::string str, int x, int y, uint8_t c) {
if (underline) {
_ph_graphics->rectfill(x-1, y + lineHeight, x + charWidth - 1, y + lineHeight, fgColor);
}
- x += charWidth + _ph_graphics->drawCharacter(
+ int extraWidth = _ph_graphics->drawCharacter(
ch,
x,
y,
@@ -538,6 +541,7 @@ int print(std::string str, int x, int y, uint8_t c) {
printMode,
forceCharWidth,
forceCharHeight);
+ x += charWidth + extraWidth;
while (framesToPause > 0){
//TODO: yield here? not sure how to handle this
diff --git a/test/endtoendtests.cpp b/test/endtoendtests.cpp
index b2dc7a3..722a52b 100644
--- a/test/endtoendtests.cpp
+++ b/test/endtoendtests.cpp
@@ -47,7 +47,7 @@ bool verifyScreenshot(Vm* vm, Host* host, std::string screenshotFilename) {
int x = pixIdx % 128;
int y = pixIdx / 128;
uint8_t c = getPixelNibble(x, y, picoFb);
- Color col = paletteColors[screenPaletteMap[c]];
+ Color col = paletteColors[screenPaletteMap[c] & 0x8f];
//black varies by pico 8 version. allow for either so I don't have to
//retake all the screenshots