diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-09-18 00:50:22 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-09-18 00:50:22 +0400 |
commit | 66a679d71f15b8c6b0ba4e1c8895ef1824b93a56 (patch) | |
tree | 9ca3086f7efa3560dfae8ab4c6c25f3ffbc7a415 /source/blender/blenfont | |
parent | e07b807357a4667db5de02df1e8f6b27775ca389 (diff) |
i18n: replace gnu unifont with droid sans font
- Static variables can be initialized with constants only.
- Removed bunifont.ttf.c from datafiles -- it's not actually a
data file. Unicode font loading stuff is not in blenkernel/font.c
- Allocate as much memory for unzipped data as it's needed.
Default read chunk is 512Kb.
- Fixed regression (or just a typo) in setting utf locale.
- Default locale set to en_US:en works fine now.
- Commented put Nepali language in user preferences -- it's
not supported by current droid font and imo it's better to
have nice font for languages we actually have translation for
rather than allowing to choose more languages in user preferences.
Diffstat (limited to 'source/blender/blenfont')
-rw-r--r-- | source/blender/blenfont/intern/blf_lang.c | 23 |
1 files changed, 17 insertions, 6 deletions
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); |