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:
authorKent Mein <mein@cs.umn.edu>2007-03-15 15:34:44 +0300
committerKent Mein <mein@cs.umn.edu>2007-03-15 15:34:44 +0300
commit6b5585011628d6dd891212b0ab6f7b0da587512c (patch)
treee410e7b29145db24b67223972488d2f946780af1 /source/blender/src/filesel.c
parent7272bdff76659235911302c54f560e6c20dfde99 (diff)
This is a fix for bug #6100
When using international fonts, blender was assuming that the default language on the system was chinese. Now it checks to see what language code you have selected and if its chinese or japanese it converts those to utf8 and then continues to translate them. I can't fully check this so will need others to test it. This should at least be better now. Kent
Diffstat (limited to 'source/blender/src/filesel.c')
-rw-r--r--source/blender/src/filesel.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/source/blender/src/filesel.c b/source/blender/src/filesel.c
index 23877ee86f8..07a3174809a 100644
--- a/source/blender/src/filesel.c
+++ b/source/blender/src/filesel.c
@@ -897,14 +897,15 @@ static void linerect(int id, int x, int y)
}
#ifdef WITH_ICONV
-static void string_to_utf8(char *original, char *utf_8)
+static void string_to_utf8(char *original, char *utf_8, char *code)
{
size_t inbytesleft=strlen(original);
size_t outbytesleft=512;
size_t rv=0;
iconv_t cd;
- cd=iconv_open("UTF-8", "gb2312");
+ cd=iconv_open("UTF-8", code);
+
if (cd == (iconv_t)(-1)) {
printf("iconv_open Error");
*utf_8='\0';
@@ -970,15 +971,27 @@ static void print_line(SpaceFile *sfile, struct direntry *files, int x, int y)
glRasterPos2i(x, y);
#ifdef WITH_ICONV
{
+ struct LANGMenuEntry *lme;
char utf_8[512];
- string_to_utf8(files->relname, utf_8);
- BIF_RasterPos((float)x, (float)y); /* texture fonts */
- BIF_DrawString(G.font, utf_8, (U.transopts & USER_TR_MENUS));
+
+ lme = find_language(U.language);
+
+ if (lme->code == "ja_JP") { /* japanese */
+ string_to_utf8(files->relname, utf_8, "Shift_JIS");
+ BIF_RasterPos((float)x, (float)y); /* texture fonts */
+ BIF_DrawString(G.font, utf_8, (U.transopts & USER_TR_MENUS));
+ } else if (lme->code == "zh_CN") { /* chinese */
+ string_to_utf8(files->relname, utf_8, "gb2312");
+ BIF_RasterPos((float)x, (float)y); /* texture fonts */
+ BIF_DrawString(G.font, utf_8, (U.transopts & USER_TR_MENUS));
+ } else {
+ BMF_DrawString(G.font, files->relname);
+ }
}
#else
- BMF_DrawString(G.font, files->relname);
+ BMF_DrawString(G.font, files->relname);
#endif
-
+
x += sfile->maxnamelen + 100;
glRasterPos2i(x - BMF_GetStringWidth(G.font, files->size), y);