Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-04-09 14:05:17 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-04-09 14:05:17 +0400
commitc29d51f1e877f9e486aff9abb530418419ce79d8 (patch)
treee0840c87c2e2eb22cd813087be65f0f17934c021 /source/blender/gpu
parenteacf5b5d6d406492ba79b44f9319867230585e9b (diff)
BGE Text - fix for tab drawing as an @ and not adding white space.
Tab width is always space*4.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/intern/gpu_draw.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index c0033c89d5c..7b1fc67d0c6 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -83,7 +83,9 @@ void GPU_render_text(MTFace *tface, int mode,
Image* ima;
int characters, index, character;
float centerx, centery, sizex, sizey, transx, transy, movex, movey, advance;
-
+ float advance_tab;
+
+
/* multiline */
float line_start= 0.0f, line_height;
if (v4)
@@ -107,6 +109,13 @@ void GPU_render_text(MTFace *tface, int mode,
glPushMatrix();
+ /* get the tab width */
+ matrixGlyph((ImBuf *)ima->ibufs.first, ' ', & centerx, &centery,
+ &sizex, &sizey, &transx, &transy, &movex, &movey, &advance);
+
+ advance_tab= advance * 4; /* tab width could also be an option */
+
+
for (index = 0; index < characters; index++) {
float uv[4][2];
@@ -118,6 +127,12 @@ void GPU_render_text(MTFace *tface, int mode,
line_start = 0.0f;
continue;
}
+ else if (character=='\t') {
+ glTranslatef(advance_tab, 0.0, 0.0);
+ line_start -= advance_tab; /* so we can go back to the start of the line */
+ continue;
+
+ }
// space starts at offset 1
// character = character - ' ' + 1;