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:
authorJoilnen Leite <joilnen.leite@gmail.com>2007-07-30 19:59:16 +0400
committerJoilnen Leite <joilnen.leite@gmail.com>2007-07-30 19:59:16 +0400
commit443a64135ea25b19cb5212c99cf85444ebb782d0 (patch)
tree75acf4f51b07f382b5bf81135b85b4c151e6db1f /source/blender/ftfont
parentecd42c43427dd9abd8371554e623b64103587e2f (diff)
Font preview
Diffstat (limited to 'source/blender/ftfont')
-rw-r--r--source/blender/ftfont/FTF_Api.h4
-rw-r--r--source/blender/ftfont/SConscript2
-rw-r--r--source/blender/ftfont/intern/FTF_Api.cpp32
-rw-r--r--source/blender/ftfont/intern/Makefile1
4 files changed, 38 insertions, 1 deletions
diff --git a/source/blender/ftfont/FTF_Api.h b/source/blender/ftfont/FTF_Api.h
index 15fa55c905d..b370c18f89e 100644
--- a/source/blender/ftfont/FTF_Api.h
+++ b/source/blender/ftfont/FTF_Api.h
@@ -154,6 +154,10 @@ FTF_EXPORT void FTF_SetScale(float fsize);
FTF_EXPORT void FTF_End(void);
+/* Font preview functions */
+FTF_EXPORT int FTF_GetNewFont (const unsigned char *str, int datasize, int fontsize);
+FTF_EXPORT float FTF_DrawNewFontString(char* str, unsigned int flag);
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/ftfont/SConscript b/source/blender/ftfont/SConscript
index cf6805d6bb3..615b274677c 100644
--- a/source/blender/ftfont/SConscript
+++ b/source/blender/ftfont/SConscript
@@ -4,7 +4,7 @@ Import ('env')
sources = env.Glob('intern/*.cpp')
-incs = '. intern ../blenkernel ../blenlib ../makesdna'
+incs = '. intern ../blenkernel ../blenlib ../makesdna ../include'
incs += ' ' + env['BF_FTGL_INC']
incs += ' ' + env['BF_FREETYPE_INC']
incs += ' ' + env['BF_GETTEXT_INC']
diff --git a/source/blender/ftfont/intern/FTF_Api.cpp b/source/blender/ftfont/intern/FTF_Api.cpp
index 52fc9378f00..bf6698a1cde 100644
--- a/source/blender/ftfont/intern/FTF_Api.cpp
+++ b/source/blender/ftfont/intern/FTF_Api.cpp
@@ -43,8 +43,18 @@
#include "../FTF_Api.h"
#include "FTF_TTFont.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+ #include "datatoc.h"
+#ifdef __cplusplus
+}
+#endif
+
#define FTF_EXPORT
+FTF_TTFont *newfont= 0; // preview font
+
static FTF_TTFont *_FTF_GetFont(void) {
static FTF_TTFont *theFont = NULL;
@@ -55,8 +65,28 @@ static FTF_TTFont *_FTF_GetFont(void) {
return theFont;
}
+FTF_EXPORT int FTF_GetNewFont (const unsigned char *str, int datasize, int fontsize) {
+
+ if (newfont) delete newfont;
+ newfont= new FTF_TTFont();
+
+ if (!(newfont->SetFont((unsigned char*)str, datasize, fontsize))) {
+ newfont->SetFont((unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size, fontsize);
+ return 0;
+ }
+ return 1;
+}
+
+FTF_EXPORT float FTF_DrawNewFontString(char* str, unsigned int flag)
+{
+ if (newfont)
+ return newfont->DrawString(str, flag);
+ return 0.0f;
+}
+
FTF_EXPORT void FTF_End(void) {
delete _FTF_GetFont();
+ delete newfont;
}
FTF_EXPORT void FTF_SetSize(int size)
@@ -174,3 +204,5 @@ FTF_EXPORT void FTF_SetScale(float fsize)
{
_FTF_GetFont()->SetScale(fsize);
}
+
+
diff --git a/source/blender/ftfont/intern/Makefile b/source/blender/ftfont/intern/Makefile
index d3a1977994b..a9ac8067164 100644
--- a/source/blender/ftfont/intern/Makefile
+++ b/source/blender/ftfont/intern/Makefile
@@ -46,6 +46,7 @@ CFLAGS += $(LEVEL_1_C_WARNINGS)
CPPFLAGS += -I../../makesdna
CPPFLAGS += -I../../blenkernel
CPPFLAGS += -I../../blenlib
+CPPFLAGS += -I../../include
CPPFLAGS += -I$(NAN_FTGL)/include
CPPFLAGS += -I$(NAN_FTGL)/include/FTGL
CPPFLAGS += -I$(NAN_GETTEXT)/include