LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1263|回复: 5

为什么我的wine还是不能显示中文?已经参考过网上很多文章了

[复制链接]
发表于 2003-7-19 17:47:13 | 显示全部楼层 |阅读模式
我的wine是20030709的,也打上了输入法补丁
现在运行notepad,菜单上没有中文,只显示一个英文子母
英文的部分还能正常显示.但是中文的地方就是空白
可以输入和粘贴中文,但是都显示的是空白,从里面拷贝出来的中文粘贴到别的地方
都显示正常.

每次运行wine得时候,都出现很多如下的信息

fixme:fontFD_InitFontInfo DBCS fonts like '-misc-simsun-medium-r-normal--0-0-0-0-c-0-big5-0' are not working correctly now.
fixme:fontFD_InitFontInfo DBCS fonts like '-misc-simsun-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0' are not working correctly now.
fixme:fontFD_InitFontInfo font '-misc-simsun-medium-r-normal--0-0-0-0-c-0-gbk-0' has unknown registry 'gbk' and character encoding '0'
Font metrics: 91.0% done



wine config如下

[fonts]
;Read the Fonts topic in the Wine User Guide before adding aliases
;See a couple of examples for russian users below
"Resolution" = "96"
"Default" = " -misc-simsun-"

; the TrueType font dirs you want to make accessible to wine
[FontDirs]
"dir1" = "/usr/share/fonts/msfonts"
........

msfonts目录中有simsun.ttf 并且有fonts.dir文件

虚拟的C盘Fonts目录里我也放了一个simsun.ttf,但是我觉得这个文件好象没什么用,放不放都一样阿,看config文件,好象字体是从FontDirs里读出来的




我已经搞了无数次了,还是不知道问题出在哪里
希望有朋友能帮帮我,谢谢

附上flashfxp的贴图
在flashfxp的字体选项中有simsun这一项
从图中可以看出,simsun的英文部分确实是生效了
但是中文还是显示不出来,右边目录列表中文件名的空白部分就是本应该显示的中文.

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
发表于 2003-7-20 15:59:00 | 显示全部楼层
最新版的wine不需要什么设置啊,把simsun等中文字体考到~/.wine/fake_windows/Windows/Fonts目录,在修改一下connfig文件里的WIndows盘符就可以了。对了,那个~/.wine目录以及其下的文件都会在第一次运行wine是自动建立。还有我是源码包编译的wine,兄弟也可以试试看
发表于 2003-7-20 22:18:15 | 显示全部楼层

你打的什么补丁?哪里可以下载?

是最新的0709的补丁吗?
 楼主| 发表于 2003-7-21 01:10:27 | 显示全部楼层

回复: 你打的什么补丁?哪里可以下载?

最初由 abaiyi 发表
是最新的0709的补丁吗?


对,水木清华bbs上有人贴过一个

diff -urN wine-20030709-orig/controls/edit.c wine-20030709/controls/edit.c
--- wine-20030709-orig/controls/edit.c        2003-06-04 13:29:06.000000000 -0700
+++ wine-20030709/controls/edit.c        2003-07-10 17:59:04.000000000 -0700
@@ -57,6 +57,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(edit);
WINE_DECLARE_DEBUG_CHANNEL(combo);
WINE_DECLARE_DEBUG_CHANNEL(relay);
+WINE_DECLARE_DEBUG_CHANNEL(xim);

#define BUFLIMIT_MULTI                65534        /* maximum buffer size (not including '\0')
                                           FIXME: BTW, new specs say 65535 (do you dare ???) */
@@ -775,6 +776,7 @@
                break;
             }
             /* fall through */
+
        case WM_CHAR:
        {
                WCHAR charW;
@@ -793,6 +795,7 @@
                      SendMessageW(GetParent(hwnd), WM_KEYDOWN, charW, 0);
                   break;
                }
+                TRACE_(xim)("receive charW: %04x\n",charW);   
                EDIT_WM_Char(es, charW);
                break;
        }
diff -urN wine-20030709-orig/dlls/x11drv/event.c wine-20030709/dlls/x11drv/event.c
--- wine-20030709-orig/dlls/x11drv/event.c        2003-07-08 14:02:51.000000000 -0700
+++ wine-20030709/dlls/x11drv/event.c        2003-07-10 17:40:37.000000000 -0700
@@ -55,6 +55,7 @@
extern Atom wmProtocols;
extern Atom wmDeleteWindow;
extern Atom dndProtocol;
+extern BOOL updatedXIMPos;
extern Atom dndSelection;
extern Atom netwmPing;

@@ -142,10 +143,45 @@

         XNextEvent( data->display, &event );
         ignore = XFilterEvent( &event, None );
-        wine_tsx11_unlock();
-        if (!ignore) EVENT_ProcessEvent( &event );
+//        wine_tsx11_unlock();
+//        if (!ignore) EVENT_ProcessEvent( &event );
+        if (!ignore){
+            wine_tsx11_unlock();
+           EVENT_ProcessEvent( &event );
+           wine_tsx11_lock();
+       }else{  // Support for OVERTHESPOT style of XIM (force keymap update)
+           if ( data->xim && event.type == KeyRelease && !updatedXIMPos){
+               HWND hWnd;
+               if (XFindContext( data->display, event.xany.window, winContext,
+(char **)&hWnd ) != 0)
+                   hWnd = 0;  // Not for a registered window
+               XIC xic = X11DRV_get_ic(hWnd);
+               if(xic){
+                       POINT p[1];
+                       XVaNestedList preedit_attr;
+                       GetCaretPos(&p[0]);
+                       MapWindowPoints(GetFocus(),hWnd,p,1);
+                       //ClientToScreen(hWnd, &p);
+                       XPoint spot;
+                       spot.x = p[0].x;
+                       spot.y = p[0].y;
+                       spot.y += 30;   //FIXME: How to get the caret's height
+                       preedit_attr = XVaCreateNestedList(0,
+                                       XNSpotLocation, &spot,
+                                       NULL);
+                       XSetICValues(xic,XNPreeditAttributes,preedit_attr,NULL);
+                       // use this variable to check whether we need to update XIM position
+                       updatedXIMPos = TRUE;
+
+                       //force wine to update keymap
+                      XKeymapEvent forceUpdateKeymap;
+                      XQueryKeymap(data->display, forceUpdateKeymap.key_vector);
+                      X11DRV_KeymapNotify(hWnd, &forceUpdateKeymap);
+               }
+           }
+       }
+
         count++;
-        wine_tsx11_lock();
     }
     wine_tsx11_unlock();
     return count;
@@ -594,6 +630,10 @@
     }

     if (!bExists)
+//        {        /* Add COMPOUND_TEXT prop for STRING additionally */
+  //              if (prop == XA_STRING)
+
+//        targets[(*cTargets)++] = TSXInternAtom(display, "COMPOUND_TEXT", False);
         targets[(*cTargets)++] = prop;
}

diff -urN wine-20030709-orig/dlls/x11drv/keyboard.c wine-20030709/dlls/x11drv/keyboard.c
--- wine-20030709-orig/dlls/x11drv/keyboard.c        2003-07-08 21:22:57.000000000 -0700
+++ wine-20030709/dlls/x11drv/keyboard.c        2003-07-10 17:04:56.000000000 -0700
@@ -51,6 +51,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(keyboard);
WINE_DECLARE_DEBUG_CHANNEL(key);
WINE_DECLARE_DEBUG_CHANNEL(dinput);
+WINE_DECLARE_DEBUG_CHANNEL(xim);

int min_keycode, max_keycode, keysyms_per_keycode;
WORD keyc2vkey[256], keyc2scan[256];
@@ -61,6 +62,8 @@

static char KEYBOARD_MapDeadKeysym(KeySym keysym);

+BOOL updatedXIMPos = FALSE;
+
/* Keyboard translation tables */
#define MAIN_LEN 49
static const WORD main_key_scan_qwerty[MAIN_LEN] =
@@ -975,6 +978,90 @@
     KEYBOARD_UpdateOneState( VK_SHIFT, shift, time );
}

+
+#define NALLOC 64
+static BOOL XIM_KeyEvent(XIC xic, HWND hwnd, XKeyEvent *event)
+{
+    BOOL done = FALSE;
+
+    TRACE_(xim)("hwnd %04x \n", (unsigned int) hwnd);
+
+    if (event->type == KeyPress)
+    {
+        KeySym keysym;
+        Status status;
+        int i, nbyte;
+        DWORD dwOutput;
+        WCHAR wcOutput[NALLOC];
+        LPSTR bytes;
+        DWORD nalloc = NALLOC;
+        updatedXIMPos = FALSE;
+        bytes = HeapAlloc(GetProcessHeap(),0,NALLOC);
+
+
+        nbyte = XmbLookupString(xic, event, bytes, nalloc, &keysym, &status);
+        TRACE_(xim)("nbyte = %d, status = 0x%x\n", nbyte, status);
+
+        if (status == XBufferOverflow)
+        {
+           nalloc = nbyte;
+            bytes = HeapReAlloc(GetProcessHeap(), 0, bytes, nbyte);
+            nbyte = XmbLookupString(xic, event, bytes, nalloc, &keysym, &status
+);
+            TRACE_(xim)("nbyte = %d, status = 0x%x\n", nbyte, status);
+        }
+
+        switch (status)
+        {
+        case XLookupBoth:
+            if (keysym < 128 || (keysym & 0xff00) == 0xff00)
+            {
+                TRACE_(xim)("keysym = 0x%x\n", (int)keysym);
+                               break; /* Leave to the default handler */
+            }
+            /* fall through */
+        case XLookupChars:
+       {
+            INT codepage = GetACP();
+            if (codepage == 932)
+            {
+                /*
+                 * Japanese is encoded with windows as SJIS (932) however
+                 * Under unix we use EUS (20932) So we need to translate
+                 * the input as 20932...
+                 */
+                dwOutput = MultiByteToWideChar(20932,
+                                 0, bytes, nbyte, wcOutput, sizeof(wcOutput));
+           }
+            else
+                dwOutput = MultiByteToWideChar(codepage,
+                                 0, bytes, nbyte, wcOutput, sizeof(wcOutput));
+
+                       for(i=0; i<dwOutput; i++)
+                       {
+                            TRACE_(xim)("sending wchar %04x\n", wcOutput);
+                            PostMessageW(hwnd, WM_IME_CHAR, wcOutput, 1);
+                       }
+            done = True;
+           break;
+               }
+
+        case XLookupKeySym:
+           TRACE_(xim)("XLookupKeySym\n");
+           break; /* Leave to the default handler */
+
+        case XLookupNone:
+            TRACE_(xim)("XLookupNone\n");
+            done = True; /* No further processing is necessary */
+            break;
+        }
+        HeapFree(GetProcessHeap(),0,bytes);
+    }
+    return done;
+}
+
+
+
/***********************************************************************
  *           X11DRV_KeyEvent
  *
@@ -995,9 +1082,10 @@
        event->keycode=(event->keycode & 0xff);

     wine_tsx11_lock();
-    if (xic)
-        ascii_chars = XmbLookupString(xic, event, Str, sizeof(Str), &keysym, NULL);
-    else
+    if (xic && XIM_KeyEvent(xic, GetFocus(), event)){
+           wine_tsx11_unlock();
+           return;
+    }else
         ascii_chars = XLookupString(event, Str, sizeof(Str), &keysym, NULL);
     wine_tsx11_unlock();

diff -urN wine-20030709-orig/dlls/x11drv/window.c wine-20030709/dlls/x11drv/window.c
--- wine-20030709-orig/dlls/x11drv/window.c        2003-07-08 21:22:57.000000000 -0700
+++ wine-20030709/dlls/x11drv/window.c        2003-07-10 17:07:05.000000000 -0700
@@ -68,6 +68,8 @@
static LPCSTR client_window_atom;
static LPCSTR icon_window_atom;

+XFontSet ximFontSet;
+
/***********************************************************************
  *                is_window_managed
  *
@@ -728,11 +730,26 @@
     if (is_top_level)
     {
         XIM xim = x11drv_thread_data()->xim;
-        if (xim) data->xic = XCreateIC( xim,
-                                        XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
-                                        XNClientWindow, data->whole_window,
-                                        XNFocusWindow, data->whole_window,
-                                        0 );
+        if (xim){      // OVERTHESPOT STYLE support
+               XPoint spot = {0,0};
+               char * FontSet = "*-r-*";
+               char **missing_charsets;
+               int count;
+               ximFontSet = XCreateFontSet(display, FontSet, &missing_charsets,
+ &count, NULL);
+               XFreeStringList (missing_charsets);
+               XVaNestedList preedit = XVaCreateNestedList(0,
+                               XNFontSet, ximFontSet,
+                               XNSpotLocation, &spot,
+                               NULL);
+               data->xic = XCreateIC( xim,
+                        XNInputStyle, XIMPreeditPosition | XIMStatusNothing,
+                        XNClientWindow, root_window,
+                        XNFocusWindow, data->whole_window,
+                       XNPreeditAttributes, preedit,
+                       0 );
+       }
+
     }

     /* non-maximized child must be at bottom of Z order */
发表于 2003-7-21 19:03:01 | 显示全部楼层
谢了,搞定珊瑚虫0825
 楼主| 发表于 2003-7-24 10:25:35 | 显示全部楼层
昨天重新装了系统
我下了一个0408的,可以显示中文了,看来是0709在我这里有问题?还是原来那个系统出了问题?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表