From 8fe027e9ad418e6aa41acf3125c554c0d8e31e54 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Mon, 20 Nov 2023 21:26:58 +0100 Subject: [PATCH] Fixed an issue where font textures were sometimes updated with empty glyhps --- es-core/src/resources/Font.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/es-core/src/resources/Font.cpp b/es-core/src/resources/Font.cpp index 0329cb057..3069aa467 100644 --- a/es-core/src/resources/Font.cpp +++ b/es-core/src/resources/Font.cpp @@ -768,8 +768,10 @@ Font::Glyph* Font::getGlyph(const unsigned int id) glyph.rows = glyphSize.y; // Upload glyph bitmap to texture. - mRenderer->updateTexture(tex->textureId, 0, Renderer::TextureType::RED, cursor.x, cursor.y, - glyphSize.x, glyphSize.y, glyphSlot->bitmap.buffer); + if (glyphSize.x > 0 && glyphSize.y > 0) { + mRenderer->updateTexture(tex->textureId, 0, Renderer::TextureType::RED, cursor.x, cursor.y, + glyphSize.x, glyphSize.y, glyphSlot->bitmap.buffer); + } return &glyph; }