From a7a5c0ea7a3b4c4500f6af6fa24a08c530a61033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Thu, 31 Oct 2024 23:54:12 +0100 Subject: [PATCH] Add checks for unsupported glyph pixel mode Skip rendering glyphs which don't use the 1-byte grayscale pixel mode. --- src/engine/client/text.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/engine/client/text.cpp b/src/engine/client/text.cpp index cd56be482..93aeeb54b 100644 --- a/src/engine/client/text.cpp +++ b/src/engine/client/text.cpp @@ -510,6 +510,11 @@ private: } const FT_Bitmap *pBitmap = &Glyph.m_Face->glyph->bitmap; + if(pBitmap->pixel_mode != FT_PIXEL_MODE_GRAY) + { + log_debug("textrender", "Error loading glyph, unsupported pixel mode. Chr=%d GlyphIndex=%u PixelMode=%d", Glyph.m_Chr, Glyph.m_GlyphIndex, pBitmap->pixel_mode); + return false; + } const unsigned RealWidth = pBitmap->width; const unsigned RealHeight = pBitmap->rows; @@ -788,6 +793,13 @@ public: } const FT_Bitmap *pBitmap = &Face->glyph->bitmap; + if(pBitmap->pixel_mode != FT_PIXEL_MODE_GRAY) + { + log_debug("textrender", "Error loading glyph, unsupported pixel mode. Chr=%d GlyphIndex=%u PixelMode=%d", NextCharacter, GlyphIndex, pBitmap->pixel_mode); + pCurrent = pTmp; + continue; + } + for(unsigned OffY = 0; OffY < pBitmap->rows; ++OffY) { for(unsigned OffX = 0; OffX < pBitmap->width; ++OffX)