Author: jimtabor Date: Mon Aug 17 03:34:20 2009 New Revision: 42751
URL: http://svn.reactos.org/svn/reactos?rev=42751&view=rev Log: - Move GetCharacterPlacement functions into new locations. Implemented GetCharacterPlacementA from wine port. - Port from wine, original authors: Juergen Schmied juergen.schmied@metronet.de, Peter Oberndorfer kumbayo84@arcor.de
Modified: trunk/reactos/dll/win32/gdi32/misc/stubsa.c trunk/reactos/dll/win32/gdi32/objects/font.c trunk/reactos/subsystems/win32/win32k/objects/font.c trunk/reactos/subsystems/win32/win32k/stubs/stubs.c
Modified: trunk/reactos/dll/win32/gdi32/misc/stubsa.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/misc/stubsa... ============================================================================== --- trunk/reactos/dll/win32/gdi32/misc/stubsa.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdi32/misc/stubsa.c [iso-8859-1] Mon Aug 17 03:34:20 2009 @@ -12,28 +12,6 @@ #include "precomp.h"
#define UNIMPLEMENTED DbgPrint("GDI32: %s is unimplemented, please try again later.\n", __FUNCTION__); - - - - -/* - * @unimplemented - */ -DWORD -WINAPI -GetCharacterPlacementA( - HDC hDc, - LPCSTR a1, - int a2, - int a3, - LPGCP_RESULTSA a4, - DWORD a5 - ) -{ - UNIMPLEMENTED; - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; -}
/* * @unimplemented
Modified: trunk/reactos/dll/win32/gdi32/objects/font.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/fon... ============================================================================== --- trunk/reactos/dll/win32/gdi32/objects/font.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdi32/objects/font.c [iso-8859-1] Mon Aug 17 03:34:20 2009 @@ -425,6 +425,58 @@ return IntEnumFontFamilies(hdc, &LogFont, lpEnumFontFamProc, lParam, FALSE); }
+ +/* + * @implemented + */ +DWORD +WINAPI +GetCharacterPlacementA( + HDC hdc, + LPCSTR lpString, + INT uCount, + INT nMaxExtent, + GCP_RESULTSA *lpResults, + DWORD dwFlags) +{ + WCHAR *lpStringW; + INT uCountW; + GCP_RESULTSW resultsW; + DWORD ret; + UINT font_cp; + + if ( !lpString || uCount <= 0 || (nMaxExtent < 0 && nMaxExtent != -1 ) ) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } +/* TRACE("%s, %d, %d, 0x%08x\n", + debugstr_an(lpString, uCount), uCount, nMaxExtent, dwFlags); +*/ + /* both structs are equal in size */ + memcpy(&resultsW, lpResults, sizeof(resultsW)); + + lpStringW = FONT_mbtowc(hdc, lpString, uCount, &uCountW, &font_cp); + if(lpResults->lpOutString) + resultsW.lpOutString = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*uCountW); + + ret = GetCharacterPlacementW(hdc, lpStringW, uCountW, nMaxExtent, &resultsW, dwFlags); + + lpResults->nGlyphs = resultsW.nGlyphs; + lpResults->nMaxFit = resultsW.nMaxFit; + + if(lpResults->lpOutString) { + WideCharToMultiByte(font_cp, 0, resultsW.lpOutString, uCountW, + lpResults->lpOutString, uCount, NULL, NULL ); + } + + HeapFree(GetProcessHeap(), 0, lpStringW); + HeapFree(GetProcessHeap(), 0, resultsW.lpOutString); + + return ret; +} + + /* * @implemented */ @@ -505,6 +557,47 @@ ret = MAKELONG(size.cx, size.cy);
return ret; +} + +DWORD +WINAPI +NewGetCharacterPlacementW( + HDC hdc, + LPCWSTR lpString, + INT uCount, + INT nMaxExtent, + GCP_RESULTSW *lpResults, + DWORD dwFlags + ) +{ + INT nSet; + SIZE Size = {0,0}; + + if ( !lpString || uCount <= 0 || (nMaxExtent < 0 && nMaxExtent != -1 ) ) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + if ( !lpResults ) + { + if ( GetTextExtentPointW(hdc, lpString, uCount, &Size) ) + { + return MAKELONG(Size.cx, Size.cy); + } + return 0; + } + + nSet = uCount; + if ( nSet > lpResults->nGlyphs ) + nSet = lpResults->nGlyphs; + + return NtGdiGetCharacterPlacementW( hdc, + (LPWSTR)lpString, + nSet, + nMaxExtent, + lpResults, + dwFlags); }
/*
Modified: trunk/reactos/subsystems/win32/win32k/objects/font.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/font.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/font.c [iso-8859-1] Mon Aug 17 03:34:20 2009 @@ -215,6 +215,23 @@
ExFreePoolWithTag(SafeFileName.Buffer, TAG_STRING); return Ret; +} + + /* + * @unimplemented + */ +DWORD +APIENTRY +NtGdiGetCharacterPlacementW( + IN HDC hdc, + IN LPWSTR pwsz, + IN INT nCount, + IN INT nMaxExtent, + IN OUT LPGCP_RESULTSW pgcpw, + IN DWORD dwFlags) +{ + UNIMPLEMENTED; + return 0; }
DWORD
Modified: trunk/reactos/subsystems/win32/win32k/stubs/stubs.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/stu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/stubs/stubs.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/stubs/stubs.c [iso-8859-1] Mon Aug 17 03:34:20 2009 @@ -1164,23 +1164,6 @@ /* * @unimplemented */ -DWORD -APIENTRY -NtGdiGetCharacterPlacementW( - IN HDC hdc, - IN LPWSTR pwsz, - IN INT nCount, - IN INT nMaxExtent, - IN OUT LPGCP_RESULTSW pgcpw, - IN DWORD dwFlags) -{ - UNIMPLEMENTED; - return 0; -} - - /* - * @unimplemented - */ BOOL APIENTRY NtGdiGetCharWidthInfo(