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:
authorTon Roosendaal <ton@blender.org>2004-11-08 18:46:57 +0300
committerTon Roosendaal <ton@blender.org>2004-11-08 18:46:57 +0300
commit061cde65a63bc8bb74ba1d003e7c75ea556eba55 (patch)
treee9700377b9c3e1d03f02f8eb6d2e9f33f83599be /source/blender/src/language.c
parent5bba5035b0eefdf777574b8c7af323d8d6ff7a2e (diff)
To end the issues with AA (International) Fonts; the .bfont.tff now is
compiled in (datatoc) and doesn't need installation anymore. Also reviewed weird path conventions for searching AA fonts; - U.fontdir is only used as standard search path for fileselecting - U.fontname stores only full path to AA font if used one - If a font cannot be found, it always falls back to the compiled in one - If .B.blend is saved with default font, U.fontname is not set Also added a button in usermenu "restore default". When this works as expected, I'll commit changes for installation too.
Diffstat (limited to 'source/blender/src/language.c')
-rw-r--r--source/blender/src/language.c83
1 files changed, 22 insertions, 61 deletions
diff --git a/source/blender/src/language.c b/source/blender/src/language.c
index d974a51073b..55e0b864abc 100644
--- a/source/blender/src/language.c
+++ b/source/blender/src/language.c
@@ -43,6 +43,7 @@
#include "BIF_language.h"
#include "BIF_space.h" /* allqueue() */
#include "BIF_toolbox.h" /* error() */
+#include "datatoc.h" /* std font */
#include "MEM_guardedalloc.h" /* vprintf, etc ??? */
@@ -178,20 +179,18 @@ void lang_setlanguage(void)
/* called from fileselector */
void set_interface_font(char *str)
{
- char di[FILE_MAXDIR];
/* this test needed because fileselect callback can happen after disable AA fonts */
if(U.transopts & USER_DOTRANSLATE) {
- if(FTF_SetFont(str, U.fontsize)) {
+ if(FTF_SetFont(str, 0, U.fontsize)) {
lang_setlanguage();
- BLI_split_dirfile(str, di, U.fontname);
-
- if(strlen(di) < FILE_MAXDIR) strcpy(U.fontdir, di);
-
+
+ if(strlen(str) < FILE_MAXDIR) strcpy(U.fontname, str);
G.ui_international = TRUE;
- } else {
- sprintf(U.fontname, "Invalid font.");
- G.ui_international = FALSE;
+ }
+ else {
+ U.fontname[0]= 0;
+ G.ui_international = TRUE; // this case will switch to standard font
}
allqueue(REDRAWALL, 0);
}
@@ -200,69 +199,31 @@ void set_interface_font(char *str)
void start_interface_font(void)
{
- char tstr[FILE_MAXDIR+FILE_MAXFILE];
int result = 0;
-#ifdef __APPLE__
- char *bundlepath;
-#endif
-
- /* hack to find out if we have saved language/font settings.
- if not, set defaults and try .bfont.tff --phase */
-
- if(U.fontsize != 0) { // we have saved user settings
- // try load the font from the font dir
- BLI_make_file_string("/", tstr, U.fontdir, U.fontname);
- result = FTF_SetFont(tstr, U.fontsize);
- if(!result) { // else try loading font from current dir
- result = FTF_SetFont(U.fontname, U.fontsize);
- }
-
- // try home dir (special case for .bfont.ttf) (aphex)
-
- if(!result) {
- strcpy(tstr, BLI_gethome());
- if (strstr(tstr,".blender") == 0) {
- strcat(tstr,"/.blender/");
- }
- strcat(tstr, U.fontname);
- result = FTF_SetFont(tstr, U.fontsize);
- }
- } else {
+ if(U.fontsize && U.fontname[0] ) { // we have saved user settings + fontpath
+
+ // try loading font from U.fontname = full path to font in usersettings
+ result = FTF_SetFont(U.fontname, 0, U.fontsize);
+ }
+ else if(U.fontsize) { // user settings, default
+ result = FTF_SetFont(datatoc_bfont_ttf, datatoc_bfont_ttf_size, U.fontsize);
+ }
+
+ if(result==0) { // use default
U.language= 0;
U.fontsize= 11;
U.encoding= 0;
-
-#if defined (__APPLE__)
- bundlepath = BLI_getbundle();
- strcpy(tstr, bundlepath);
- strcat(tstr, "/Contents/Resources/");
- strcat(tstr, ".bfont.ttf");
- result = FTF_SetFont(tstr, U.fontsize);
-
- //sprintf(U.fontname, ".blender/.bfont.ttf");
- strncpy(U.fontname, tstr, 255);
-
-#elif defined (WIN32)
- strcpy(tstr, BLI_gethome());
- strcat(tstr, "/.bfont.ttf\0");
- result = FTF_SetFont(tstr, U.fontsize);
-
- sprintf(U.fontname, "/.bfont.ttf\0");
-#else
- strcpy(tstr, BLI_gethome());
- strcat(tstr, "/.blender/.bfont.ttf");
- result = FTF_SetFont(tstr, U.fontsize);
-
- strncpy(U.fontname, tstr, 255);
-#endif
+ U.fontname[0]= 0;
+ result = FTF_SetFont(datatoc_bfont_ttf, datatoc_bfont_ttf_size, U.fontsize);
}
if(result) {
lang_setlanguage();
G.ui_international = TRUE;
- } else {
+ }
+ else {
printf("no font found for international support\n");
G.ui_international = FALSE;
U.transopts &= ~USER_DOTRANSLATE;