[GDI32][LPK] BiDi support for ExtTextOut and GetCharacterPlacement (#534)

Introduce BiDi (bi-directional text) support for ExtTextOut and GetCharacterPlacement, using Wine's GDI BIDI_Reorder function.
Solves the main issue with CORE-7003.

To be compatible with Win2k3+, introduce the "Language Pack" (LPK) dll.
- All the bidi code is removed from gdi32 and replaced by calls to LPK.
  Gdi32 uses dynamic linking to lpk.dll. In case of linking failure no bidi processing will be available.
- Implemented LpkGetCharacterPlacement.
- Implement LpkExtTextOut.
- Add a demo test program to show how the apis should function.
- Added all the remaining code, added special case for lpDx calculation if also GCP_GLYPHSHAPE flag was called.
  Applications that call GCP that use GCP_GLYPHSHAPE flags should also use the GCP_REORDER flag.
  (As written in dd144860(v=vs.85).aspx )
- Add ETO_RTLREADING flag handling.
  Imported the ETO_RTLREADING flag handling from wine, which changes the string part order (runs).
  A RRR1LLLRRR2 string without will show as RRR1LLLRRR2 without it, with it RRR2LLLRRR1.
This commit is contained in:
Baruch Rutman 2018-05-30 15:41:22 +03:00 committed by Hermès BÉLUSCA - MAÏTO
parent 3ca1ac639c
commit a4a59ad413
19 changed files with 1434 additions and 86 deletions

View file

@ -1,5 +1,10 @@
#include <precomp.h>
/* LoadLPK global variables */
HINSTANCE hLpk = NULL;
LPKETO LpkExtTextOut = NULL;
LPKGCP LpkGetCharacterPlacement = NULL;
/**
* @name CalculateColorTableSize
*
@ -408,3 +413,51 @@ EnumLogFontExW2A( LPENUMLOGFONTEXA fontA, CONST ENUMLOGFONTEXW *fontW )
fontA->elfScript[LF_FACESIZE-1] = '\0';
}
/*
* LPK.DLL loader function
*
* Returns TRUE if a valid parameter was passed and loading was successful,
* retruns FALSE otherwise.
*/
BOOL WINAPI LoadLPK(INT LpkFunctionID)
{
if(!hLpk) // Check if the DLL is already loaded
hLpk = LoadLibraryW(L"lpk.dll");
if (hLpk)
{
switch (LpkFunctionID)
{
case LPK_ETO:
if (!LpkExtTextOut) // Check if the function is already loaded
LpkExtTextOut = (LPKETO) GetProcAddress(hLpk, "LpkExtTextOut");
if (!LpkExtTextOut)
{
FreeLibrary(hLpk);
return FALSE;
}
return TRUE;
case LPK_GCP:
if (!LpkGetCharacterPlacement) // Check if the function is already loaded
LpkGetCharacterPlacement = (LPKGCP) GetProcAddress(hLpk, "LpkGetCharacterPlacement");
if (!LpkGetCharacterPlacement)
{
FreeLibrary(hLpk);
return FALSE;
}
return TRUE;
default:
FreeLibrary(hLpk);
return FALSE;
}
}
else
return FALSE;
}