Author: jimtabor Date: Mon Aug 17 07:46:57 2009 New Revision: 42754
URL: http://svn.reactos.org/svn/reactos?rev=42754&view=rev Log: - Add win32k support functions for GetCharacterPlacement.
Modified: trunk/reactos/subsystems/win32/win32k/include/text.h trunk/reactos/subsystems/win32/win32k/objects/font.c trunk/reactos/subsystems/win32/win32k/objects/text.c
Modified: trunk/reactos/subsystems/win32/win32k/include/text.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/text.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/text.h [iso-8859-1] Mon Aug 17 07:46:57 2009 @@ -109,6 +109,8 @@ BOOL NTAPI GreExtTextOutW(IN HDC,IN INT,IN INT,IN UINT,IN OPTIONAL RECTL*, IN LPWSTR, IN INT, IN OPTIONAL LPINT, IN DWORD); DWORD FASTCALL IntGetCharDimensions(HDC, PTEXTMETRICW, PDWORD); +BOOL FASTCALL GreGetTextExtentW(HDC,LPWSTR,INT,LPSIZE,UINT); +BOOL FASTCALL GreGetTextExtentExW(HDC,LPWSTR,ULONG,ULONG,PULONG,PULONG,LPSIZE,FLONG);
#define IntLockProcessPrivateFonts(W32Process) \ ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&W32Process->PrivateFontListLock)
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 07:46:57 2009 @@ -14,6 +14,27 @@ #include <debug.h>
/** Internal ******************************************************************/ + +DWORD +FASTCALL +GreGetCharacterPlacementW( + HDC hdc, + LPWSTR pwsz, + INT nCount, + INT nMaxExtent, + LPGCP_RESULTSW pgcpw, + DWORD dwFlags) +{ + SIZE Size = {0,0}; + + if (!pgcpw) + { + if (GreGetTextExtentW( hdc, pwsz, nCount, &Size, 1)) + return MAKELONG(Size.cx, Size.cy); + } + UNIMPLEMENTED; + return 0; +}
INT FASTCALL
Modified: trunk/reactos/subsystems/win32/win32k/objects/text.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/text.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/text.c [iso-8859-1] Mon Aug 17 07:46:57 2009 @@ -13,7 +13,114 @@ #define NDEBUG #include <debug.h>
-/** Functions ******************************************************************/ +/** Functions *****************************************************************/ + +BOOL +FASTCALL +GreGetTextExtentW( + HDC hDC, + LPWSTR lpwsz, + INT cwc, + LPSIZE psize, + UINT flOpts) +{ + PDC pdc; + PDC_ATTR pdcattr; + BOOL Result; + PTEXTOBJ TextObj; + + if (!cwc) + { + psize->cx = 0; + psize->cy = 0; + return TRUE; + } + + pdc = DC_LockDc(hDC); + if (!pdc) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return FALSE; + } + + pdcattr = pdc->pdcattr; + + TextObj = RealizeFontInit(pdcattr->hlfntNew); + if ( TextObj ) + { + Result = TextIntGetTextExtentPoint( pdc, + TextObj, + lpwsz, + cwc, + 0, + NULL, + 0, + psize); + TEXTOBJ_UnlockText(TextObj); + } + else + Result = FALSE; + + DC_UnlockDc(pdc); + return Result; +} + +BOOL +FASTCALL +GreGetTextExtentExW( + HDC hDC, + LPWSTR String, + ULONG Count, + ULONG MaxExtent, + PULONG Fit, + PULONG Dx, + LPSIZE pSize, + FLONG fl) +{ + PDC pdc; + PDC_ATTR pdcattr; + BOOL Result; + PTEXTOBJ TextObj; + + if ( (!String && Count ) || !pSize ) + { + SetLastWin32Error(ERROR_INVALID_PARAMETER); + return FALSE; + } + + if ( !Count ) + { + if ( Fit ) Fit = 0; + return TRUE; + } + + pdc = DC_LockDc(hDC); + if (NULL == pdc) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return FALSE; + } + pdcattr = pdc->pdcattr; + + TextObj = RealizeFontInit(pdcattr->hlfntNew); + if ( TextObj ) + { + Result = TextIntGetTextExtentPoint( pdc, + TextObj, + String, + Count, + MaxExtent, + (LPINT)Fit, + (LPINT)Dx, + pSize); + TEXTOBJ_UnlockText(TextObj); + } + else + Result = FALSE; + + DC_UnlockDc(pdc); + return Result; +}
DWORD APIENTRY @@ -214,8 +321,14 @@ TextObj = RealizeFontInit(pdcattr->hlfntNew); if ( TextObj ) { - Result = TextIntGetTextExtentPoint(dc, TextObj, String, Count, MaxExtent, - NULL == UnsafeFit ? NULL : &Fit, Dx, &Size); + Result = TextIntGetTextExtentPoint( dc, + TextObj, + String, + Count, + MaxExtent, + NULL == UnsafeFit ? NULL : &Fit, + Dx, + &Size); TEXTOBJ_UnlockText(TextObj); } else