[GDI32] Integrate LpkGetTextExtentExPoint(). (#1362)

- Assume that GetTextExtentExPointWPri() uses the same kind of
  arguments as GetTextExtentExPointW().

- Add GetTextExtentExPointWPri() declaration to undocgdi.h.
This commit is contained in:
Baruch Rutman 2019-02-15 03:57:35 +02:00 committed by Hermès Bélusca-Maïto
parent 1078479358
commit 7143e411c4
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
4 changed files with 49 additions and 7 deletions

View file

@ -30,4 +30,15 @@ BOOL
WINAPI
GdiDrawStream(HDC dc, ULONG l, PGDI_DRAW_STREAM pDS);
BOOL
WINAPI
GetTextExtentExPointWPri(
HDC hdc,
LPCWSTR lpwsz,
INT cwc,
INT dxMax,
LPINT pcCh,
LPINT pdxOut,
LPSIZE psize);
#endif

View file

@ -51,9 +51,23 @@ typedef DWORD
DWORD dwUnused
);
typedef BOOL
(WINAPI* LPKGTEP)(
HDC hdc,
LPCWSTR lpString,
INT cString,
INT nMaxExtent,
LPINT lpnFit,
LPINT lpnDx,
LPSIZE lpSize,
DWORD dwUnused,
int unknown
);
extern HINSTANCE hLpk;
extern LPKETO LpkExtTextOut;
extern LPKGCP LpkGetCharacterPlacement;
extern LPKGTEP LpkGetTextExtentExPoint;
/* DEFINES *******************************************************************/
@ -67,6 +81,7 @@ extern LPKGCP LpkGetCharacterPlacement;
#define LPK_INIT 1
#define LPK_ETO 2
#define LPK_GCP 3
#define LPK_GTEP 4
/* MACRO ********************************************************************/

View file

@ -296,6 +296,9 @@ GetTextExtentExPointW(
DPRINT("nMaxExtent is invalid: %d\n", nMaxExtent);
}
if (LoadLPK(LPK_GTEP))
return LpkGetTextExtentExPoint(hdc, lpszString, cchString, nMaxExtent, lpnFit, lpnDx, lpSize, 0, 0);
return NtGdiGetTextExtentExW (
hdc, (LPWSTR)lpszString, cchString, nMaxExtent, (PULONG)lpnFit, (PULONG)lpnDx, lpSize, 0 );
}
@ -308,14 +311,14 @@ BOOL
WINAPI
GetTextExtentExPointWPri(
_In_ HDC hdc,
_In_reads_(cwc) LPWSTR lpwsz,
_In_ ULONG cwc,
_In_ ULONG dxMax,
_Out_opt_ ULONG *pcCh,
_Out_writes_to_opt_(cwc, *pcCh) PULONG pdxOut,
_In_reads_(cwc) LPCWSTR lpwsz,
_In_ INT cwc,
_In_ INT dxMax,
_Out_opt_ LPINT pcCh,
_Out_writes_to_opt_(cwc, *pcCh) LPINT pdxOut,
_In_ LPSIZE psize)
{
return NtGdiGetTextExtentExW(hdc, lpwsz, cwc, dxMax, pcCh, pdxOut, psize, 0);
return NtGdiGetTextExtentExW(hdc, (LPWSTR)lpwsz, cwc, dxMax, (PULONG)pcCh, (PULONG)pdxOut, psize, 0);
}
/*

View file

@ -4,6 +4,7 @@
HINSTANCE hLpk = NULL;
LPKETO LpkExtTextOut = NULL;
LPKGCP LpkGetCharacterPlacement = NULL;
LPKGTEP LpkGetTextExtentExPoint = NULL;
/**
* @name CalculateColorTableSize
@ -417,7 +418,7 @@ EnumLogFontExW2A( LPENUMLOGFONTEXA fontA, CONST ENUMLOGFONTEXW *fontW )
* LPK.DLL loader function
*
* Returns TRUE if a valid parameter was passed and loading was successful,
* retruns FALSE otherwise.
* returns FALSE otherwise.
*/
BOOL WINAPI LoadLPK(INT LpkFunctionID)
{
@ -455,6 +456,18 @@ BOOL WINAPI LoadLPK(INT LpkFunctionID)
return TRUE;
case LPK_GTEP:
if (!LpkGetTextExtentExPoint) // Check if the function is already loaded
LpkGetTextExtentExPoint = (LPKGTEP) GetProcAddress(hLpk, "LpkGetTextExtentExPoint");
if (!LpkGetTextExtentExPoint)
{
FreeLibrary(hLpk);
return FALSE;
}
return TRUE;
default:
FreeLibrary(hLpk);
return FALSE;