From e3ba837e2e30fb9b13f9ce3448cd594ce3713097 Mon Sep 17 00:00:00 2001 From: James Tabor Date: Sat, 12 Dec 2009 00:19:37 +0000 Subject: [PATCH] [Win32k] - Create a Gre function for GetKerningPairs. svn path=/trunk/; revision=44541 --- .../subsystems/win32/win32k/objects/font.c | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/reactos/subsystems/win32/win32k/objects/font.c b/reactos/subsystems/win32/win32k/objects/font.c index bac6d9f264a..41a75cdb43f 100644 --- a/reactos/subsystems/win32/win32k/objects/font.c +++ b/reactos/subsystems/win32/win32k/objects/font.c @@ -13,8 +13,69 @@ #define NDEBUG #include +DWORD FASTCALL GreGetGlyphIndicesW(HDC,LPWSTR,INT,LPWORD,DWORD,DWORD); + /** Internal ******************************************************************/ +DWORD +FASTCALL +GreGetKerningPairs( + HDC hDC, + ULONG NumPairs, + LPKERNINGPAIR krnpair) +{ + PDC dc; + PDC_ATTR pdcattr; + PTEXTOBJ TextObj; + PFONTGDI FontGDI; + DWORD Count; + KERNINGPAIR *pKP; + + dc = DC_LockDc(hDC); + if (!dc) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return 0; + } + + pdcattr = dc->pdcattr; + TextObj = RealizeFontInit(pdcattr->hlfntNew); + DC_UnlockDc(dc); + + if (!TextObj) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return 0; + } + + FontGDI = ObjToGDI(TextObj->Font, FONT); + TEXTOBJ_UnlockText(TextObj); + + Count = ftGdiGetKerningPairs(FontGDI,0,NULL); + + if ( Count && krnpair ) + { + if (Count > NumPairs) + { + SetLastWin32Error(ERROR_INSUFFICIENT_BUFFER); + return 0; + } + pKP = ExAllocatePoolWithTag(PagedPool, Count * sizeof(KERNINGPAIR), TAG_GDITEXT); + if (!pKP) + { + SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); + return 0; + } + ftGdiGetKerningPairs(FontGDI,Count,pKP); + + RtlCopyMemory(krnpair, pKP, Count * sizeof(KERNINGPAIR)); + + ExFreePoolWithTag(pKP,TAG_GDITEXT); + } + return Count; +} + + DWORD FASTCALL GreGetCharacterPlacementW( @@ -31,6 +92,7 @@ GreGetCharacterPlacementW( { if (GreGetTextExtentW( hdc, pwsz, nCount, &Size, 1)) return MAKELONG(Size.cx, Size.cy); + return 0; } UNIMPLEMENTED; return 0;