From 6ad7b212038e46f69d3cae020a45f188c68fb7b9 Mon Sep 17 00:00:00 2001 From: STU Date: Sun, 20 Jul 2014 14:37:15 +0100 Subject: [PATCH] Fix a bug in the font system. When the finding a rectangle for a glyph at a particular character size, if the glyph happens to be wider than the current texture size, but less high than the unused height in the texture, the texture will not be correctly doubled in size (since only the height is checked). In practice, this only occurs when finding the rectangle for the *very first* glyph (so the texture is at its default 128x128 size): otherwise, the glyph would need to be unusually wide compared to its height to trigger the bug. This will trigger a debug assertion in Texture::update(). With assertions disabled, there are knock-on effects and most text at that character size will fail to render. --- src/SFML/Graphics/Font.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SFML/Graphics/Font.cpp b/src/SFML/Graphics/Font.cpp index 4b49e7be6..59ae60dd6 100644 --- a/src/SFML/Graphics/Font.cpp +++ b/src/SFML/Graphics/Font.cpp @@ -624,7 +624,7 @@ IntRect Font::findGlyphRect(Page& page, unsigned int width, unsigned int height) if (!row) { int rowHeight = height + height / 10; - while (page.nextRow + rowHeight >= page.texture.getSize().y) + while ((page.nextRow + rowHeight >= page.texture.getSize().y) || (width >= page.texture.getSize().x)) { // Not enough space: resize the texture if possible unsigned int textureWidth = page.texture.getSize().x;