From b00d62d4ce827127eb379621d3c426b7d4d7c488 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Mon, 20 Nov 2017 16:00:51 +0200 Subject: [PATCH] Fixed: Client exit on unicode composite character errors --HG-- branch : develop --- code/nel/src/3d/font_generator.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/code/nel/src/3d/font_generator.cpp b/code/nel/src/3d/font_generator.cpp index 0adf29418..f50b61c5b 100644 --- a/code/nel/src/3d/font_generator.cpp +++ b/code/nel/src/3d/font_generator.cpp @@ -271,7 +271,14 @@ void CFontGenerator::getSizes (ucchar c, uint32 size, uint32 &width, uint32 &hei error = FT_Load_Glyph (_Face, glyph_index, FT_LOAD_DEFAULT); if (error) { - nlerror ("FT_Load_Glyph() failed: %s", getFT2Error(error)); + // use fallback for glyph/character errors (composite char limit for example) + nlwarning ("FT_Load_Glyph() failed: %s", getFT2Error(error)); + + error = FT_Load_Glyph (_Face, 0, FT_LOAD_DEFAULT); + if (error) + { + nlerror("FT_Load_Glyph() fallback failed: %s", getFT2Error(error)); + } } // convert 24.6 fixed point into integer @@ -302,7 +309,14 @@ uint8 *CFontGenerator::getBitmap (ucchar c, uint32 size, bool embolden, bool obl error = FT_Load_Glyph (_Face, glyph_index, FT_LOAD_DEFAULT); if (error) { - nlerror ("FT_Load_Glyph() failed: %s", getFT2Error(error)); + // use fallback for glyph/character errors (composite char limit for example) + nlwarning ("FT_Load_Glyph() failed: %s", getFT2Error(error)); + + error = FT_Load_Glyph (_Face, 0, FT_LOAD_DEFAULT); + if (error) + { + nlerror("FT_Load_Glyph() fallback failed: %s", getFT2Error(error)); + } } if (size == 0)