From ccd89d393c3adcbeac505dcc35abef3151dd9504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= Date: Sun, 14 Mar 2021 08:28:13 +0200 Subject: [PATCH 1/1] Text: Monospace and zero-advance glyphs Don't force the same advance on all glyphs, since some don't advance the position. IssueID #204 # Conflicts: # src/ui/text.c --- src/ui/text.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/text.c b/src/ui/text.c index ee838ce7..8354a365 100644 --- a/src/ui/text.c +++ b/src/ui/text.c @@ -908,8 +908,8 @@ static iRect run_Font_(iFont *d, const iRunArgs *args) { is monospaced. Except with Japanese script, that's larger than the normal monospace. */ const iBool useMonoAdvance = monoAdvance > 0 && !isJapanese_FontId(fontId_Text_(glyph->font)); - const float advance = (useMonoAdvance ? monoAdvance : glyph->advance); - if (!isMeasuring_(mode)) { + const float advance = (useMonoAdvance && glyph->advance > 0 ? monoAdvance : glyph->advance); + if (!isMeasuring_(mode) && ch != 0x20 /* don't bother rendering spaces */) { if (useMonoAdvance && dst.w > advance && glyph->font != d && !isEmoji) { /* Glyphs from a different font may need recentering to look better. */ dst.x -= (dst.w - advance) / 2; -- 2.34.1