https://git.reactos.org/?p=reactos.git;a=commitdiff;h=87c529a537d1c92610fc2a3e41a25079d86db180

commit 87c529a537d1c92610fc2a3e41a25079d86db180
Author:     Baruch Rutman <[email protected]>
AuthorDate: Fri Sep 28 18:10:10 2018 +0300
Commit:     Hermès Bélusca-Maïto <[email protected]>
CommitDate: Mon Oct 8 16:17:42 2018 +0200

    [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.
---
 dll/win32/lpk/lpk.c                | 12 +++++++++---
 win32ss/user/user32/windows/font.c |  6 +++---
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/dll/win32/lpk/lpk.c b/dll/win32/lpk/lpk.c
index b99e8a3c65..2bbb744c88 100644
--- a/dll/win32/lpk/lpk.c
+++ b/dll/win32/lpk/lpk.c
@@ -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))
     {
diff --git a/win32ss/user/user32/windows/font.c 
b/win32ss/user/user32/windows/font.c
index 3d16eddb9a..01b234d2aa 100644
--- a/win32ss/user/user32/windows/font.c
+++ b/win32ss/user/user32/windows/font.c
@@ -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))
     {

Reply via email to