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:
authorRob Haarsma <phaseIV@zonnet.nl>2003-05-03 16:17:11 +0400
committerRob Haarsma <phaseIV@zonnet.nl>2003-05-03 16:17:11 +0400
commitb43473e4257c6ce958c7811b7e44cb085a4f3b07 (patch)
treeb183d7b446b699649e3c09aa65c399910fbbc212 /source/blender/ftfont
parentda1e6bae44de43df974524ae47ac46e3f1e2fa39 (diff)
Multilingual interface support added.
All modifications are behind compileflag INTERNATIONAL, and affect these two directories; source/blender/src and source/blender/ftfont. Thanks to philipp, a new utf8towchar() function is added to Shizu's work, which fixes the international support for OSX. It also makes the iconv library obsolete. This means all translation files (blender.mo) need to be 'recoded' to UTF-8, and language support in the fileselect window and the text editor is not possible. Iconv might be added in the future to enable these features.
Diffstat (limited to 'source/blender/ftfont')
-rw-r--r--source/blender/ftfont/FTF_Api.h158
-rw-r--r--source/blender/ftfont/FTF_Settings.h47
-rw-r--r--source/blender/ftfont/Makefile37
-rw-r--r--source/blender/ftfont/intern/FTF_Api.cpp152
-rw-r--r--source/blender/ftfont/intern/FTF_TTFont.cpp284
-rw-r--r--source/blender/ftfont/intern/FTF_TTFont.h109
-rw-r--r--source/blender/ftfont/intern/Makefile59
7 files changed, 846 insertions, 0 deletions
diff --git a/source/blender/ftfont/FTF_Api.h b/source/blender/ftfont/FTF_Api.h
new file mode 100644
index 00000000000..4fa97f0acba
--- /dev/null
+++ b/source/blender/ftfont/FTF_Api.h
@@ -0,0 +1,158 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+#ifndef _FTF_API_H
+#define _FTF_API_H
+
+#define FTF_EXPORT
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+#include "FTF_Settings.h"
+
+/**
+ * Set Font Size
+ * @param int size
+ */
+FTF_EXPORT void FTF_SetSize(int size);
+
+/**
+ * Get Font Size
+ * @return Font size
+ */
+FTF_EXPORT int FTF_GetSize(void);
+
+/**
+ * Ascender
+ * @return Ascend size
+ */
+FTF_EXPORT int FTF_Ascender(void);
+
+/**
+ * Descender
+ * @return Descend size
+ */
+FTF_EXPORT int FTF_Descender(void);
+
+/**
+ * String Translation and Code Conversion
+ * @param str source string
+ * @param ustr distnation string
+ * @param flag mode flag
+ */
+FTF_EXPORT void FTF_TransConvString(char* str, char* ustr, unsigned int flag);
+
+/**
+ * Draw a character at the current raster position.
+ * @param c the character to draw
+ * @param mode flag to forward to FTF_TransConvString()
+ * @return Width drawing
+ */
+//FTF_EXPORT float FTF_DrawCharacter(char c, unsigned int flag);
+
+/**
+ * Draws a string at the current raster postion.
+ * @param str The string to draw
+ * @param mode flag to forward to FTF_TransConvString()
+ * @return Width drawing
+ */
+FTF_EXPORT float FTF_DrawString(char* str, unsigned int flag, int select);
+
+/**
+ * Draws a string at the current raster postion with rgb coloring.
+ * @param str The string to draw
+ * @param rgb Floats to manipulate the the glyph pixmap coloring.
+ * @param mode flag to forward to FTF_TransConvString()
+ * @return Width drawing
+ */
+FTF_EXPORT float FTF_DrawStringRGB(char* str, unsigned int flag, float r, float g, float b);
+
+/**
+ * Get a character width
+ * @param mode flag to forward to FTF_TransConvString()
+ */
+FTF_EXPORT float FTF_GetCharacterWidth(char c, unsigned int flag);
+
+
+/**
+ * Get a string width
+ * @param mode flag to forward to FTF_TransConvString()
+ */
+FTF_EXPORT float FTF_GetStringWidth(char* str, unsigned int flag);
+
+/**
+ * Get Bounding Box
+ * @param llx
+ * @param lly
+ * @param llz
+ * @param urx
+ * @param ury
+ * @param urz
+ * @param mode flag to forward to FTF_TransConvString()
+ * not test yet.
+ */
+FTF_EXPORT void FTF_GetBoundingBox(char* str, float*llx, float *lly, float *llz, float *urx, float *ury, float *urz, unsigned int flag);
+
+/**
+ * Following stuff added by phase
+ */
+
+/**
+ * SetFont
+ * @param str
+ * @param size
+ */
+FTF_EXPORT int FTF_SetFont(char* str, int size);
+
+/**
+ * SetLanguage
+ * @param str
+ * not test yet.
+ */
+FTF_EXPORT void FTF_SetLanguage(char* str);
+
+/**
+ * SetLanguage
+ * @param str
+ * not tested yet.
+ */
+FTF_EXPORT void FTF_SetEncoding(char* str);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __FTF_API_H */
+
diff --git a/source/blender/ftfont/FTF_Settings.h b/source/blender/ftfont/FTF_Settings.h
new file mode 100644
index 00000000000..d9263baf5a2
--- /dev/null
+++ b/source/blender/ftfont/FTF_Settings.h
@@ -0,0 +1,47 @@
+/**
+ * $Id$
+ * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Copyright (C) 2002 Blender Foundation. All Rights Reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+/**
+
+ * $Id$
+ * Copyright (C) 2001 NaN Technologies B.V.
+ * Allows you to determine which fonts to include in the library.
+ */
+
+#ifndef __FTF_SETTINGS_H
+#define __FTF_SETTINGS_H
+
+#define FTF_BIT(num) ((unsigned int)1 << (num))
+#define FTF_NO_TRANSCONV 0
+#define FTF_INPUT_SYSTEM_ENCODING FTF_BIT(1)
+#define FTF_USE_GETTEXT FTF_BIT(2)
+#define FTF_INPUT_UTF8 FTF_BIT(3)
+
+#endif /* __FTF_SETTINGS_H */
diff --git a/source/blender/ftfont/Makefile b/source/blender/ftfont/Makefile
new file mode 100644
index 00000000000..1717fa34853
--- /dev/null
+++ b/source/blender/ftfont/Makefile
@@ -0,0 +1,37 @@
+#
+# $Id$
+#
+# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version. The Blender
+# Foundation also sells licenses for use in proprietary software under
+# the Blender License. See http://www.blender.org/BL/ for information
+# about this.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+# All rights reserved.
+#
+# The Original Code is: all of this file.
+#
+# Contributor(s): none yet.
+#
+# ***** END GPL/BL DUAL LICENSE BLOCK *****
+#
+# Bounces make to subdirectories.
+
+SOURCEDIR = source/blender/ftfont
+DIRS = intern
+
+include nan_subdirs.mk
diff --git a/source/blender/ftfont/intern/FTF_Api.cpp b/source/blender/ftfont/intern/FTF_Api.cpp
new file mode 100644
index 00000000000..ac158ae191f
--- /dev/null
+++ b/source/blender/ftfont/intern/FTF_Api.cpp
@@ -0,0 +1,152 @@
+/**
+ * $Id$
+ * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Copyright (C) 2002 Blender Foundation. All Rights Reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+/**
+
+ * $Id$
+ * Copyright (C) 2001 NaN Technologies B.V.
+ *
+ * Implementation of the API of FTGL library.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "../FTF_Api.h"
+#include "FTF_TTFont.h"
+
+#define FTF_EXPORT
+
+static FTF_TTFont ttfont;
+
+
+FTF_EXPORT void FTF_SetSize(int size)
+{
+ ttfont.SetSize(size);
+}
+
+FTF_EXPORT int FTF_GetSize(void)
+{
+ return ttfont.GetSize();
+}
+
+
+FTF_EXPORT int FTF_Ascender(void)
+{
+ return ttfont.Ascender();
+}
+
+FTF_EXPORT int FTF_Descender(void)
+{
+ return ttfont.Descender();
+}
+
+
+FTF_EXPORT void FTF_TransConvString(char* str, char* ustr, unsigned int flag)
+{
+ ttfont.TransConvString(str, ustr, flag);
+}
+
+/*
+FTF_EXPORT float FTF_DrawCharacter(char c, unsigned int flag)
+{
+ char str[2] = {c, '\0'};
+ return FTF_DrawString(str, flag);
+}
+*/
+
+
+FTF_EXPORT float FTF_DrawString(char* str, unsigned int flag, int select)
+{
+ return ttfont.DrawString(str, flag, select);
+}
+
+
+FTF_EXPORT float FTF_DrawStringRGB(char* str, unsigned int flag, float r, float g, float b)
+{
+ return ttfont.DrawStringRGB(str, flag, r, g, b);
+}
+
+
+/**
+ * not implemente yet.
+ */
+FTF_EXPORT float FTF_GetCharacterWidth(char c, unsigned int flag)
+{
+ char str[2] = {c, '\0'};
+ return FTF_GetStringWidth(str, flag);
+}
+
+
+/**
+ * not implemente yet.
+ */
+FTF_EXPORT float FTF_GetStringWidth(char* str, unsigned int flag)
+{
+ return ttfont.GetStringWidth(str, flag);
+}
+
+
+/**
+ * not implemente yet.
+ * ## This return string box!! ##
+ */
+FTF_EXPORT void FTF_GetBoundingBox(char* str, float *llx, float *lly, float *llz, float *urx, float *ury, float *urz, unsigned int flag)
+{
+ ttfont.GetBoundingBox(str, llx, lly, llz, urx, ury, urz, flag);
+}
+
+/**
+ * added by phase
+ *
+ */
+FTF_EXPORT int FTF_SetFont(char* str, int size)
+{
+ return ttfont.SetFont(str, size);
+}
+
+/**
+ * added by phase
+ *
+ */
+FTF_EXPORT void FTF_SetLanguage(char* str)
+{
+ ttfont.SetLanguage(str);
+}
+
+/**
+ * added by phase
+ *
+ */
+FTF_EXPORT void FTF_SetEncoding(char* str)
+{
+ ttfont.SetEncoding(str);
+}
diff --git a/source/blender/ftfont/intern/FTF_TTFont.cpp b/source/blender/ftfont/intern/FTF_TTFont.cpp
new file mode 100644
index 00000000000..761f301b448
--- /dev/null
+++ b/source/blender/ftfont/intern/FTF_TTFont.cpp
@@ -0,0 +1,284 @@
+/**
+ * $Id$
+ * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Copyright (C) 2002 Blender Foundation. All Rights Reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+/**
+
+ * $Id$
+ * Copyright (C) 2001 NaN Technologies B.V.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <locale.h>
+#include "libintl.h"
+#include "../FTF_Settings.h"
+
+#include "FTF_TTFont.h"
+
+#define DOMAIN_NAME "blender"
+#define MESSAGE_FILE "message"
+
+#define SYSTEM_ENCODING_DEFAULT "UTF-8"
+#define FONT_SIZE_DEFAULT 12
+//#define FONT_PATH_DEFAULT ".bfont.ttf"
+
+#define FTF_MAX_STR_SIZE 256
+
+
+int utf8towchar(wchar_t *w, char *c)
+{
+ int len=0;
+ if(w==NULL || c==NULL) return(0);
+ //printf("%s\n",c);
+ while(*c)
+ {
+ //Converts Unicode to wchar:
+
+ if(*c & 0x80)
+ {
+ if(*c & 0x40)
+ {
+ if(*c & 0x20)
+ {
+ if(*c & 0x10)
+ {
+ *w=(c[0] & 0x0f)<<18 | (c[1]&0x1f)<<12 | (c[2]&0x3f)<<6 | (c[3]&0x7f);
+ c++;
+ }
+ else
+ *w=(c[0] & 0x1f)<<12 | (c[1]&0x3f)<<6 | (c[2]&0x7f);
+ c++;
+ }
+ else
+ *w=(c[0] &0x3f)<<6 | c[1]&0x7f;
+ c++;
+ }
+ else
+ *w=(c[0] & 0x7f);
+ }
+ else
+ *w=(c[0] & 0x7f);
+
+ c++;
+ w++;
+ len++;
+ }
+ return len;
+}
+
+
+FTF_TTFont::FTF_TTFont(void)
+{
+ font=NULL;
+ font_size=FONT_SIZE_DEFAULT;
+ strcpy(encoding_name, SYSTEM_ENCODING_DEFAULT);
+}
+
+
+FTF_TTFont::~FTF_TTFont(void)
+{
+ if (font) delete font;
+}
+
+
+int FTF_TTFont::SetFont(char* str, int size)
+{
+ int err = 0;
+ bool success = 0;
+
+ delete font;
+
+ font = new FTGLPixmapFont(str);
+ err = font->Error();
+
+ if(err) {
+// printf("Failed to open font %s\n", str);
+ return 0;
+ } else {
+ success = font->FaceSize(size);
+ if(!success) return 0;
+
+ success = font->CharMap(ft_encoding_unicode);
+ if(!success) return 0;
+
+ return 1;
+ }
+}
+
+
+void FTF_TTFont::SetLanguage(char* str)
+{
+#if defined (_WIN32) || defined(__APPLE__)
+ char envstr[12];
+
+ sprintf(envstr, "LANG=%s", str);
+ envstr[strlen(envstr)]='\0';
+#ifdef _WIN32
+ gettext_putenv(envstr);
+#else
+ putenv(envstr);
+ setlocale(LC_ALL, str);
+#endif
+#else
+ char *locreturn;
+
+ locreturn = setlocale(LC_ALL, str);
+ if (locreturn == NULL) {
+ printf("could not change language to %s\n", str);
+ }
+
+ setlocale(LC_NUMERIC, "C");
+#endif
+
+ bindtextdomain(DOMAIN_NAME, MESSAGE_FILE);
+ textdomain(DOMAIN_NAME);
+
+ strcpy(language, str);
+}
+
+
+void FTF_TTFont::SetEncoding(char* str)
+{
+ strcpy(encoding_name, str);
+}
+
+
+void FTF_TTFont::SetSize(int size)
+{
+ font->FaceSize(size);
+ font_size = size;
+}
+
+int FTF_TTFont::GetSize(void)
+{
+ return font_size;
+}
+
+int FTF_TTFont::Ascender(void)
+{
+ return font->Ascender();
+}
+
+int FTF_TTFont::Descender(void)
+{
+ return font->Descender();
+}
+
+
+int FTF_TTFont::TransConvString(char* str, char* ustr, unsigned int flag)
+{
+ return 0;
+}
+
+
+float FTF_TTFont::DrawString(char* str, unsigned int flag, int select)
+{
+ char ustr[FTF_MAX_STR_SIZE*2]={0};
+ wchar_t wstr[255]={'\0'};
+ int len=0;
+
+ if (FTF_USE_GETTEXT & flag)
+ len=utf8towchar(wstr,gettext(str));
+ else
+ len=utf8towchar(wstr,str);
+
+ if(!select) {
+ glPixelTransferf(GL_RED_SCALE, 0.0);
+ glPixelTransferf(GL_GREEN_SCALE, 0.0);
+ glPixelTransferf(GL_BLUE_SCALE, 0.0);
+ }
+
+ font->Render(wstr);
+
+ if(!select) {
+ glPixelTransferf(GL_RED_SCALE, 1.0);
+ glPixelTransferf(GL_GREEN_SCALE, 1.0);
+ glPixelTransferf(GL_BLUE_SCALE, 1.0);
+ }
+
+ return font->Advance(wstr);
+}
+
+
+float FTF_TTFont::DrawStringRGB(char* str, unsigned int flag, float r, float g, float b)
+{
+ char ustr[FTF_MAX_STR_SIZE*2]={0};
+ wchar_t wstr[255]={'\0'};
+ int len=0;
+
+ if (FTF_USE_GETTEXT & flag)
+ len=utf8towchar(wstr,gettext(str));
+ else
+ len=utf8towchar(wstr,str);
+
+ glPixelTransferf(GL_RED_SCALE, r);
+ glPixelTransferf(GL_GREEN_SCALE, g);
+ glPixelTransferf(GL_BLUE_SCALE, b);
+
+ font->Render(wstr);
+
+ glPixelTransferf(GL_RED_SCALE, 1.0);
+ glPixelTransferf(GL_GREEN_SCALE, 1.0);
+ glPixelTransferf(GL_BLUE_SCALE, 1.0);
+
+ return font->Advance(wstr);
+}
+
+
+float FTF_TTFont::GetStringWidth(char* str, unsigned int flag)
+{
+ char ustr[FTF_MAX_STR_SIZE*2]={0};
+ wchar_t wstr[255]={'\0'};
+ int len=0;
+
+ if (FTF_USE_GETTEXT & flag)
+ len=utf8towchar(wstr,gettext(str));
+ else
+ len=utf8towchar(wstr,str);
+
+ return font->Advance(wstr);
+}
+
+
+void FTF_TTFont::GetBoundingBox(char* str, float *llx, float *lly, float *llz, float *urx, float *ury, float *urz, unsigned int flag)
+{
+ char ustr[FTF_MAX_STR_SIZE*2]={0};
+ wchar_t wstr[255]={'\0'};
+ int len=0;
+
+ if (FTF_USE_GETTEXT & flag)
+ len=utf8towchar(wstr,gettext(str));
+ else
+ len=utf8towchar(wstr,str);
+
+ font->BBox(wstr, *llx, *lly, *llz, *urx, *ury, *urz);
+}
+
diff --git a/source/blender/ftfont/intern/FTF_TTFont.h b/source/blender/ftfont/intern/FTF_TTFont.h
new file mode 100644
index 00000000000..c42685c2221
--- /dev/null
+++ b/source/blender/ftfont/intern/FTF_TTFont.h
@@ -0,0 +1,109 @@
+/**
+ * $Id$
+ * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License. See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Copyright (C) 2002 Blender Foundation. All Rights Reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+
+/**
+
+ * $Id$
+ * Copyright (C) 2001 NaN Technologies B.V.
+ */
+
+#ifndef __FTF_TRUETYPE_FONT_H
+#define __FTF_TRUETYPE_FONT_H
+
+#include "FTGLPixmapFont.h"
+#include <stdio.h>
+//#include <iconv.h>
+
+
+/**
+ * Base class for Using FTGL, iconv and gettext Library.
+ */
+class FTF_TTFont
+{
+public:
+ /**
+ * Default constructor.
+ */
+ FTF_TTFont(void);
+
+ /**
+ * Destructor.
+ */
+ virtual ~FTF_TTFont(void);
+
+
+ void SetSize(int size);
+ int GetSize(void);
+
+ int Ascender(void);
+ int Descender(void);
+
+ int TransConvString(char* str, char* ustr, unsigned int flag);
+
+ /**
+ * Draws a string at the current raster position.
+ * @param str The string to draw.
+ * @param flag Whether use gettext and UTF8 or system encoding.
+ */
+ float DrawString(char* str, unsigned int flag, int select);
+// float DrawString(char* str, unsigned char r, unsigned char g, unsigned char b, unsigned int flag);
+ float DrawStringRGB(char* str, unsigned int flag, float r, float g, float b);
+
+ float GetStringWidth(char* str, unsigned int flag);
+
+ void GetBoundingBox(char* str, float *llx, float *lly, float *llz, float *urx, float *ury, float *urz, unsigned int flag);
+
+ /**
+ * added by phase
+ * functions to communicate with the preference menu
+ */
+ int SetFont(char* str, int size);
+
+ void SetLanguage(char* str);
+
+ void SetEncoding(char* str);
+
+protected:
+ char language[32];
+ char encoding_name[32];
+ char font_name[128];
+ int font_size;
+
+ /** FTGL's */
+ FTFont* font;
+
+ /** from system encoding in .locale to UNICODE */
+// iconv_t cd;
+
+ /** from UTF-8 to UNICODE */
+// iconv_t ucd;
+};
+
+#endif // __FTF_TRUETYPE_FONT_H
diff --git a/source/blender/ftfont/intern/Makefile b/source/blender/ftfont/intern/Makefile
new file mode 100644
index 00000000000..16e0b76c5e7
--- /dev/null
+++ b/source/blender/ftfont/intern/Makefile
@@ -0,0 +1,59 @@
+#
+# $Id$
+#
+# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version. The Blender
+# Foundation also sells licenses for use in proprietary software under
+# the Blender License. See http://www.blender.org/BL/ for information
+# about this.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+# All rights reserved.
+#
+# The Original Code is: all of this file.
+#
+# Contributor(s): none yet.
+#
+# ***** END GPL/BL DUAL LICENSE BLOCK *****
+#
+#
+
+LIBNAME = ftfont
+DIR = $(OCGDIR)/blender/ftfont
+
+include nan_compile.mk
+
+ifeq ($(OS),$(findstring $(OS), "beos darwin freebsd linux openbsd solaris windows"))
+ CFLAGS += -funsigned-char
+endif
+
+CFLAGS += $(LEVEL_1_C_WARNINGS)
+
+#CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
+#CPPFLAGS += -I../../makesdna
+CPPFLAGS += -I$(NAN_FTGL)/include
+ifeq ($(OS), windows)
+ CPPFLAGS += -I$(NAN_ICONV)/include
+ CPPFLAGS += -I$(NAN_GETTEXT)/include
+ CPPFLAGS += -I$(NAN_FREETYPE)/include
+ ifeq ($(FREE_WINDOWS), true)
+ CPPFLAGS += -I$(NAN_FREETYPE)/include/freetype2
+ CPPFLAGS += -DUSE_GETTEXT_DLL
+ endif
+else
+ CPPFLAGS += -I$(NAN_FREETYPE)/include/freetype2
+endif
+CPPFLAGS += -I..