diff options
author | Rob Haarsma <phaseIV@zonnet.nl> | 2005-01-19 16:53:43 +0300 |
---|---|---|
committer | Rob Haarsma <phaseIV@zonnet.nl> | 2005-01-19 16:53:43 +0300 |
commit | 9fddd2bdec4f879a44304118e2f44929c2755483 (patch) | |
tree | c21b1edc62e879a28d8d5ded054a00a899e4dbc3 /source/blender/src | |
parent | 731c69d6ed04628d93ae313397cb5c8f85078ea0 (diff) |
Added experimental option to use GL textured interface fonts.
Set preferred method in userprefs->language & font.
Kinda requested by Kaito, i'm sure he regrets after seeing
my code changes.
This commit includes a patch provided by Jacques Baurain,
which seemed nescessary to handle font sizing properly.
Thank you !
Diffstat (limited to 'source/blender/src')
-rw-r--r-- | source/blender/src/header_info.c | 3 | ||||
-rw-r--r-- | source/blender/src/headerbuttons.c | 33 | ||||
-rw-r--r-- | source/blender/src/interface.c | 6 | ||||
-rw-r--r-- | source/blender/src/interface_draw.c | 2 | ||||
-rw-r--r-- | source/blender/src/language.c | 40 | ||||
-rw-r--r-- | source/blender/src/outliner.c | 1 | ||||
-rw-r--r-- | source/blender/src/space.c | 17 | ||||
-rw-r--r-- | source/blender/src/usiblender.c | 8 |
8 files changed, 95 insertions, 15 deletions
diff --git a/source/blender/src/header_info.c b/source/blender/src/header_info.c index 5ef7fc7a2dd..f1ec2bbe27a 100644 --- a/source/blender/src/header_info.c +++ b/source/blender/src/header_info.c @@ -898,6 +898,7 @@ static void do_info_filemenu(void *arg, int event) BKE_reset_undo(); BKE_write_undo("original"); /* save current state */ + refresh_interface_font(); } break; case 31: /* save default settings */ @@ -1820,11 +1821,13 @@ static void info_text(int x, int y) glColor3ub(0, 0, 0); glRasterPos2i(x, y); + BIF_RasterPos(x, y); BIF_DrawString(G.font, headerstr, (U.transopts & USER_TR_MENUS)); hsize= BIF_GetStringWidth(G.font, headerstr, (U.transopts & USER_TR_BUTTONS)); glRasterPos2i(x+hsize+10, y); + BIF_RasterPos(x+hsize+10, y); BIF_DrawString(G.font, infostr, (U.transopts & USER_TR_MENUS)); } diff --git a/source/blender/src/headerbuttons.c b/source/blender/src/headerbuttons.c index 6a2d139f17d..68194e25d8a 100644 --- a/source/blender/src/headerbuttons.c +++ b/source/blender/src/headerbuttons.c @@ -1575,6 +1575,7 @@ void do_global_buttons(unsigned short event) break; case B_SETFONTSIZE: /* is button from space.c *info* */ + refresh_interface_font(); FTF_SetSize(U.fontsize); allqueue(REDRAWALL, 0); break; @@ -1584,11 +1585,37 @@ void do_global_buttons(unsigned short event) break; case B_RESTOREFONT: /* is button from space.c *info* */ - U.fontsize= 0; - start_interface_font(); - allqueue(REDRAWALL, 0); + { + extern float lang_texsize; + + lang_texsize = 1.0; + FTF_SetScale(lang_texsize); + + U.fontsize= 0; + start_interface_font(); + allqueue(REDRAWALL, 0); + } break; + case B_USETEXTUREFONT: /* is button from space.c *info* */ + if(U.transopts & USER_USETEXTUREFONT) + FTF_SetMode(FTF_TEXTUREFONT); + else + FTF_SetMode(FTF_PIXMAPFONT); + + refresh_interface_font(); + 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 454826c85d7..4a08b6ee983 100644 --- a/source/blender/src/interface.c +++ b/source/blender/src/interface.c @@ -3454,6 +3454,8 @@ static uiOverDraw *ui_draw_but_tip(uiBut *but) #ifdef INTERNATIONAL + extern float lang_texsize; + if(G.ui_international == TRUE) { float llx,lly,llz,urx,ury,urz; //for FTF_GetBoundingBox() @@ -3462,11 +3464,15 @@ 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); diff --git a/source/blender/src/interface_draw.c b/source/blender/src/interface_draw.c index b731615b6a9..b6bb28fbf66 100644 --- a/source/blender/src/interface_draw.c +++ b/source/blender/src/interface_draw.c @@ -115,6 +115,8 @@ void ui_rasterpos_safe(float x, float y, float aspect) } if(doit) glRasterPos2f(x, y); + + BIF_RasterPos(x, y); } /* ************** generic embossed rect, for window sliders etc ************* */ diff --git a/source/blender/src/language.c b/source/blender/src/language.c index 55e0b864abc..8f9c476a142 100644 --- a/source/blender/src/language.c +++ b/source/blender/src/language.c @@ -28,6 +28,10 @@ */ +#ifdef WIN32 +#include "BLI_winstuff.h" +#endif + #include <string.h> #include <stdlib.h> @@ -40,6 +44,7 @@ #include "BLI_blenlib.h" #include "BLI_linklist.h" /* linknode */ +#include "BIF_gl.h" #include "BIF_language.h" #include "BIF_space.h" /* allqueue() */ #include "BIF_toolbox.h" /* error() */ @@ -66,20 +71,51 @@ struct _LANGMenuEntry { static LANGMenuEntry *langmenu= 0; static int tot_lang = 0; +float lang_texsize = 1.0; + #endif // INTERNATIONAL +void BIF_RasterPos(float x, float y) +{ +#ifdef INTERNATIONAL + FTF_SetPosition(x, y); +#endif // INTERNATIONAL +} + +void refresh_interface_font(void) +{ +#ifdef INTERNATIONAL + if(U.transopts & USER_DOTRANSLATE) + start_interface_font(); + else + G.ui_international = FALSE; +#else // INTERNATIONAL + G.ui_international = FALSE; +#endif +} int BIF_DrawString(BMF_Font* font, char *str, int translate) { #ifdef INTERNATIONAL - if(G.ui_international == TRUE) + if(G.ui_international == TRUE) { if(translate) return FTF_DrawString(str, FTF_USE_GETTEXT | FTF_INPUT_UTF8); else return FTF_DrawString(str, FTF_NO_TRANSCONV | FTF_INPUT_UTF8); - else + } else { return BMF_DrawString(font, str); +/* + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + BMF_GetFontTexture(font);?? + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + BMF_DrawStringTexture(font, str, pen_x, pen_y, 0.0); + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + return 0; +*/ + } #else return BMF_DrawString(font, str); #endif diff --git a/source/blender/src/outliner.c b/source/blender/src/outliner.c index 3bfdfe9e548..b3c00331e2e 100644 --- a/source/blender/src/outliner.c +++ b/source/blender/src/outliner.c @@ -1992,6 +1992,7 @@ static void outliner_draw_tree_element(SpaceOops *soops, TreeElement *te, int st if(active==1) BIF_ThemeColor(TH_TEXT_HI); else BIF_ThemeColor(TH_TEXT); glRasterPos2i(startx+offsx, *starty+5); + BIF_RasterPos(startx+offsx, *starty+5); BIF_DrawString(G.font, te->name, 0); offsx+= OL_X + BIF_GetStringWidth(G.font, te->name, 0); diff --git a/source/blender/src/space.c b/source/blender/src/space.c index 54c69657d1a..cd8951a5691 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -2538,12 +2538,19 @@ void drawinfospace(ScrArea *sa, void *spacedata) (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_TR_TEXTEDIT, B_SETTRANSBUTS, "FTF All windows", - (xpos+edgsp+(4*mpref)+(4*midsp)),y1,mpref,buth, + uiDefButBitS(block, TOG, USER_USETEXTUREFONT, B_USETEXTUREFONT, "Use Textured Fonts", + (xpos+edgsp+(4*mpref)+(4*midsp)),y2,mpref,buth, &(U.transopts), 0, 0, 0, 0, - "Use FTF drawing for fileselect and textwindow " - "(under construction)"); - */ + "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 */ diff --git a/source/blender/src/usiblender.c b/source/blender/src/usiblender.c index 8f92dbb71ff..037e1e9f439 100644 --- a/source/blender/src/usiblender.c +++ b/source/blender/src/usiblender.c @@ -215,12 +215,9 @@ static void init_userdef_file(void) #ifdef INTERNATIONAL read_languagefile(); - if(U.transopts & USER_DOTRANSLATE) - start_interface_font(); - else - G.ui_international = FALSE; + refresh_interface_font(); #endif // INTERNATIONAL - + } void BIF_read_file(char *name) @@ -248,6 +245,7 @@ void BIF_read_file(char *name) undo_editmode_clear(); BKE_reset_undo(); BKE_write_undo("original"); /* save current state */ + refresh_interface_font(); } else BIF_undo_push("Import file"); } |