diff options
author | Diego Borghetti <bdiego@gmail.com> | 2009-05-06 03:10:32 +0400 |
---|---|---|
committer | Diego Borghetti <bdiego@gmail.com> | 2009-05-06 03:10:32 +0400 |
commit | 405cf80eb8dc2df8ae160aee70aef34052add24a (patch) | |
tree | f03cc27e95bdf91b25ea9d2a0dffb28ccef666be /source/blender/blenfont/intern/blf_util.c | |
parent | 71c38978e14ebf3522fe60fc239ad04f10ef30ab (diff) |
Big, big commit!!
1) Remove WITH_FREETYPE2 from code, so now blender always need freetype2
2) Remove the old bmfont
3) Remove ftfont and bFTGL library
4) Implement a new BLF_draw_default function for place that still need/use
the old BMF api.
I try to update both, scons and cmake, but I only can test with make, so
hope all work fine.
MSVC is broken, but I don't have Windows, things to search and fix are
any reference to WITH_FREETYPE2, FTGL and BMFONT (take in care that
blenkernel also have a BKE_bmfont.h, this don't have anything to do with bmfont).
Always have to link/include the freetype2 library
Remove any reference to libbmfont
Remove any reference to libftfont
Remove any reference to libbftgl (or libbFTGL)
Diffstat (limited to 'source/blender/blenfont/intern/blf_util.c')
-rw-r--r-- | source/blender/blenfont/intern/blf_util.c | 102 |
1 files changed, 16 insertions, 86 deletions
diff --git a/source/blender/blenfont/intern/blf_util.c b/source/blender/blenfont/intern/blf_util.c index 8de6aea754b..03e1066caa1 100644 --- a/source/blender/blenfont/intern/blf_util.c +++ b/source/blender/blenfont/intern/blf_util.c @@ -76,34 +76,30 @@ int blf_utf8_next(unsigned char *buf, int *iindex) * * Returns 0 to indicate an error (e.g. invalid UTF8) */ - int index= *iindex, r; - unsigned char d= buf[index++], d2, d3, d4; + int index= *iindex, len, r; + unsigned char d, d2, d3, d4; + d= buf[index++]; if (!d) return(0); - if (d < 0x80) { - *iindex= index; - return(d); - } + while (buf[index] && ((buf[index] & 0xc0) == 0x80)) + index++; - if ((d & 0xe0) == 0xc0) { + len= index - *iindex; + if (len == 1) + r= d; + else if (len == 2) { /* 2 byte */ - d2= buf[index++]; - if ((d2 & 0xc0) != 0x80) - return(0); + d2= buf[*iindex + 1]; r= d & 0x1f; /* copy lower 5 */ r <<= 6; r |= (d2 & 0x3f); /* copy lower 6 */ } - else if ((d & 0xf0) == 0xe0) { + else if (len == 3) { /* 3 byte */ - d2= buf[index++]; - d3= buf[index++]; - - if ((d2 & 0xc0) != 0x80 || (d3 & 0xc0) != 0x80) - return(0); - + d2= buf[*iindex + 1]; + d3= buf[*iindex + 2]; r= d & 0x0f; /* copy lower 4 */ r <<= 6; r |= (d2 & 0x3f); @@ -112,14 +108,9 @@ int blf_utf8_next(unsigned char *buf, int *iindex) } else { /* 4 byte */ - d2= buf[index++]; - d3= buf[index++]; - d4= buf[index++]; - - if ((d2 & 0xc0) != 0x80 || (d3 & 0xc0) != 0x80 || - (d4 & 0xc0) != 0x80) - return(0); - + d2= buf[*iindex + 1]; + d3= buf[*iindex + 2]; + d4= buf[*iindex + 3]; r= d & 0x0f; /* copy lower 4 */ r <<= 6; r |= (d2 & 0x3f); @@ -131,64 +122,3 @@ int blf_utf8_next(unsigned char *buf, int *iindex) *iindex= index; return(r); } - -void blf_texture_draw(float uv[2][2], float dx, float y1, float dx1, float y2) -{ - - glBegin(GL_QUADS); - glTexCoord2f(uv[0][0], uv[0][1]); - glVertex2f(dx, y1); - - glTexCoord2f(uv[0][0], uv[1][1]); - glVertex2f(dx, y2); - - glTexCoord2f(uv[1][0], uv[1][1]); - glVertex2f(dx1, y2); - - glTexCoord2f(uv[1][0], uv[0][1]); - glVertex2f(dx1, y1); - glEnd(); - -} - -void blf_texture5_draw(float uv[2][2], float x1, float y1, float x2, float y2) -{ - float soft[25]= { - 1/60.0f, 1/60.0f, 2/60.0f, 1/60.0f, 1/60.0f, - 1/60.0f, 3/60.0f, 5/60.0f, 3/60.0f, 1/60.0f, - 2/60.0f, 5/60.0f, 8/60.0f, 5/60.0f, 2/60.0f, - 1/60.0f, 3/60.0f, 5/60.0f, 3/60.0f, 1/60.0f, - 1/60.0f, 1/60.0f, 2/60.0f, 1/60.0f, 1/60.0f}; - - float color[4], *fp= soft; - int dx, dy; - - glGetFloatv(GL_CURRENT_COLOR, color); - - for(dx=-2; dx<3; dx++) { - for(dy=-2; dy<3; dy++, fp++) { - glColor4f(color[0], color[1], color[2], fp[0]*color[3]); - blf_texture_draw(uv, x1+dx, y1+dy, x2+dx, y2+dy); - } - } - - glColor4fv(color); -} - -void blf_texture3_draw(float uv[2][2], float x1, float y1, float x2, float y2) -{ - float soft[9]= {1/16.0f, 2/16.0f, 1/16.0f, 2/16.0f, 4/16.0f, 2/16.0f, 1/16.0f, 2/16.0f, 1/16.0f}; - float color[4], *fp= soft; - int dx, dy; - - glGetFloatv(GL_CURRENT_COLOR, color); - - for(dx=-1; dx<2; dx++) { - for(dy=-1; dy<2; dy++, fp++) { - glColor4f(color[0], color[1], color[2], fp[0]*color[3]); - blf_texture_draw(uv, x1+dx, y1+dy, x2+dx, y2+dy); - } - } - - glColor4fv(color); -} |