patch to correct Chinese text display
cnbiz850
cnbiz850 at sohu.com
Sun Feb 12 00:44:47 CST 2006
When running a Chinese program with Wine, quite likely the Chinese text are
messed up. A patch posted at
http://www.easywine.org/bbs/viewthread.php?tid=529&extra=page%3D1 <http://www.easywine.org/bbs/viewthread.php?tid=529&extra=page%3D1> seems to have
solved it. Please investigate. The patch is pasted below.
-----------------------------------
--- wine-20050111/dlls/gdi/freetype.c 2005-01-06 01:12:07.000000000 +0800
+++ wine-20050111.gbhack/dlls/gdi/freetype.c 2005-01-15 18:30:32.481788272 +0
800
@@ -1677,7 +1677,22 @@
if(!strcmpiW(lf.lfFaceName, SymbolW))
lf.lfCharSet = SYMBOL_CHARSET;
- if(!TranslateCharsetInfo((DWORD*)(INT)lf.lfCharSet, &csi, TCI_SRCCHARSET))
{
+ if( lf.lfCharSet == DEFAULT_CHARSET || lf.lfCharSet == ANSI_CHARSET)
+ {
+ int codepage = 936; /* I'm Chinese. Let me do something selfish. */
+ char *env_wdc = getenv("WINE_DEFAULT_CODEPAGE");
+ if (env_wdc != NULL)
+ {
+ codepage = atoi(env_wdc);
+ }
+ FIXME("Dirty hack. Default and ansi charset is translated to getenv(\"WI
NE_DEFAULT_CODEPAGE\")\n");
+ if(!TranslateCharsetInfo((DWORD*)(INT)codepage, &csi, TCI_SRCCODEPAGE))
{
+ FIXME("OMG. Even this dirty hack doesn't work. Let's PRAY.\n");
+ csi.fs.fsCsb[0] = 0;
+ }
+ lf.lfCharSet = csi.ciCharset;
+ }
+ else if(!TranslateCharsetInfo((DWORD*)(INT)lf.lfCharSet, &csi,
TCI_SRCCHARSET)) {
switch(lf.lfCharSet) {
case DEFAULT_CHARSET:
csi.fs.fsCsb[0] = 0;
@@ -1861,6 +1876,10 @@
width = face->size.x_ppem >> 6;
height = face->size.y_ppem >> 6;
}
+
+ if (0 <= height && height <12) height =12;
+ else if ( 0 > height && height > -12) height = -12;
+
ret->ft_face = OpenFontFile(ret, face->file, face->face_index, width, height);
if (!ret->ft_face)
More information about the wine-patches
mailing list