Commit ab9e8bc9 authored by Douglas Ridgway's avatar Douglas Ridgway Committed by Alexandre Julliard

Implement TranslateCharsetInfo, change charset type to BYTE.

parent 311d329c
...@@ -420,10 +420,9 @@ typedef struct ...@@ -420,10 +420,9 @@ typedef struct
} CHARSETINFO,*LPCHARSETINFO; } CHARSETINFO,*LPCHARSETINFO;
/* Flags for TranslateCharsetInfo */ /* Flags for TranslateCharsetInfo */
/* FIXME */ #define TCI_SRCCHARSET 1
#define TCI_SRCCHARSET #define TCI_SRCCODEPAGE 2
#define TCI_SRCCODEPAGE #define TCI_SRCFONTSIG 3
#define TCI_SRCFONTSIG
/* Flags for ModifyWorldTransform */ /* Flags for ModifyWorldTransform */
#define MWT_IDENTITY 1 #define MWT_IDENTITY 1
...@@ -469,7 +468,7 @@ typedef struct ...@@ -469,7 +468,7 @@ typedef struct
CHAR dfUnderline; CHAR dfUnderline;
CHAR dfStrikeOut; CHAR dfStrikeOut;
INT16 dfWeight; INT16 dfWeight;
CHAR dfCharSet; BYTE dfCharSet;
INT16 dfPixWidth; INT16 dfPixWidth;
INT16 dfPixHeight; INT16 dfPixHeight;
CHAR dfPitchAndFamily; CHAR dfPitchAndFamily;
...@@ -511,30 +510,33 @@ typedef struct ...@@ -511,30 +510,33 @@ typedef struct
#define FW_BLACK 900 #define FW_BLACK 900
/* lfCharSet values */ /* lfCharSet values */
#define ANSI_CHARSET (CHAR)0 /* CP1252, ansi-0, iso8859-{1,15} */ #define ANSI_CHARSET (BYTE)0 /* CP1252, ansi-0, iso8859-{1,15} */
#define DEFAULT_CHARSET (CHAR)1 #define DEFAULT_CHARSET (BYTE)1
#define SYMBOL_CHARSET (CHAR)2 #define SYMBOL_CHARSET (BYTE)2
#define SHIFTJIS_CHARSET (CHAR)128 #define SHIFTJIS_CHARSET (BYTE)128 /* CP932 */
#define HANGEUL_CHARSET (CHAR)129 /* ksc5601.1987-0 */ #define HANGEUL_CHARSET (BYTE)129 /* CP949, ksc5601.1987-0 */
#define GB2312_CHARSET (CHAR)134 /* gb2312.1980-0 */ #define HANGUL_CHARSET HANGEUL_CHARSET
#define CHINESEBIG5_CHARSET (CHAR)136 /* big5.et-0 */ #define GB2312_CHARSET (BYTE)134 /* CP936, gb2312.1980-0 */
#define GREEK_CHARSET (CHAR)161 /* CP1253 */ #define CHINESEBIG5_CHARSET (BYTE)136 /* CP950, big5.et-0 */
#define TURKISH_CHARSET (CHAR)162 /* CP1254, -iso8859-9 */ #define GREEK_CHARSET (BYTE)161 /* CP1253 */
#define HEBREW_CHARSET (CHAR)177 /* CP1255, -iso8859-8 */ #define TURKISH_CHARSET (BYTE)162 /* CP1254, -iso8859-9 */
#define ARABIC_CHARSET (CHAR)178 /* CP1256, -iso8859-6 */ #define HEBREW_CHARSET (BYTE)177 /* CP1255, -iso8859-8 */
#define BALTIC_CHARSET (CHAR)186 /* CP1257, -iso8859-10 */ #define ARABIC_CHARSET (BYTE)178 /* CP1256, -iso8859-6 */
#define RUSSIAN_CHARSET (CHAR)204 /* CP1251, -iso8859-5 */ #define BALTIC_CHARSET (BYTE)186 /* CP1257, -iso8859-10 */
#define EE_CHARSET (CHAR)238 /* CP1250, -iso8859-2 */ #define RUSSIAN_CHARSET (BYTE)204 /* CP1251, -iso8859-5 */
#define OEM_CHARSET (CHAR)255 #define EE_CHARSET (BYTE)238 /* CP1250, -iso8859-2 */
#define EASTEUROPE_CHARSET EE_CHARSET
#define THAI_CHARSET (BYTE)222 /* CP874, iso8859-11, tis620 */
#define JOHAB_CHARSET (BYTE)130 /* korean (johab) CP1361 */
#define OEM_CHARSET (BYTE)255
/* I don't know if the values of *_CHARSET macros are defined in Windows /* I don't know if the values of *_CHARSET macros are defined in Windows
* or if we can choose them as we want. -- srtxg * or if we can choose them as we want. -- srtxg
*/ */
#define THAI_CHARSET (CHAR)239 /* iso8859-11, tis620 */ #define VISCII_CHARSET (BYTE)240 /* viscii1.1-1 */
#define VISCII_CHARSET (CHAR)240 /* viscii1.1-1 */ #define TCVN_CHARSET (BYTE)241 /* tcvn-0 */
#define TCVN_CHARSET (CHAR)241 /* tcvn-0 */ #define KOI8_CHARSET (BYTE)242 /* koi8-{r,u,ru} */
#define KOI8_CHARSET (CHAR)242 /* koi8-{r,u,ru} */ #define ISO3_CHARSET (BYTE)243 /* iso8859-3 */
#define ISO3_CHARSET (CHAR)243 /* iso8859-3 */ #define ISO4_CHARSET (BYTE)244 /* iso8859-4 */
#define ISO4_CHARSET (CHAR)244 /* iso8859-4 */
/* lfOutPrecision values */ /* lfOutPrecision values */
#define OUT_DEFAULT_PRECIS 0 #define OUT_DEFAULT_PRECIS 0
......
...@@ -27,7 +27,7 @@ typedef struct ...@@ -27,7 +27,7 @@ typedef struct
CHAR dfUnderline; CHAR dfUnderline;
CHAR dfStrikeOut; CHAR dfStrikeOut;
INT16 dfWeight; INT16 dfWeight;
CHAR dfCharSet; BYTE dfCharSet;
INT16 dfPixWidth; INT16 dfPixWidth;
INT16 dfPixHeight; INT16 dfPixHeight;
CHAR dfPitchAndFamily; CHAR dfPitchAndFamily;
......
...@@ -39,6 +39,51 @@ typedef struct ...@@ -39,6 +39,51 @@ typedef struct
DWORD dwFlags; DWORD dwFlags;
} fontEnum32; } fontEnum32;
/*
* For TranslateCharsetInfo
*/
#define FS(x) {{0,0,0,0},{0x1<<(x),0}}
#define MAXTCIINDEX 32
static CHARSETINFO FONT_tci[MAXTCIINDEX] = {
/* ANSI */
{ ANSI_CHARSET, 1252, FS(0)},
{ EASTEUROPE_CHARSET, 1250, FS(1)},
{ RUSSIAN_CHARSET, 1251, FS(2)},
{ GREEK_CHARSET, 1253, FS(3)},
{ TURKISH_CHARSET, 1254, FS(4)},
{ HEBREW_CHARSET, 1255, FS(5)},
{ ARABIC_CHARSET, 1256, FS(6)},
{ BALTIC_CHARSET, 1257, FS(7)},
/* reserved by ANSI */
{ DEFAULT_CHARSET, 0, FS(0)},
{ DEFAULT_CHARSET, 0, FS(0)},
{ DEFAULT_CHARSET, 0, FS(0)},
{ DEFAULT_CHARSET, 0, FS(0)},
{ DEFAULT_CHARSET, 0, FS(0)},
{ DEFAULT_CHARSET, 0, FS(0)},
{ DEFAULT_CHARSET, 0, FS(0)},
{ DEFAULT_CHARSET, 0, FS(0)},
/* ANSI and OEM */
{ THAI_CHARSET, 874, FS(16)},
{ SHIFTJIS_CHARSET, 932, FS(17)},
{ GB2312_CHARSET, 936, FS(18)},
{ HANGEUL_CHARSET, 949, FS(19)},
{ CHINESEBIG5_CHARSET, 950, FS(20)},
{ JOHAB_CHARSET, 1361, FS(21)},
/* reserved for alternate ANSI and OEM */
{ DEFAULT_CHARSET, 0, FS(0)},
{ DEFAULT_CHARSET, 0, FS(0)},
{ DEFAULT_CHARSET, 0, FS(0)},
{ DEFAULT_CHARSET, 0, FS(0)},
{ DEFAULT_CHARSET, 0, FS(0)},
{ DEFAULT_CHARSET, 0, FS(0)},
{ DEFAULT_CHARSET, 0, FS(0)},
{ DEFAULT_CHARSET, 0, FS(0)},
/* reserved for system */
{ DEFAULT_CHARSET, 0, FS(0)},
{ DEFAULT_CHARSET, 0, FS(0)},
};
/*********************************************************************** /***********************************************************************
* LOGFONT conversion functions. * LOGFONT conversion functions.
*/ */
...@@ -1352,8 +1397,6 @@ DWORD WINAPI GetKerningPairs32W( HDC32 hDC, DWORD cPairs, ...@@ -1352,8 +1397,6 @@ DWORD WINAPI GetKerningPairs32W( HDC32 hDC, DWORD cPairs,
* RETURNS * RETURNS
* TRUE on success, FALSE on failure. * TRUE on success, FALSE on failure.
* *
* BUGS
* Not implemented.
*/ */
BOOL32 WINAPI TranslateCharsetInfo( BOOL32 WINAPI TranslateCharsetInfo(
LPDWORD lpSrc, /* LPDWORD lpSrc, /*
...@@ -1364,7 +1407,22 @@ BOOL32 WINAPI TranslateCharsetInfo( ...@@ -1364,7 +1407,22 @@ BOOL32 WINAPI TranslateCharsetInfo(
LPCHARSETINFO lpCs, /* structure to receive charset information */ LPCHARSETINFO lpCs, /* structure to receive charset information */
DWORD flags /* determines interpretation of lpSrc */ DWORD flags /* determines interpretation of lpSrc */
) { ) {
FIXME(font,"(%p,%p,0x%08lx), stub.\n",lpSrc,lpCs, flags); int index = 0;
switch (flags) {
case TCI_SRCFONTSIG:
while (!(*lpSrc>>index & 0x0001) && index<MAXTCIINDEX) index++;
break;
case TCI_SRCCODEPAGE:
while ((UINT32) (lpSrc) != FONT_tci[index].ciACP && index < MAXTCIINDEX) index++;
break;
case TCI_SRCCHARSET:
while ((UINT32) (lpSrc) != FONT_tci[index].ciCharset && index < MAXTCIINDEX) index++;
break;
default:
return FALSE;
}
if (index >= MAXTCIINDEX || FONT_tci[index].ciCharset == DEFAULT_CHARSET) return FALSE;
memcpy(lpCs, &FONT_tci[index], sizeof(CHARSETINFO));
return TRUE; return TRUE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment