Fixed an issue where font textures were sometimes updated with empty glyhps

This commit is contained in:
Leon Styhre 2023-11-20 21:26:58 +01:00
parent 6995196435
commit 8fe027e9ad

View file

@ -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;
}