diff options
author | Rob Haarsma <phaseIV@zonnet.nl> | 2005-01-21 17:48:03 +0300 |
---|---|---|
committer | Rob Haarsma <phaseIV@zonnet.nl> | 2005-01-21 17:48:03 +0300 |
commit | 136ecd46442d5cb95c7f546e5a401d5df458a2f9 (patch) | |
tree | d837c5ca98abc7ff6844749aa2c2e2760b2d78b8 /source | |
parent | 465b15eb695ef96534b008199fa90af0936febde (diff) |
Modified interface texture font support, which should work nicely with the freshly added bFTGL library.
Also removed some redundant #include's on some files.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/ftfont/intern/FTF_Api.cpp | 4 | ||||
-rw-r--r-- | source/blender/ftfont/intern/FTF_TTFont.cpp | 33 | ||||
-rw-r--r-- | source/blender/ftfont/intern/FTF_TTFont.h | 4 | ||||
-rw-r--r-- | source/blender/include/BIF_language.h | 1 | ||||
-rw-r--r-- | source/blender/include/blendef.h | 1 | ||||
-rw-r--r-- | source/blender/src/header_action.c | 6 | ||||
-rw-r--r-- | source/blender/src/header_buttonswin.c | 6 | ||||
-rw-r--r-- | source/blender/src/header_filesel.c | 6 | ||||
-rw-r--r-- | source/blender/src/header_image.c | 6 | ||||
-rw-r--r-- | source/blender/src/header_info.c | 8 | ||||
-rw-r--r-- | source/blender/src/header_ipo.c | 6 | ||||
-rw-r--r-- | source/blender/src/header_nla.c | 6 | ||||
-rw-r--r-- | source/blender/src/header_script.c | 6 | ||||
-rw-r--r-- | source/blender/src/headerbuttons.c | 23 | ||||
-rw-r--r-- | source/blender/src/interface.c | 9 | ||||
-rw-r--r-- | source/blender/src/interface_draw.c | 1 | ||||
-rw-r--r-- | source/blender/src/language.c | 8 | ||||
-rw-r--r-- | source/blender/src/space.c | 9 |
18 files changed, 40 insertions, 103 deletions
diff --git a/source/blender/ftfont/intern/FTF_Api.cpp b/source/blender/ftfont/intern/FTF_Api.cpp index 036e13a7e6e..52fc9378f00 100644 --- a/source/blender/ftfont/intern/FTF_Api.cpp +++ b/source/blender/ftfont/intern/FTF_Api.cpp @@ -69,7 +69,7 @@ FTF_EXPORT int FTF_GetSize(void) return _FTF_GetFont()->GetSize(); } - +/* FTF_EXPORT int FTF_Ascender(void) { return _FTF_GetFont()->Ascender(); @@ -79,7 +79,7 @@ FTF_EXPORT int FTF_Descender(void) { return _FTF_GetFont()->Descender(); } - +*/ FTF_EXPORT void FTF_TransConvString(char* str, char* ustr, unsigned int flag) { diff --git a/source/blender/ftfont/intern/FTF_TTFont.cpp b/source/blender/ftfont/intern/FTF_TTFont.cpp index d25c60ea402..0c979ea5a94 100644 --- a/source/blender/ftfont/intern/FTF_TTFont.cpp +++ b/source/blender/ftfont/intern/FTF_TTFont.cpp @@ -156,13 +156,9 @@ FTF_TTFont::~FTF_TTFont(void) void FTF_TTFont::SetFontSize(char size) { - if(mode == FTF_PIXMAPFONT) { if(size=='s') font=fonts; else if(size=='l') font=fontl; else font=fontm; - } else if(mode == FTF_TEXTUREFONT) { - font=fontl; - } } int FTF_TTFont::SetFont(const unsigned char* str, int datasize, int fontsize) @@ -221,11 +217,23 @@ int FTF_TTFont::SetFont(const unsigned char* str, int datasize, int fontsize) return 0; } else { - fontl= font; + fontm= font; + if(datasize) fonts = new FTGLTextureFont(str, datasize); + else fonts = new FTGLTextureFont((char *)str); + if(datasize) fontl = new FTGLTextureFont(str, datasize); + else fontl = new FTGLTextureFont((char *)str); + + success = fonts->FaceSize(fontsize-2<8?8:fontsize-2); + success = fontm->FaceSize(fontsize-1<8?8:fontsize-1); success = fontl->FaceSize(fontsize); +// success = fonts->FaceSize(fontsize/2); +// success = fontm->FaceSize(fontsize); +// success = fontl->FaceSize(fontsize*2); 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; @@ -274,13 +282,9 @@ void FTF_TTFont::SetEncoding(char* str) void FTF_TTFont::SetSize(int size) { - if(mode == FTF_PIXMAPFONT) { - fonts->FaceSize(size-2<8?8:size-2); - fontm->FaceSize(size-1<8?8:size-1); - fontl->FaceSize(size); - } else if(mode == FTF_TEXTUREFONT) { - fontl->FaceSize(size); - } + fonts->FaceSize(size-2<8?8:size-2); + fontm->FaceSize(size-1<8?8:size-1); + fontl->FaceSize(size); font_size = size; } @@ -290,6 +294,7 @@ int FTF_TTFont::GetSize(void) return font_size; } +/* int FTF_TTFont::Ascender(void) { return (int)font->Ascender(); @@ -300,7 +305,7 @@ int FTF_TTFont::Descender(void) return (int)font->Descender(); } - +*/ int FTF_TTFont::TransConvString(char* str, char* ustr, unsigned int flag) { return 0; @@ -365,7 +370,7 @@ float FTF_TTFont::GetStringWidth(char* str, unsigned int flag) if(mode == FTF_PIXMAPFONT) { return font->Advance(wstr); } else if(mode == FTF_TEXTUREFONT) { - return font->Advance(wstr) * fsize; + return font->Advance(wstr);// * fsize; } } diff --git a/source/blender/ftfont/intern/FTF_TTFont.h b/source/blender/ftfont/intern/FTF_TTFont.h index 15682bd4fde..c4dee93c5dc 100644 --- a/source/blender/ftfont/intern/FTF_TTFont.h +++ b/source/blender/ftfont/intern/FTF_TTFont.h @@ -64,8 +64,8 @@ public: void SetSize(int size); int GetSize(void); - int Ascender(void); - int Descender(void); +// int Ascender(void); +// int Descender(void); int TransConvString(char* str, char* ustr, unsigned int flag); diff --git a/source/blender/include/BIF_language.h b/source/blender/include/BIF_language.h index 28b57aa1017..762407f5b24 100644 --- a/source/blender/include/BIF_language.h +++ b/source/blender/include/BIF_language.h @@ -49,6 +49,7 @@ int BIF_DrawString(struct BMF_Font* font, char *str, int translate); float BIF_GetStringWidth(struct BMF_Font* font, char *str, int translate); void BIF_RasterPos(float x, float y); +void BIF_SetScale(float aspect); void refresh_interface_font(void); #endif /* BIF_LANGUAGE_H */ diff --git a/source/blender/include/blendef.h b/source/blender/include/blendef.h index 904928c65ad..3a26dae9a31 100644 --- a/source/blender/include/blendef.h +++ b/source/blender/include/blendef.h @@ -258,7 +258,6 @@ #define B_DOLANGUIFONT 316 #define B_RESTOREFONT 317 #define B_USETEXTUREFONT 318 -#define B_SCALETEXTUREFONT 319 #define B_UITHEMECHANGED 320 #define B_UITHEMECOLORMOD 321 diff --git a/source/blender/src/header_action.c b/source/blender/src/header_action.c index 2d86f7a44e2..4dbe00ad0d8 100644 --- a/source/blender/src/header_action.c +++ b/source/blender/src/header_action.c @@ -47,12 +47,6 @@ #include "BLI_winstuff.h" #endif -#include "BMF_Api.h" -#include "BIF_language.h" -#ifdef INTERNATIONAL -#include "FTF_Api.h" -#endif - #include "DNA_ID.h" #include "DNA_action_types.h" #include "DNA_ipo_types.h" diff --git a/source/blender/src/header_buttonswin.c b/source/blender/src/header_buttonswin.c index d0375a0163e..0186683df31 100644 --- a/source/blender/src/header_buttonswin.c +++ b/source/blender/src/header_buttonswin.c @@ -46,12 +46,6 @@ #include "BLI_winstuff.h" #endif -#include "BMF_Api.h" -#include "BIF_language.h" -#ifdef INTERNATIONAL -#include "FTF_Api.h" -#endif - #include "DNA_ID.h" #include "DNA_armature_types.h" #include "DNA_lamp_types.h" diff --git a/source/blender/src/header_filesel.c b/source/blender/src/header_filesel.c index 42f3b931ecf..5177770d5c2 100644 --- a/source/blender/src/header_filesel.c +++ b/source/blender/src/header_filesel.c @@ -47,12 +47,6 @@ #include "BLI_winstuff.h" #endif -#include "BMF_Api.h" -#include "BIF_language.h" -#ifdef INTERNATIONAL -#include "FTF_Api.h" -#endif - #include "DNA_ID.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" diff --git a/source/blender/src/header_image.c b/source/blender/src/header_image.c index 2987ca7e53f..80f8ea4121f 100644 --- a/source/blender/src/header_image.c +++ b/source/blender/src/header_image.c @@ -46,12 +46,6 @@ #include "BLI_winstuff.h" #endif -#include "BMF_Api.h" -#include "BIF_language.h" -#ifdef INTERNATIONAL -#include "FTF_Api.h" -#endif - #include "DNA_ID.h" #include "DNA_image_types.h" #include "DNA_mesh_types.h" diff --git a/source/blender/src/header_info.c b/source/blender/src/header_info.c index f1ec2bbe27a..6c98fa0b5be 100644 --- a/source/blender/src/header_info.c +++ b/source/blender/src/header_info.c @@ -47,12 +47,6 @@ #include "BLI_winstuff.h" #endif -#include "BMF_Api.h" -#include "BIF_language.h" -#ifdef INTERNATIONAL -#include "FTF_Api.h" -#endif - #include "DNA_ID.h" #include "DNA_image_types.h" #include "DNA_lamp_types.h" @@ -112,6 +106,7 @@ #include "BPY_menus.h" #include "blendef.h" +#include "interface.h" #include "mydevice.h" extern char versionstr[]; /* from blender.c */ @@ -1910,6 +1905,7 @@ void info_buttons(void) } else xco= 430; +BIF_SetScale(block->aspect); info_text(xco+24, 6); uiBlockSetEmboss(block, UI_EMBOSSN); diff --git a/source/blender/src/header_ipo.c b/source/blender/src/header_ipo.c index 0b9fa56281b..0e5210e668c 100644 --- a/source/blender/src/header_ipo.c +++ b/source/blender/src/header_ipo.c @@ -47,12 +47,6 @@ #include "BLI_winstuff.h" #endif -#include "BMF_Api.h" -#include "BIF_language.h" -#ifdef INTERNATIONAL -#include "FTF_Api.h" -#endif - #include "DNA_ID.h" #include "DNA_curve_types.h" #include "DNA_key_types.h" diff --git a/source/blender/src/header_nla.c b/source/blender/src/header_nla.c index 1e821a14271..5747ac77fc7 100644 --- a/source/blender/src/header_nla.c +++ b/source/blender/src/header_nla.c @@ -47,12 +47,6 @@ #include "BLI_winstuff.h" #endif -#include "BMF_Api.h" -#include "BIF_language.h" -#ifdef INTERNATIONAL -#include "FTF_Api.h" -#endif - #include "DNA_ID.h" #include "DNA_nla_types.h" #include "DNA_scene_types.h" diff --git a/source/blender/src/header_script.c b/source/blender/src/header_script.c index 7a6b04e320c..27755aafd21 100644 --- a/source/blender/src/header_script.c +++ b/source/blender/src/header_script.c @@ -47,12 +47,6 @@ #include "BLI_blenlib.h" -#include "BMF_Api.h" -#include "BIF_language.h" -#ifdef INTERNATIONAL -#include "FTF_Api.h" -#endif - #include "BSE_headerbuttons.h" #include "DNA_ID.h" diff --git a/source/blender/src/headerbuttons.c b/source/blender/src/headerbuttons.c index 68194e25d8a..73f0504ef1c 100644 --- a/source/blender/src/headerbuttons.c +++ b/source/blender/src/headerbuttons.c @@ -173,6 +173,7 @@ #include "mydevice.h" #include "blendef.h" +#include "interface.h" #include "nla.h" /* __NLA : To be removed later */ #include "butspace.h" // test_idbutton @@ -1585,16 +1586,9 @@ void do_global_buttons(unsigned short event) break; case B_RESTOREFONT: /* is button from space.c *info* */ - { - extern float lang_texsize; - - lang_texsize = 1.0; - FTF_SetScale(lang_texsize); - - U.fontsize= 0; - start_interface_font(); - allqueue(REDRAWALL, 0); - } + U.fontsize= 0; + start_interface_font(); + allqueue(REDRAWALL, 0); break; case B_USETEXTUREFONT: /* is button from space.c *info* */ @@ -1607,15 +1601,6 @@ void do_global_buttons(unsigned short event) allqueue(REDRAWALL, 0); break; - case B_SCALETEXTUREFONT: /* is button from space.c *info* */ - { - extern float lang_texsize; - - FTF_SetScale(lang_texsize); - allqueue(REDRAWALL, 0); - } - break; - case B_DOLANGUIFONT: /* is button from space.c *info* */ if(U.transopts & USER_DOTRANSLATE) start_interface_font(); diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c index 4a08b6ee983..df60ea61a38 100644 --- a/source/blender/src/interface.c +++ b/source/blender/src/interface.c @@ -3452,10 +3452,7 @@ static uiOverDraw *ui_draw_but_tip(uiBut *but) uiOverDraw *od; float x1, x2, y1, y2; - #ifdef INTERNATIONAL - extern float lang_texsize; - if(G.ui_international == TRUE) { float llx,lly,llz,urx,ury,urz; //for FTF_GetBoundingBox() @@ -3464,15 +3461,11 @@ static uiOverDraw *ui_draw_but_tip(uiBut *but) x1= (but->x1+but->x2)/2; x2= 10+x1+ but->aspect*FTF_GetStringWidth(but->tip, FTF_USE_GETTEXT | FTF_INPUT_UTF8); //BMF_GetStringWidth(but->font, but->tip); y1= but->y1-(ury+FTF_GetSize())-12; y2= but->y1-12; - y1 *= lang_texsize; - y2 *= lang_texsize; } else { FTF_GetBoundingBox(but->tip, &llx,&lly,&llz,&urx,&ury,&urz, FTF_NO_TRANSCONV | FTF_INPUT_UTF8); x1= (but->x1+but->x2)/2; x2= 10+x1+ but->aspect*FTF_GetStringWidth(but->tip, FTF_NO_TRANSCONV | FTF_INPUT_UTF8); //BMF_GetStringWidth(but->font, but->tip); y1= but->y1-(ury+FTF_GetSize())-12; y2= but->y1-12; - y1 *= lang_texsize; - y2 *= lang_texsize; } } else { x1= (but->x1+but->x2)/2; x2= 10+x1+ but->aspect*BMF_GetStringWidth(but->font, but->tip); @@ -3528,6 +3521,8 @@ static uiOverDraw *ui_draw_but_tip(uiBut *but) glColor3ub(0,0,0); ui_rasterpos_safe( x1+3, y1+5.0/but->aspect, but->aspect); + BIF_SetScale(1.0); + BIF_DrawString(but->font, but->tip, (U.transopts & USER_TR_TOOLTIPS)); ui_flush_overdraw(od); /* to show it in the frontbuffer */ diff --git a/source/blender/src/interface_draw.c b/source/blender/src/interface_draw.c index b6bb28fbf66..f420a903de0 100644 --- a/source/blender/src/interface_draw.c +++ b/source/blender/src/interface_draw.c @@ -117,6 +117,7 @@ void ui_rasterpos_safe(float x, float y, float aspect) if(doit) glRasterPos2f(x, y); BIF_RasterPos(x, y); + BIF_SetScale(aspect); } /* ************** generic embossed rect, for window sliders etc ************* */ diff --git a/source/blender/src/language.c b/source/blender/src/language.c index 8f9c476a142..750483bf789 100644 --- a/source/blender/src/language.c +++ b/source/blender/src/language.c @@ -71,7 +71,6 @@ struct _LANGMenuEntry { static LANGMenuEntry *langmenu= 0; static int tot_lang = 0; -float lang_texsize = 1.0; #endif // INTERNATIONAL @@ -82,6 +81,13 @@ void BIF_RasterPos(float x, float y) #endif // INTERNATIONAL } +void BIF_SetScale(float aspect) +{ +#ifdef INTERNATIONAL + FTF_SetScale(aspect); +#endif // INTERNATIONAL +} + void refresh_interface_font(void) { #ifdef INTERNATIONAL diff --git a/source/blender/src/space.c b/source/blender/src/space.c index cd8951a5691..6663b4b63df 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -2542,15 +2542,6 @@ void drawinfospace(ScrArea *sa, void *spacedata) (xpos+edgsp+(4*mpref)+(4*midsp)),y2,mpref,buth, &(U.transopts), 0, 0, 0, 0, "Use Textured Fonts"); - - if(U.transopts & USER_USETEXTUREFONT) { - extern float lang_texsize; - - uiDefButF(block, NUM, B_SCALETEXTUREFONT, "Scale Factor", - (xpos+edgsp+(4*mpref)+(4*midsp)),y1,mpref,buth, - &lang_texsize, 0.2, 2.0, 100, 2, "Tweak scaling for textured font"); - } - } /* end of INTERNATIONAL */ |