Page MenuHome

1.Bitmap_Font.patch

1.Bitmap_Font.patch

Index: source/blender/ftfont/FTF_Settings.h
===================================================================
--- source/blender/ftfont/FTF_Settings.h (revision 10951)
+++ source/blender/ftfont/FTF_Settings.h (working copy)
@@ -45,5 +45,6 @@
#define FTF_INPUT_UTF8 FTF_BIT(3)
#define FTF_PIXMAPFONT 0
#define FTF_TEXTUREFONT 1
+#define FTF_BITMAPFONT 2
#endif /* __FTF_SETTINGS_H */
Index: source/blender/ftfont/intern/FTF_TTFont.cpp
===================================================================
--- source/blender/ftfont/intern/FTF_TTFont.cpp (revision 10951)
+++ source/blender/ftfont/intern/FTF_TTFont.cpp (working copy)
@@ -239,6 +239,38 @@
return 1;
}
+ } else if(mode == FTF_BITMAPFONT) {
+
+ if(datasize) font = new FTGLBitmapFont(str, datasize);
+ else font = new FTGLBitmapFont( (char *)str);
+
+ err = font->Error();
+
+ if(err) {
+ printf("Failed to open font %s\n", str);
+ return 0;
+ } else {
+
+ fontm= font;
+
+ if(datasize) fonts = new FTGLBitmapFont(str, datasize);
+ else fonts = new FTGLBitmapFont((char *)str);
+ if(datasize) fontl = new FTGLBitmapFont(str, datasize);
+ else fontl = new FTGLBitmapFont((char *)str);
+
+ success = fonts->FaceSize(fontsize-2<8?8:fontsize-2);
+ success = fontm->FaceSize(fontsize-1<8?8:fontsize-1);
+ success = fontl->FaceSize(fontsize);
+ if(!success) return 0;
+
+ success = fonts->CharMap(ft_encoding_unicode);
+ success = fontm->CharMap(ft_encoding_unicode);
+ success = fontl->CharMap(ft_encoding_unicode);
+ if(!success) return 0;
+
+ return 1;
+ }
+
}
return 0;
}
@@ -338,7 +370,7 @@
glGetFloatv(GL_CURRENT_COLOR, color);
- if(mode == FTF_PIXMAPFONT) {
+ if(mode == FTF_PIXMAPFONT || mode == FTF_BITMAPFONT) {
glPixelTransferf(GL_RED_SCALE, color[0]);
glPixelTransferf(GL_GREEN_SCALE, color[1]);
@@ -393,14 +425,14 @@
if (FTF_USE_GETTEXT & flag) {
len=utf8towchar(wstr, gettext(str));
- if(mode == FTF_PIXMAPFONT) {
+ if(mode == FTF_PIXMAPFONT || mode == FTF_BITMAPFONT) {
return font->Advance(wstr);
} else if(mode == FTF_TEXTUREFONT) {
return font->Advance(wstr);// * fsize;
}
}
else {
- if(mode == FTF_PIXMAPFONT) {
+ if(mode == FTF_PIXMAPFONT || mode == FTF_BITMAPFONT) {
return font->Advance(str);
} else if(mode == FTF_TEXTUREFONT) {
return font->Advance(str);// * fsize;
@@ -444,3 +476,4 @@
}
+
Index: source/blender/ftfont/intern/FTF_TTFont.h
===================================================================
--- source/blender/ftfont/intern/FTF_TTFont.h (revision 10951)
+++ source/blender/ftfont/intern/FTF_TTFont.h (working copy)
@@ -38,6 +38,7 @@
#define __FTF_TRUETYPE_FONT_H
#include "FTGLPixmapFont.h"
+#include "FTGLBitmapFont.h"
#include "FTGLTextureFont.h"
#include <stdio.h>
@@ -107,7 +108,7 @@
char font_name[128];
int font_size;
- int mode; // 0 = pixmap, 1 = texture
+ int mode; // 0 = pixmap, 1 = texture, 2 = bitmap
float pen_x, pen_y; //rasterpos
float fsize;
Index: source/blender/include/blendef.h
===================================================================
--- source/blender/include/blendef.h (revision 10951)
+++ source/blender/include/blendef.h (working copy)
@@ -279,7 +279,7 @@
#define B_SETTRANSBUTS 315
#define B_DOLANGUIFONT 316
#define B_RESTOREFONT 317
-#define B_USETEXTUREFONT 318
+#define B_FONTTYPE 318
#define B_UITHEMECHANGED 320
#define B_UITHEMECOLORMOD 321
Index: source/blender/makesdna/DNA_userdef_types.h
===================================================================
--- source/blender/makesdna/DNA_userdef_types.h (revision 10951)
+++ source/blender/makesdna/DNA_userdef_types.h (working copy)
@@ -181,7 +181,7 @@
short recent_files; /* maximum number of recently used files to remember */
short smooth_viewtx; /* miliseconds to spend spinning the view */
short glreslimit;
- char pad[4];
+ int fonttype;
} UserDef;
extern UserDef U; /* from usiblender.c !!!! */
@@ -243,6 +243,7 @@
#define USER_TR_TEXTEDIT 16
#define USER_DOTRANSLATE 32
#define USER_USETEXTUREFONT 64
+#define USER_USEBITMAPFONT 128
/* dupflag */
Index: source/blender/src/headerbuttons.c
===================================================================
--- source/blender/src/headerbuttons.c (revision 10951)
+++ source/blender/src/headerbuttons.c (working copy)
@@ -1505,7 +1505,8 @@
allqueue(REDRAWALL, 0);
break;
- case B_USETEXTUREFONT: /* is button from space.c *info* */
+ case B_FONTTYPE: /* is button from space.c *info* */
+ U.transopts = U.transopts & 0x3f | U.fonttype;
refresh_interface_font();
allqueue(REDRAWALL, 0);
break;
@@ -2037,3 +2038,4 @@
else if(event>=REDRAWVIEW3D) allqueue(event, 0);
}
+
Index: source/blender/src/language.c
===================================================================
--- source/blender/src/language.c (revision 10951)
+++ source/blender/src/language.c (working copy)
@@ -180,7 +180,21 @@
return string;
}
+char *font_pup(void)
+{
+ static char string[1024];
+ char formatstring[1024];
+ strcpy(formatstring, "Choose Font Type: %%t|%s %%x%d|%s %%x%d|%s %%x%d");
+ sprintf(string, formatstring,
+ "Use Textured Font", 1<<6,
+ "Use Bitmap Font", 1<<7,
+ "Use Pixmap Font", 1<<8
+ );
+
+ return (string);
+}
+
struct LANGMenuEntry *find_language(short langid)
{
struct LANGMenuEntry *lme = langmenu;
@@ -233,6 +247,8 @@
if(U.transopts & USER_USETEXTUREFONT)
FTF_SetMode(FTF_TEXTUREFONT);
+ else if(U.transopts & USER_USEBITMAPFONT)
+ FTF_SetMode(FTF_BITMAPFONT);
else
FTF_SetMode(FTF_PIXMAPFONT);
Index: source/blender/src/space.c
===================================================================
--- source/blender/src/space.c (revision 10951)
+++ source/blender/src/space.c (working copy)
@@ -3603,10 +3603,9 @@
(xpos+edgsp+(2.2*mpref)+(3*midsp)),y2,mpref+(0.5*mpref)+3,buth,
&U.language, 0, 0, 0, 0, "Select interface language");
- uiDefButBitS(block, TOG, USER_USETEXTUREFONT, B_USETEXTUREFONT, "Use Textured Fonts",
+ uiDefButI(block, MENU, B_FONTTYPE, font_pup(),
(xpos+edgsp+(4*mpref)+(4*midsp)),y2,mpref,buth,
- &(U.transopts), 0, 0, 0, 0,
- "Use Textured Fonts");
+ &(U.fonttype), 0, 0, 0, 0, "Select font type");
}
/* end of INTERNATIONAL */

File Metadata

Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
43/f3/b782aa51d9ed54aa1c9fffebfb61

Event Timeline