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:
authorDiego Borghetti <bdiego@gmail.com>2009-05-06 03:10:32 +0400
committerDiego Borghetti <bdiego@gmail.com>2009-05-06 03:10:32 +0400
commit405cf80eb8dc2df8ae160aee70aef34052add24a (patch)
treef03cc27e95bdf91b25ea9d2a0dffb28ccef666be /source/blender/blenfont/intern/blf_glyph.c
parent71c38978e14ebf3522fe60fc239ad04f10ef30ab (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_glyph.c')
-rw-r--r--source/blender/blenfont/intern/blf_glyph.c69
1 files changed, 61 insertions, 8 deletions
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c
index 510204b0f51..551db2cdaa9 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -31,16 +31,12 @@
#include <string.h>
#include <math.h>
-#ifdef WITH_FREETYPE2
-
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_GLYPH_H
#include FT_OUTLINE_H
-#endif /* WITH_FREETYPE2 */
-
#include "MEM_guardedalloc.h"
#include "DNA_listBase.h"
@@ -59,8 +55,6 @@
#include "blf_internal.h"
-#ifdef WITH_FREETYPE2
-
GlyphCacheBLF *blf_glyph_cache_find(FontBLF *font, int size, int dpi)
{
GlyphCacheBLF *p;
@@ -433,6 +427,67 @@ void blf_glyph_free(GlyphBLF *g)
MEM_freeN(g);
}
+static 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();
+
+}
+
+static 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);
+}
+
+static 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);
+}
+
int blf_glyph_texture_render(FontBLF *font, GlyphBLF *g, float x, float y)
{
GlyphTextureBLF *gt;
@@ -504,5 +559,3 @@ int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y)
return(blf_glyph_bitmap_render(font, g, x, y));
return(blf_glyph_texture_render(font, g, x, y));
}
-
-#endif /* WITH_FREETYPE2 */