From c2db2e2de323c81e6a40631ee20b187cb2212ae0 Mon Sep 17 00:00:00 2001 From: nakst <> Date: Wed, 2 Mar 2022 09:40:46 +0000 Subject: [PATCH] text rendering: fix bug where glyphs get rendered at wrong size --- desktop/text.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/desktop/text.cpp b/desktop/text.cpp index 621cde1..32d94bf 100644 --- a/desktop/text.cpp +++ b/desktop/text.cpp @@ -2362,6 +2362,9 @@ void DrawTextPiece(EsPainter *painter, EsTextPlan *plan, TextPiece *piece, TextL } if (!entry->data) { + // EsPrint("Rendering '%c' in size %d\n", plan->string[glyphs[i].cluster], key.size); + FontSetSize(&key.font, key.size); + if (!FontRenderGlyph(key, entry)) { EsHeapFree(entry); goto nextCharacter; @@ -2370,14 +2373,14 @@ void DrawTextPiece(EsPainter *painter, EsTextPlan *plan, TextPiece *piece, TextL } } + EsAssert(0 == EsMemoryCompare(&entry->key, &key, sizeof(GlyphCacheKey))); + if (selection->caret0 != selection->caret1 && !selection->hideCaret && (int32_t) glyphs[i].cluster >= selection->caret0 && (int32_t) glyphs[i].cluster < selection->caret1 && selection->foreground) { color = selection->foreground; } - // EsPrint("\t%c at %i.%i\n", plan->string[glyphs[i].cluster], positionX, (glyphPositions[i].x_offset + cursorX) & 0x3F); - DrawSingleCharacter(entry->width, entry->height, entry->xoff, entry->yoff, ES_POINT(positionX, positionY + line->ascent / FREETYPE_UNIT_SCALE), painter->clip, painter->target,