From f26a16fb5735c94cffe73fa58d2a363d65223738 Mon Sep 17 00:00:00 2001 From: Rob Kirberich Date: Sun, 26 Oct 2025 14:59:16 +0100 Subject: [PATCH 1/2] Use actual glyph width, not the guessed spaceWidth, to determine the width of the space character --- src/lgfx/v1/lgfx_fonts.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/lgfx/v1/lgfx_fonts.cpp b/src/lgfx/v1/lgfx_fonts.cpp index 76157177..4092c483 100644 --- a/src/lgfx/v1/lgfx_fonts.cpp +++ b/src/lgfx/v1/lgfx_fonts.cpp @@ -886,10 +886,7 @@ namespace lgfx int32_t sy = 65536 * style->size_y; y += (metrics->y_offset * sy) >> 16; - if (code == 0x20) { - gNum = 0xFFFF; - buffer[2] = getSwap32(this->spaceWidth); - } else if (!this->getUnicodeIndex(code, &gNum)) { + if (!this->getUnicodeIndex(code, &gNum)) { return drawCharDummy(gfx, x, y, this->spaceWidth, metrics->height, style, filled_x); } else { file->preRead(); From d20b138593f593016af9997b6e627fed8f86bf2b Mon Sep 17 00:00:00 2001 From: ainyan03 Date: Sun, 16 Aug 2026 12:42:33 +0000 Subject: [PATCH 2/2] Keep the guessed space advance for VLW fonts without a space glyph Some VLW exporters (e.g. the Processing font converter) omit the space glyph from the file. Falling through to drawCharDummy would render the missing-glyph box for every space, so restore the previous silent guessed-width behavior for that case only. Fonts that do contain a space glyph keep using the actual glyph metrics. --- src/lgfx/v1/lgfx_fonts.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lgfx/v1/lgfx_fonts.cpp b/src/lgfx/v1/lgfx_fonts.cpp index 4092c483..5ed465d8 100644 --- a/src/lgfx/v1/lgfx_fonts.cpp +++ b/src/lgfx/v1/lgfx_fonts.cpp @@ -887,7 +887,13 @@ namespace lgfx y += (metrics->y_offset * sy) >> 16; if (!this->getUnicodeIndex(code, &gNum)) { - return drawCharDummy(gfx, x, y, this->spaceWidth, metrics->height, style, filled_x); + 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 { file->preRead(); file->seek(28 + gNum * 28);