[Bf-blender-cvs] [c02c2df] master: BGE Bitmap Text: add in check if the character is outside the range

Campbell Barton noreply at git.blender.org
Thu Jan 23 03:38:10 CET 2014


Commit: c02c2dfdd911fd1c92236e810f26da13f79cf8a5
Author: Campbell Barton
Date:   Thu Jan 23 13:37:09 2014 +1100
https://developer.blender.org/rBc02c2dfdd911fd1c92236e810f26da13f79cf8a5

BGE Bitmap Text: add in check if the character is outside the range

===================================================================

M	source/blender/gpu/intern/gpu_draw.c

===================================================================

diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 7411258..c4827a5 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -97,7 +97,7 @@ void GPU_render_text(MTFace *tface, int mode,
 		Image* ima = (Image *)tface->tpage;
 		ImBuf *first_ibuf;
 		const size_t textlen_st = textlen;
-		size_t index, character;
+		size_t index;
 		float centerx, centery, sizex, sizey, transx, transy, movex, movey, advance;
 		float advance_tab;
 		
@@ -129,6 +129,7 @@ void GPU_render_text(MTFace *tface, int mode,
 		
 		
 		for (index = 0; index < textlen_st; ) {
+			unsigned int character;
 			float uv[4][2];
 
 			// lets calculate offset stuff
@@ -145,6 +146,10 @@ void GPU_render_text(MTFace *tface, int mode,
 				continue;
 				
 			}
+			else if (character > USHRT_MAX) {
+				/* not much we can do here bmfonts take ushort */
+				character = '?';
+			}
 			
 			// space starts at offset 1
 			// character = character - ' ' + 1;




More information about the Bf-blender-cvs mailing list