瀏覽代碼

Don't render control characters

Michael Ragazzon 6 年之前
父節點
當前提交
be23b7fd4d
共有 1 個文件被更改,包括 8 次插入0 次删除
  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;
 		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);
 		auto it_glyph = glyphs.find(code_point);
 		if (it_glyph == glyphs.end())
 		if (it_glyph == glyphs.end())
 		{
 		{
@@ -239,6 +243,10 @@ int FontFaceHandleDefault::GenerateString(GeometryList& geometry, const String&
 		{
 		{
 			CodePoint code_point = *it_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);
 			auto it_glyph = glyphs.find(code_point);
 			if (it_glyph == glyphs.end())
 			if (it_glyph == glyphs.end())
 			{
 			{