gdi32: Implement GdiGetCodePage.

This commit is contained in:
Dmitry Timoshkov 2007-03-26 17:03:51 +09:00 committed by Alexandre Julliard
parent 908cc50e23
commit 826e937a81
3 changed files with 27 additions and 15 deletions

View File

@ -347,22 +347,11 @@ static void FONT_NewTextMetricExWToA(const NEWTEXTMETRICEXW *ptmW, NEWTEXTMETRIC
/*********************************************************************** /***********************************************************************
* FONT_mbtowc * GdiGetCodePage (GDI32.@)
*
* Returns a Unicode translation of str using the charset of the
* currently selected font in hdc. If count is -1 then str is assumed
* to be '\0' terminated, otherwise it contains the number of bytes to
* convert. If plenW is non-NULL, on return it will point to the
* number of WCHARs that have been written. If pCP is non-NULL, on
* return it will point to the codepage used in the conversion. The
* caller should free the returned LPWSTR from the process heap
* itself.
*/ */
static LPWSTR FONT_mbtowc(HDC hdc, LPCSTR str, INT count, INT *plenW, UINT *pCP) DWORD WINAPI GdiGetCodePage( HDC hdc )
{ {
UINT cp = CP_ACP; UINT cp = CP_ACP;
INT lenW;
LPWSTR strW;
CHARSETINFO csi; CHARSETINFO csi;
int charset = GetTextCharset(hdc); int charset = GetTextCharset(hdc);
@ -402,6 +391,28 @@ static LPWSTR FONT_mbtowc(HDC hdc, LPCSTR str, INT count, INT *plenW, UINT *pCP)
} }
TRACE("charset %d => cp %d\n", charset, cp); TRACE("charset %d => cp %d\n", charset, cp);
return cp;
}
/***********************************************************************
* FONT_mbtowc
*
* Returns a Unicode translation of str using the charset of the
* currently selected font in hdc. If count is -1 then str is assumed
* to be '\0' terminated, otherwise it contains the number of bytes to
* convert. If plenW is non-NULL, on return it will point to the
* number of WCHARs that have been written. If pCP is non-NULL, on
* return it will point to the codepage used in the conversion. The
* caller should free the returned LPWSTR from the process heap
* itself.
*/
static LPWSTR FONT_mbtowc(HDC hdc, LPCSTR str, INT count, INT *plenW, UINT *pCP)
{
UINT cp;
INT lenW;
LPWSTR strW;
cp = GdiGetCodePage( hdc );
if(count == -1) count = strlen(str); if(count == -1) count = strlen(str);
lenW = MultiByteToWideChar(cp, 0, str, count, NULL, 0); lenW = MultiByteToWideChar(cp, 0, str, count, NULL, 0);

View File

@ -178,8 +178,8 @@
@ stdcall GdiFlush() @ stdcall GdiFlush()
# @ stub GdiFullscreenControl # @ stub GdiFullscreenControl
@ stdcall GdiGetBatchLimit() @ stdcall GdiGetBatchLimit()
@ stdcall GdiGetCharDimensions(ptr ptr ptr) @ stdcall GdiGetCharDimensions(long ptr ptr)
# @ stub GdiGetCodePage @ stdcall GdiGetCodePage(long)
# @ stub GdiGetDC # @ stub GdiGetDC
# @ stub GdiGetDevmodeForPage # @ stub GdiGetDevmodeForPage
@ stub GdiGetLocalBitmap @ stub GdiGetLocalBitmap

View File

@ -3396,6 +3396,7 @@ BOOL WINAPI GdiComment(HDC,UINT,const BYTE *);
DEVMODEW * WINAPI GdiConvertToDevmodeW(const DEVMODEA *); DEVMODEW * WINAPI GdiConvertToDevmodeW(const DEVMODEA *);
BOOL WINAPI GdiFlush(void); BOOL WINAPI GdiFlush(void);
LONG WINAPI GdiGetCharDimensions(HDC, LPTEXTMETRICW, LONG *); LONG WINAPI GdiGetCharDimensions(HDC, LPTEXTMETRICW, LONG *);
DWORD WINAPI GdiGetCodePage(HDC);
BOOL WINAPI GdiGradientFill(HDC,PTRIVERTEX,ULONG,PVOID,ULONG,ULONG); BOOL WINAPI GdiGradientFill(HDC,PTRIVERTEX,ULONG,PVOID,ULONG,ULONG);
BOOL WINAPI GdiIsMetaFileDC(HDC); BOOL WINAPI GdiIsMetaFileDC(HDC);
BOOL WINAPI GdiIsMetaPrintDC(HDC); BOOL WINAPI GdiIsMetaPrintDC(HDC);