From d5af0175c781a99a36744c3d13ac74006f557fd8 Mon Sep 17 00:00:00 2001 From: Gael de Chalendar Date: Sun, 22 Nov 1998 12:19:49 +0000 Subject: [PATCH] Partially complete GetTextCharsetInfo and corrects return values for this family of functions. --- include/windows.h | 6 +++--- objects/text.c | 37 ++++++++++++++++++++++++------------- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/include/windows.h b/include/windows.h index f9012048c6c..4b1048dd709 100644 --- a/include/windows.h +++ b/include/windows.h @@ -6883,7 +6883,7 @@ BOOL32 WINAPI GetStringTypeEx32W(LCID,DWORD,LPCWSTR,INT32,LPWORD); VOID WINAPI GetSystemInfo(LPSYSTEM_INFO); BOOL32 WINAPI GetSystemPowerStatus(LPSYSTEM_POWER_STATUS); VOID WINAPI GetSystemTime(LPSYSTEMTIME); -INT32 WINAPI GetTextCharsetInfo(HDC32,LPCHARSETINFO,DWORD); +UINT32 WINAPI GetTextCharsetInfo(HDC32,LPFONTSIGNATURE,DWORD); BOOL32 WINAPI GetTextExtentExPoint32A(HDC32,LPCSTR,INT32,INT32, LPINT32,LPINT32,LPSIZE32); BOOL32 WINAPI GetTextExtentExPoint32W(HDC32,LPCWSTR,INT32,INT32, @@ -8314,8 +8314,8 @@ UINT32 WINAPI GetTextAlign32(HDC32); INT16 WINAPI GetTextCharacterExtra16(HDC16); INT32 WINAPI GetTextCharacterExtra32(HDC32); #define GetTextCharacterExtra WINELIB_NAME(GetTextCharacterExtra) -INT16 WINAPI GetTextCharset16(HDC16); -INT32 WINAPI GetTextCharset32(HDC32); +UINT16 WINAPI GetTextCharset16(HDC16); +UINT32 WINAPI GetTextCharset32(HDC32); #define GetTextCharset WINELIB_NAME(GetTextCharset) COLORREF WINAPI GetTextColor16(HDC16); COLORREF WINAPI GetTextColor32(HDC32); diff --git a/objects/text.c b/objects/text.c index ac316418b7c..a25997810c7 100644 --- a/objects/text.c +++ b/objects/text.c @@ -721,12 +721,13 @@ DWORD WINAPI GetTabbedTextExtent32W( HDC32 hdc, LPCWSTR lpstr, INT32 count, * * NOTES * Should it return a UINT32 instead of an INT32? + * => YES, as GetTextCharsetInfo returns UINT32 * * RETURNS * Success: Character set identifier * Failure: DEFAULT_CHARSET */ -INT32 WINAPI GetTextCharset32( +UINT32 WINAPI GetTextCharset32( HDC32 hdc) /* [in] Handle to device context */ { /* MSDN docs say this is equivalent */ @@ -736,9 +737,9 @@ INT32 WINAPI GetTextCharset32( /*********************************************************************** * GetTextCharset16 [GDI.612] */ -INT16 WINAPI GetTextCharset16(HDC16 hdc) +UINT16 WINAPI GetTextCharset16(HDC16 hdc) { - return GetTextCharset32(hdc); + return (UINT16)GetTextCharset32(hdc); } /*********************************************************************** @@ -747,21 +748,31 @@ INT16 WINAPI GetTextCharset16(HDC16 hdc) * NOTES * Should csi be an LPFONTSIGNATURE instead of an LPCHARSETINFO? * Should it return a UINT32 instead of an INT32? + * => YES and YES, from win32.hlp from Borland * * RETURNS * Success: Character set identifier * Failure: DEFAULT_CHARSET */ -INT32 WINAPI GetTextCharsetInfo( - HDC32 hdc, /* [in] Handle to device context */ - LPCHARSETINFO csi, /* [out] Pointer to struct to receive data */ - DWORD flags) /* [in] Reserved - must be 0 */ +UINT32 WINAPI GetTextCharsetInfo( + HDC32 hdc, /* [in] Handle to device context */ + LPFONTSIGNATURE fs, /* [out] Pointer to struct to receive data */ + DWORD flags) /* [in] Reserved - must be 0 */ { - FIXME(text,"(0x%x,%p,%08lx): stub\n",hdc,csi,flags); - if (csi) { - csi->ciCharset = DEFAULT_CHARSET; - csi->ciACP = GetACP(); + HGDIOBJ32 hFont; + UINT32 charSet = DEFAULT_CHARSET; + LOGFONT32W lf; + + if (fs != NULL) + FIXME(text,"(0x%x,%p,%08lx): stub\n",hdc,fs,flags); + hFont = GetCurrentObject(hdc, OBJ_FONT); + if (hFont == 0) + return(DEFAULT_CHARSET); + if ( GetObject32W(hFont, sizeof(LOGFONT32W), &lf) != 0 ) + charSet = lf.lfCharSet; + + if (fs != NULL) { + /* ... fill fontstruct too ... still to do*/ } - /* ... fill fontstruct too ... */ - return DEFAULT_CHARSET; + return charSet; }