Ignore:
Timestamp:
Jan 8, 2004, 12:11:55 PM (22 years ago)
Author:
sandervl
Message:

KOM: Fixed FONT_mbtowc(). If charset is 0, CP must not be 1252 in DBCS country; Restored calcDimensions(). The result of the old is the same as that of O32_GetTextExtent()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gdi32/font.cpp

    r10350 r10372  
    1 /* $Id: font.cpp,v 1.33 2003-12-01 13:28:10 sandervl Exp $ */
     1/* $Id: font.cpp,v 1.34 2004-01-08 11:11:55 sandervl Exp $ */
    22
    33/*
     
    167167    int charset = GetTextCharset(hdc);
    168168
     169    if( IsDBCSEnv() && ( charset == 0 ))
     170        cp = CP_ACP;
     171    else
    169172    /* Hmm, nicely designed api this one! */
    170173    if(TranslateCharsetInfo((DWORD*)charset, &csi, TCI_SRCCHARSET))
     
    172175    else {
    173176        switch(charset) {
    174         case OEM_CHARSET:
    175             cp = GetOEMCP();
    176             break;
    177         case DEFAULT_CHARSET:
    178             cp = GetACP();
    179             break;
    180 
    181         case VISCII_CHARSET:
    182         case TCVN_CHARSET:
    183         case KOI8_CHARSET:
    184         case ISO3_CHARSET:
    185         case ISO4_CHARSET:
    186           /* FIXME: These have no place here, but because x11drv
    187              enumerates fonts with these (made up) charsets some apps
    188              might use them and then the FIXME below would become
    189              annoying.  Now we could pick the intended codepage for
    190              each of these, but since it's broken anyway we'll just
    191              use CP_ACP and hope it'll go away...
    192           */
    193             cp = CP_ACP;
    194             break;
    195 
    196 
    197         default:
    198             dprintf(("Can't find codepage for charset %d\n", charset));
    199             break;
    200         }
     177    case OEM_CHARSET:
     178        cp = GetOEMCP();
     179        break;
     180    case DEFAULT_CHARSET:
     181        cp = GetACP();
     182        break;
     183
     184    case VISCII_CHARSET:
     185    case TCVN_CHARSET:
     186    case KOI8_CHARSET:
     187    case ISO3_CHARSET:
     188    case ISO4_CHARSET:
     189      /* FIXME: These have no place here, but because x11drv
     190         enumerates fonts with these (made up) charsets some apps
     191         might use them and then the FIXME below would become
     192         annoying.  Now we could pick the intended codepage for
     193         each of these, but since it's broken anyway we'll just
     194         use CP_ACP and hope it'll go away...
     195      */
     196        cp = CP_ACP;
     197        break;
     198
     199
     200    default:
     201        dprintf(("Can't find codepage for charset %d\n", charset));
     202        break;
     203    }
    201204    }
    202205
     
    206209    if(cp != CP_SYMBOL) {
    207210        lenW = MultiByteToWideChar(cp, 0, str, count, NULL, 0);
    208         strW = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, (lenW + 1) * sizeof(WCHAR));
    209         MultiByteToWideChar(cp, 0, str, count, strW, lenW);
     211    strW = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, (lenW + 1) * sizeof(WCHAR));
     212    MultiByteToWideChar(cp, 0, str, count, strW, lenW);
    210213    } else {
    211214        lenW = count;
    212         strW = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, (lenW + 1) * sizeof(WCHAR));
    213         for(i = 0; i < count; i++) strW[i] = (BYTE)str[i];
     215    strW = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, (lenW + 1) * sizeof(WCHAR));
     216    for(i = 0; i < count; i++) strW[i] = (BYTE)str[i];
    214217    }
    215218    strW[lenW] = '\0';
Note: See TracChangeset for help on using the changeset viewer.