forked from bartvdbraak/blender
BGE Text - fix for tab drawing as an @ and not adding white space.
Tab width is always space*4.
This commit is contained in:
parent
eacf5b5d6d
commit
c29d51f1e8
@ -83,6 +83,8 @@ 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;
|
||||
@ -107,6 +109,13 @@ void GPU_render_text(MTFace *tface, int mode,
|
||||
|
||||
glPushMatrix();
|
||||
|
||||
/* get the tab width */
|
||||
matrixGlyph((ImBuf *)ima->ibufs.first, ' ', & centerx, ¢ery,
|
||||
&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;
|
||||
|
Loading…
Reference in New Issue
Block a user