Browse Source

Don't render control characters

Michael Ragazzon 6 years ago
parent
commit
be23b7fd4d
1 changed files with 8 additions and 0 deletions
  1. 8 0
      Source/Core/FontFaceHandleDefault.cpp

+ 8 - 0
Source/Core/FontFaceHandleDefault.cpp

@@ -102,6 +102,10 @@ int FontFaceHandleDefault::GetStringWidth(const String& string, CodePoint prior_
 	{
 		CodePoint code_point = *it_string;
 
+		// Don't try to render control characters
+		if ((unsigned int)code_point < (unsigned int)' ')
+			continue;
+
 		auto it_glyph = glyphs.find(code_point);
 		if (it_glyph == glyphs.end())
 		{
@@ -239,6 +243,10 @@ int FontFaceHandleDefault::GenerateString(GeometryList& geometry, const String&
 		{
 			CodePoint code_point = *it_string;
 
+			// Don't try to render control characters
+			if ((unsigned int)code_point < (unsigned int)' ')
+				continue;
+
 			auto it_glyph = glyphs.find(code_point);
 			if (it_glyph == glyphs.end())
 			{