Fix T38325: Game Engine Bitmap fonts failed for characters >128
authorCampbell Barton <ideasman42@gmail.com>
Thu, 23 Jan 2014 02:29:49 +0000 (13:29 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 23 Jan 2014 02:29:49 +0000 (13:29 +1100)
source/blender/gpu/intern/gpu_draw.c

index 5ee30c242c1aad61907e5e929b01935710c22438..74112583a3f880a1f95e84aae0eb0b4d60762ac5 100644 (file)
@@ -96,7 +96,8 @@ void GPU_render_text(MTFace *tface, int mode,
        if ((mode & GEMAT_TEXT) && (textlen>0) && tface->tpage) {
                Image* ima = (Image *)tface->tpage;
                ImBuf *first_ibuf;
        if ((mode & GEMAT_TEXT) && (textlen>0) && tface->tpage) {
                Image* ima = (Image *)tface->tpage;
                ImBuf *first_ibuf;
-               int index, character;
+               const size_t textlen_st = textlen;
+               size_t index, character;
                float centerx, centery, sizex, sizey, transx, transy, movex, movey, advance;
                float advance_tab;
                
                float centerx, centery, sizex, sizey, transx, transy, movex, movey, advance;
                float advance_tab;
                
@@ -127,11 +128,11 @@ void GPU_render_text(MTFace *tface, int mode,
                advance_tab= advance * 4; /* tab width could also be an option */
                
                
                advance_tab= advance * 4; /* tab width could also be an option */
                
                
-               for (index = 0; index < textlen; index++) {
+               for (index = 0; index < textlen_st; ) {
                        float uv[4][2];
 
                        // lets calculate offset stuff
                        float uv[4][2];
 
                        // lets calculate offset stuff
-                       character = textstr[index];
+                       character = BLI_str_utf8_as_unicode_and_size_safe(textstr + index, &index);
                        
                        if (character=='\n') {
                                glTranslatef(line_start, -line_height, 0.0);
                        
                        if (character=='\n') {
                                glTranslatef(line_start, -line_height, 0.0);