[LPK] Small fix and a related comment. (#890)

[LPK][USER32] Fix reading layout checks.

- Both functions don't care about DT_RTLREADING flag.
- Added a different method to check reading order.

[USER32] Remove gcc-build breaker semicolon.
This commit is contained in:
Baruch Rutman 2018-09-28 18:10:10 +03:00 committed by Hermès Bélusca-Maïto
parent 17d4df8102
commit 87c529a537
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
2 changed files with 12 additions and 6 deletions

View file

@ -65,6 +65,7 @@ static void PSM_PrepareToDraw(LPCWSTR str, INT count, LPWSTR new_str, LPINT new_
static void LPK_DrawUnderscore(HDC hdc, int x, int y, LPCWSTR str, int count, int offset)
{
SCRIPT_STRING_ANALYSIS ssa;
DWORD dwSSAFlags = SSA_GLYPHS;
int prefix_x;
int prefix_end;
int pos;
@ -78,8 +79,11 @@ static void LPK_DrawUnderscore(HDC hdc, int x, int y, LPCWSTR str, int count, in
if (ScriptIsComplex(str, count, SIC_COMPLEX) == S_OK)
{
if (GetLayout(hdc) & LAYOUT_RTL || GetTextAlign(hdc) & TA_RTLREADING)
dwSSAFlags |= SSA_RTL;
hr = ScriptStringAnalyse(hdc, str, count, (3 * count / 2 + 16),
-1, SSA_GLYPHS, -1, NULL, NULL, NULL, NULL, NULL, &ssa);
-1, dwSSAFlags, -1, NULL, NULL, NULL, NULL, NULL, &ssa);
}
if (hr == S_OK)
@ -328,6 +332,8 @@ LpkGetCharacterPlacement(
* without any of these flags the behavior is the string being drawn without the amperstands and
* with the underscore.
* user32 has an equivalent function - UserLpkPSMTextOut
*
* Note: lpString does not need to be null terminated
*/
INT WINAPI LpkPSMTextOut(HDC hdc, int x, int y, LPCWSTR lpString, int cString, DWORD dwFlags)
{
@ -341,7 +347,7 @@ INT WINAPI LpkPSMTextOut(HDC hdc, int x, int y, LPCWSTR lpString, int cString, D
if (dwFlags & DT_NOPREFIX)
{
LpkExtTextOut(hdc, x, y, (dwFlags & DT_RTLREADING) ? ETO_RTLREADING : 0, NULL, lpString, cString - 1, NULL, 0);
LpkExtTextOut(hdc, x, y, 0, NULL, lpString, cString, NULL, 0);
GetTextExtentPointW(hdc, lpString, cString, &size);
return size.cx;
}
@ -354,7 +360,7 @@ INT WINAPI LpkPSMTextOut(HDC hdc, int x, int y, LPCWSTR lpString, int cString, D
PSM_PrepareToDraw(lpString, cString, display_str, &len);
if (!(dwFlags & DT_PREFIXONLY))
LpkExtTextOut(hdc, x, y, (dwFlags & DT_RTLREADING) ? ETO_RTLREADING : 0, NULL, display_str, len, NULL, 0);
LpkExtTextOut(hdc, x, y, 0, NULL, display_str, len, NULL, 0);
if (!(dwFlags & DT_HIDEPREFIX))
{

View file

@ -414,7 +414,7 @@ INT WINAPI UserLpkPSMTextOut(HDC hdc, int x, int y, LPCWSTR lpString, int cStrin
{
SIZE size;
TEXTMETRICW tm;
int len, i = 0, j = 0;;
int len, i = 0, j = 0;
int prefix_count = 0, prefix_offset = -1;
LPWSTR display_str = NULL;
int prefix_x, prefix_end;
@ -426,7 +426,7 @@ INT WINAPI UserLpkPSMTextOut(HDC hdc, int x, int y, LPCWSTR lpString, int cStrin
if (dwFlags & DT_NOPREFIX) /* Windows ignores this */
{
ExtTextOutW(hdc, x, y, (dwFlags & DT_RTLREADING) ? ETO_RTLREADING : 0, NULL, lpString, cString, NULL);
TextOutW(hdc, x, y, lpString, cString);
GetTextExtentPointW(hdc, lpString, cString, &size);
return size.cx;
}
@ -455,7 +455,7 @@ INT WINAPI UserLpkPSMTextOut(HDC hdc, int x, int y, LPCWSTR lpString, int cStrin
len = wcslen(display_str);
if (!(dwFlags & DT_PREFIXONLY))
ExtTextOutW(hdc, x, y, (dwFlags & DT_RTLREADING) ? ETO_RTLREADING : 0, NULL, display_str, len, NULL);
TextOutW(hdc, x, y, display_str, len);
if (!(dwFlags & DT_HIDEPREFIX))
{