diff --git a/src/lgfx/v1/lgfx_fonts.cpp b/src/lgfx/v1/lgfx_fonts.cpp index 76157177..5ed465d8 100644 --- a/src/lgfx/v1/lgfx_fonts.cpp +++ b/src/lgfx/v1/lgfx_fonts.cpp @@ -886,11 +886,14 @@ namespace lgfx int32_t sy = 65536 * style->size_y; y += (metrics->y_offset * sy) >> 16; - if (code == 0x20) { + if (!this->getUnicodeIndex(code, &gNum)) { + if (code != 0x20) { + return drawCharDummy(gfx, x, y, this->spaceWidth, metrics->height, style, filled_x); + } + // Some VLW exporters omit the space glyph; for such fonts, keep the + // guessed advance instead of rendering the missing-glyph box. gNum = 0xFFFF; buffer[2] = getSwap32(this->spaceWidth); - } else if (!this->getUnicodeIndex(code, &gNum)) { - return drawCharDummy(gfx, x, y, this->spaceWidth, metrics->height, style, filled_x); } else { file->preRead(); file->seek(28 + gNum * 28);