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:
-rw-r--r--release/bin/.blender/fonts/droidsans.ttf.gzbin0 -> 1885204 bytes
-rwxr-xr-xrelease/bin/.blender/fonts/unifont.ttf.gzbin3099950 -> 0 bytes
-rw-r--r--source/blender/blenfont/intern/blf_lang.c23
-rw-r--r--source/blender/blenkernel/BKE_font.h4
-rw-r--r--source/blender/blenkernel/CMakeLists.txt4
-rw-r--r--source/blender/blenkernel/SConscript3
-rw-r--r--source/blender/blenkernel/intern/font.c26
-rw-r--r--source/blender/blenlib/BLI_fileops.h2
-rw-r--r--source/blender/blenlib/intern/fileops.c35
-rw-r--r--source/blender/editors/datafiles/CMakeLists.txt1
-rwxr-xr-xsource/blender/editors/datafiles/bunifont.ttf.c39
-rw-r--r--source/blender/editors/interface/interface_style.c13
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c2
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c2
14 files changed, 97 insertions, 57 deletions
diff --git a/release/bin/.blender/fonts/droidsans.ttf.gz b/release/bin/.blender/fonts/droidsans.ttf.gz
new file mode 100644
index 00000000000..f6067020f42
--- /dev/null
+++ b/release/bin/.blender/fonts/droidsans.ttf.gz
Binary files differ
diff --git a/release/bin/.blender/fonts/unifont.ttf.gz b/release/bin/.blender/fonts/unifont.ttf.gz
deleted file mode 100755
index 8d10371899c..00000000000
--- a/release/bin/.blender/fonts/unifont.ttf.gz
+++ /dev/null
Binary files differ
diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c
index 581a936ee87..8f745180b8b 100644
--- a/source/blender/blenfont/intern/blf_lang.c
+++ b/source/blender/blenfont/intern/blf_lang.c
@@ -92,8 +92,8 @@ static const char *locales[] = {
"arabic", "ar_EG",
"bulgarian", "bg_BG",
"greek", "el_GR",
- "korean" "ko_KR",
- "nepali" "ne_NP",
+ "korean", "ko_KR",
+ "nepali", "ne_NP",
};
void BLF_lang_init(void)
@@ -150,10 +150,21 @@ void BLF_lang_set(const char *str)
{
const char *locale;
static char default_locale[64]="\0";
- static char *env_language = getenv("LANGUAGE");
- if(default_locale[0]==0 && env_language!=NULL) /* store defaul locale */
- strncpy(default_locale, env_language, sizeof(default_locale));
+ if(default_locale[0]==0) {
+ char *env_language= getenv("LANGUAGE");
+
+ if(env_language) {
+ char *s;
+
+ /* store defaul locale */
+ strncpy(default_locale, env_language, sizeof(default_locale));
+
+ /* use first language as default */
+ s= strchr(default_locale, ':');
+ if(s) s[0]= 0;
+ }
+ }
if(short_locale[0])
locale= short_locale;
@@ -166,7 +177,7 @@ void BLF_lang_set(const char *str)
locreturn= setlocale(LC_ALL, locale);
if (locreturn == NULL) {
- char *short_locale_utf8= BLI_sprintfN("%s", short_locale);
+ char *short_locale_utf8= BLI_sprintfN("%s.UTF-8", short_locale);
locreturn= setlocale(LC_ALL, short_locale_utf8);
diff --git a/source/blender/blenkernel/BKE_font.h b/source/blender/blenkernel/BKE_font.h
index 2195b370a5f..3f89f5e8448 100644
--- a/source/blender/blenkernel/BKE_font.h
+++ b/source/blender/blenkernel/BKE_font.h
@@ -89,6 +89,10 @@ void wcs2utf8s(char *dst, const wchar_t *src);
size_t wcsleninu8(wchar_t *src);
size_t utf8towchar(wchar_t *w, const char *c);
+#ifdef INTERNATIONAL
+unsigned char *BKE_font_get_unifont(int *unifont_size);
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 9cf0a92742f..b800c94a09c 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -362,6 +362,10 @@ if(WITH_GAMEENGINE)
)
endif()
+if(WITH_INTERNATIONAL)
+ add_definitions(-DINTERNATIONAL)
+endif()
+
if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")
endif()
diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript
index 56de8afc0da..3935f01e46e 100644
--- a/source/blender/blenkernel/SConscript
+++ b/source/blender/blenkernel/SConscript
@@ -97,6 +97,9 @@ if env['WITH_BF_GAMEENGINE']:
else:
sources.remove('intern' + os.sep + 'navmesh_conversion.cpp')
+if env['WITH_BF_INTERNATIONAL']:
+ defs.append('INTERNATIONAL')
+
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
incs += ' ' + env['BF_PTHREADS_INC']
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index 6898615c753..0a94b4e3fd1 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -255,6 +255,29 @@ static PackedFile *get_builtin_packedfile(void)
}
}
+#ifdef INTERNATIONAL
+const char unifont_filename[]="droidsans.ttf.gz";
+static unsigned char *unifont_ttf= NULL;
+static int unifont_size= 0;
+
+unsigned char *BKE_font_get_unifont(int *unifont_size_r)
+{
+ if(unifont_ttf==NULL) {
+ char *fontpath = BLI_get_folder(BLENDER_DATAFILES, "fonts");
+ char unifont_path[1024];
+
+ BLI_snprintf(unifont_path, sizeof(unifont_path), "%s/%s", fontpath, unifont_filename);
+
+ unifont_ttf= BLI_ungzip_to_mem(unifont_path, &unifont_size);
+ }
+
+ *unifont_size_r= unifont_size;
+
+ return unifont_ttf;
+}
+
+#endif
+
void free_ttfont(void)
{
struct TmpFont *tf;
@@ -265,6 +288,9 @@ void free_ttfont(void)
tf->vfont= NULL;
}
BLI_freelistN(&ttfdata);
+
+ if(unifont_ttf)
+ MEM_freeN(unifont_ttf);
}
struct TmpFont *vfont_find_tmpfont(VFont *vfont)
diff --git a/source/blender/blenlib/BLI_fileops.h b/source/blender/blenlib/BLI_fileops.h
index 27b1a67b32c..21d28ca3185 100644
--- a/source/blender/blenlib/BLI_fileops.h
+++ b/source/blender/blenlib/BLI_fileops.h
@@ -53,7 +53,7 @@ int BLI_exists(const char *file);
int BLI_copy_fileops(const char *file, const char *to);
int BLI_rename(const char *from, const char *to);
int BLI_gzip(const char *from, const char *to);
-int BLI_ungzip_to_mem(const char *from_file, char *to_mem, const int size);
+char *BLI_ungzip_to_mem(const char *from_file, int *size_r);
int BLI_delete(const char *file, int dir, int recursive);
int BLI_move(const char *file, const char *to);
int BLI_touch(const char *file);
diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c
index 7c2b9f03c60..6b125435b31 100644
--- a/source/blender/blenlib/intern/fileops.c
+++ b/source/blender/blenlib/intern/fileops.c
@@ -52,6 +52,8 @@
#include <sys/param.h>
#endif
+#include "MEM_guardedalloc.h"
+
#include "BLI_blenlib.h"
#include "BKE_utildefines.h"
@@ -107,18 +109,39 @@ int BLI_gzip(const char *from, const char *to) {
/* gzip the file in from_file and write it to memery to_mem, at most size bytes.
return the unziped size
*/
-int BLI_ungzip_to_mem(const char *from_file, char *to_mem, const int size)
+char *BLI_ungzip_to_mem(const char *from_file, int *size_r)
{
gzFile gzfile;
- int readsize;
+ int readsize, size, alloc_size=0;
+ char *mem= NULL;
+ const int chunk_size= 512*1024;
+
+ size= 0;
gzfile = gzopen( from_file, "rb" );
- readsize = gzread( gzfile, to_mem, size);
- if (readsize < 0)
- readsize = EOF;
+ for(;;) {
+ if(mem==NULL) {
+ mem= MEM_callocN(chunk_size, "BLI_ungzip_to_mem");
+ alloc_size= chunk_size;
+ } else {
+ mem= MEM_reallocN(mem, size+chunk_size);
+ alloc_size+= chunk_size;
+ }
+
+ readsize= gzread(gzfile, mem+size, chunk_size);
+ if(readsize>0) {
+ size+= readsize;
+ }
+ else break;
+ }
+
+ if(mem && alloc_size!=size)
+ mem= MEM_reallocN(mem, size);
+
+ *size_r= size;
- return readsize;
+ return mem;
}
diff --git a/source/blender/editors/datafiles/CMakeLists.txt b/source/blender/editors/datafiles/CMakeLists.txt
index fc85dcf5fa8..a31b3c3b2bd 100644
--- a/source/blender/editors/datafiles/CMakeLists.txt
+++ b/source/blender/editors/datafiles/CMakeLists.txt
@@ -32,7 +32,6 @@ set(INC_SYS
set(SRC
Bfont.c
bfont.ttf.c
- bunifont.ttf.c
)
if(WITH_BLENDER)
diff --git a/source/blender/editors/datafiles/bunifont.ttf.c b/source/blender/editors/datafiles/bunifont.ttf.c
deleted file mode 100755
index 7af80842e50..00000000000
--- a/source/blender/editors/datafiles/bunifont.ttf.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/** \file blender/editors/datafiles/bunifont.ttf.c
- * \ingroup eddatafiles
- */
-/* DataToC output of file <bfont_ttf> */
-
-#include <stdio.h>
-#include "BLI_path_util.h"
-#include "BLI_string.h"
-#include "BLI_fileops.h"
-#include "BLI_memarena.h"
-#include "MEM_guardedalloc.h"
-
-const int datatoc_bunifont_ttf_size = 16179552;
-static char* datatoc_bunifont_ttf = 0;
-
-static char unifont_path[1024];
-const char unifont_filename[]="unifont.ttf.gz";
-
-char *get_datatoc_bunifont_ttf(void)
-{
- if( datatoc_bunifont_ttf==NULL )
- {
- char *fontpath = BLI_get_folder(BLENDER_DATAFILES, "fonts");
- BLI_snprintf( unifont_path, sizeof(unifont_path), "%s/%s", fontpath, unifont_filename );
-
- if( BLI_exists(unifont_path) )
- {
- datatoc_bunifont_ttf = (char*)MEM_mallocN( datatoc_bunifont_ttf_size, "get_datatoc_bunifont_ttf" );
- BLI_ungzip_to_mem( unifont_path, datatoc_bunifont_ttf, datatoc_bunifont_ttf_size );
- }
- }
- return datatoc_bunifont_ttf;
-}
-
-void free_datatoc_bunifont_ttf(void)
-{
- if( datatoc_bunifont_ttf!=NULL )
- MEM_freeN( datatoc_bunifont_ttf );
-}
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index af3d1c2d5e6..d242da8e480 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -44,6 +44,7 @@
#include "BLI_string.h"
#include "BKE_global.h"
+#include "BKE_font.h"
#include "BLF_api.h"
@@ -321,7 +322,17 @@ void uiStyleInit(void)
for(font= U.uifonts.first; font; font= font->next) {
if(font->uifont_id==UIFONT_DEFAULT) {
- font->blf_id= BLF_load_mem_unique("default", (unsigned char *)get_datatoc_bunifont_ttf(), datatoc_bunifont_ttf_size);
+#ifdef INTERNATIONAL
+ int unifont_size;
+ unsigned char *unifont_ttf= BKE_font_get_unifont(&unifont_size);
+
+ if(unifont_ttf)
+ font->blf_id= BLF_load_mem_unique("default", unifont_ttf, unifont_size);
+ else
+ font->blf_id= BLF_load_mem("default", (unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size);
+#else
+ font->blf_id= BLF_load_mem("default", (unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size);
+#endif
}
else {
font->blf_id= BLF_load(font->filename);
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 533895fedaa..5f2c3b494f7 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -2497,7 +2497,7 @@ static void rna_def_userdef_system(BlenderRNA *brna)
{22, "BULGARIAN", 0, N_("Bulgarian (Български)"), "bg_BG"},
{23, "GREEK", 0, N_("Greek (Ελληνικά)"), "el_GR"},
{24, "KOREAN", 0, N_("Korean (한국 언어)"), "ko_KR"},
- {25, "Nepali", 0, N_("Nepali (नेपाली)"), "ne_NP"},
+ /*{25, "Nepali", 0, N_("Nepali (नेपाली)"), "ne_NP"},*/
{0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "UserPreferencesSystem", NULL);
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 2bfeb104d2a..510b3403c05 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -342,7 +342,6 @@ extern void free_anim_copybuf(void);
extern void free_anim_drivers_copybuf(void);
extern void free_fmodifiers_copybuf(void);
extern void free_posebuf(void);
-extern void free_datatoc_bunifont_ttf(void);
/* called in creator.c even... tsk, split this! */
void WM_exit(bContext *C)
@@ -381,7 +380,6 @@ void WM_exit(bContext *C)
BIF_freeTemplates(C);
free_ttfont(); /* bke_font.h */
- free_datatoc_bunifont_ttf(); /* bunifont.ttf.c */
free_openrecent();
BKE_freecubetable();