Don't map symbol charset through WCToMB.

This commit is contained in:
Huw D M Davies 2002-06-24 23:07:26 +00:00 committed by Alexandre Julliard
parent e75096a0df
commit 1d70715198
1 changed files with 65 additions and 12 deletions

View File

@ -78,24 +78,77 @@ MFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
RECT16 rect16;
LPINT16 lpdx16 = NULL;
BOOL ret;
int i;
int i, j;
LPSTR ascii;
DWORD len;
CHARSETINFO csi;
METAFILEDRV_PDEVICE *physDev = (METAFILEDRV_PDEVICE *)dev;
int charset = GetTextCharset(physDev->hdc);
UINT cp = CP_ACP;
if(lpDx)
lpdx16 = HeapAlloc( GetProcessHeap(), 0, sizeof(INT16)*count );
if (lprect) CONV_RECT32TO16(lprect,&rect16);
if (lpdx16)
for (i=count;i--;)
lpdx16[i]=lpDx[i];
len = WideCharToMultiByte( CP_ACP, 0, str, count, NULL, 0, NULL, NULL );
if(TranslateCharsetInfo((DWORD*)charset, &csi, TCI_SRCCHARSET))
cp = csi.ciACP;
else {
switch(charset) {
case OEM_CHARSET:
cp = GetOEMCP();
break;
case DEFAULT_CHARSET:
cp = GetACP();
break;
case VISCII_CHARSET:
case TCVN_CHARSET:
case KOI8_CHARSET:
case ISO3_CHARSET:
case ISO4_CHARSET:
case ISO10_CHARSET:
case CELTIC_CHARSET:
/* FIXME: These have no place here, but because x11drv
enumerates fonts with these (made up) charsets some apps
might use them and then the FIXME below would become
annoying. Now we could pick the intended codepage for
each of these, but since it's broken anyway we'll just
use CP_ACP and hope it'll go away...
*/
cp = CP_ACP;
break;
default:
FIXME("Can't find codepage for charset %d\n", charset);
break;
}
}
TRACE("cp == %d\n", cp);
if(cp != CP_SYMBOL) {
len = WideCharToMultiByte(cp, 0, str, count, NULL, 0, NULL, NULL);
ascii = HeapAlloc(GetProcessHeap(), 0, len);
WideCharToMultiByte( CP_ACP, 0, str, count, ascii, len, NULL, NULL );
WideCharToMultiByte(cp, 0, str, count, ascii, len, NULL, NULL);
} else {
len = count;
ascii = HeapAlloc(GetProcessHeap(), 0, len);
for(i = 0; i < count; i++) ascii[i] = (BYTE)(str[i] & 0xff);
}
TRACE("mapped %s -> %s\n", debugstr_wn(str, count), debugstr_an(ascii, len));
if (lprect) CONV_RECT32TO16(lprect,&rect16);
if(lpDx) {
lpdx16 = HeapAlloc( GetProcessHeap(), 0, sizeof(INT16)*len );
for(i = j = 0; i < len; )
if(IsDBCSLeadByteEx(cp, ascii[i])) {
lpdx16[i++] = lpDx[j++];
lpdx16[i++] = 0;
} else
lpdx16[i++] = lpDx[j++];
}
ret = MFDRV_MetaExtTextOut(dev,x,y,flags,lprect?&rect16:NULL,ascii,len,lpdx16);
HeapFree( GetProcessHeap(), 0, ascii );
if (lpdx16) HeapFree( GetProcessHeap(), 0, lpdx16 );
return ret;
}