From 01b127b7f332e65a400f9363139cd98bb1794219 Mon Sep 17 00:00:00 2001 From: Archez Date: Tue, 12 Nov 2024 10:30:27 -0500 Subject: [PATCH] Fix GfxPrint for Japanese UTF8 characters (#843) --- mm/2s2h/BenPort.cpp | 1 - mm/src/boot/O2/gfxprint.c | 18 +++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/mm/2s2h/BenPort.cpp b/mm/2s2h/BenPort.cpp index fdca71087..1c10a73b5 100644 --- a/mm/2s2h/BenPort.cpp +++ b/mm/2s2h/BenPort.cpp @@ -1533,7 +1533,6 @@ extern "C" void OTRGfxPrint(const char* str, void* printer, void (*printImpl)(vo std::wstring wstr = StringToU16(str); for (const auto& c : wstr) { - unsigned char convt = ' '; if (c < 0x80) { printImpl(printer, c); } else if (c >= u'。' && c <= u'゚') { // katakana diff --git a/mm/src/boot/O2/gfxprint.c b/mm/src/boot/O2/gfxprint.c index 4fa0c8804..5b0ea20d0 100644 --- a/mm/src/boot/O2/gfxprint.c +++ b/mm/src/boot/O2/gfxprint.c @@ -323,16 +323,20 @@ void GfxPrint_PrintStringWithSize(GfxPrint* this, const void* buffer, size_t cha const char* str = (const char*)buffer; size_t count = charSize * charCount; - while (count != 0) { - GfxPrint_PrintChar(this, *str++); - count--; - } + // 2S2H [Port] Process the string with our wrapper that converts Japanese UTF8 characters for the print system + OTRGfxPrint(str, this, GfxPrint_PrintChar); + // while (count != 0) { + // GfxPrint_PrintChar(this, *str++); + // count--; + // } } void GfxPrint_PrintString(GfxPrint* this, const char* str) { - while (*str != '\0') { - GfxPrint_PrintChar(this, *str++); - } + // 2S2H [Port] Process the string with our wrapper that converts Japanese UTF8 characters for the print system + OTRGfxPrint(str, this, GfxPrint_PrintChar); + // while (*str != '\0') { + // GfxPrint_PrintChar(this, *str++); + // } } void* GfxPrint_Callback(void* arg, const char* str, size_t size) {