Aric Stewart : ups10: Corrected rtl implementation for ScriptStringXtoCP and ScriptStringXtoCP.
Alexandre Julliard
julliard at winehq.org
Mon Nov 1 11:54:31 CDT 2010
Module: wine
Branch: master
Commit: 7891f05b88ab7b274c4cb9d4864ee92612ff241d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=7891f05b88ab7b274c4cb9d4864ee92612ff241d
Author: Aric Stewart <aric at codeweavers.com>
Date: Fri Oct 29 13:48:48 2010 -0500
ups10: Corrected rtl implementation for ScriptStringXtoCP and ScriptStringXtoCP.
---
dlls/usp10/tests/usp10.c | 16 +++++-----------
dlls/usp10/usp10.c | 24 ++++++++++++++++++++----
2 files changed, 25 insertions(+), 15 deletions(-)
diff --git a/dlls/usp10/tests/usp10.c b/dlls/usp10/tests/usp10.c
index 1b7bab4..56385c6 100644
--- a/dlls/usp10/tests/usp10.c
+++ b/dlls/usp10/tests/usp10.c
@@ -1363,7 +1363,7 @@ static void test_ScriptStringXtoCP_CPtoX(HDC hdc)
hr = ScriptStringCPtoX(ssa, Cp, FALSE, &lead);
ok(hr == S_OK, "ScriptStringCPtoX should return S_OK not %08x\n", hr);
if (rtl[Cp])
- todo_wine ok(lead > trail, "Leading values should be after trialing for rtl chracters(%i)\n",Cp);
+ ok(lead > trail, "Leading values should be after trialing for rtl chracters(%i)\n",Cp);
else
ok(lead < trail, "Trailing values should be after leading for ltr chracters(%i)\n",Cp);
@@ -1375,9 +1375,7 @@ static void test_ScriptStringXtoCP_CPtoX(HDC hdc)
if (rtl[Cp]) X--; else X++;
hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing);
ok(hr == S_OK, "ScriptStringXtoCP should return S_OK not %08x\n", hr);
- if (rtl[Cp]) todo_wine
ok(Cp == Ch, "ScriptStringXtoCP should return Ch = %d not %d for X = %d\n", Cp, Ch, trail);
- if (rtl[Cp]) todo_wine
ok(iTrailing == FALSE, "ScriptStringXtoCP should return iTrailing = 0 not %d for X = %d\n",
iTrailing, X);
@@ -1386,9 +1384,7 @@ static void test_ScriptStringXtoCP_CPtoX(HDC hdc)
if (rtl[Cp]) X++; else X--;
hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing);
ok(hr == S_OK, "ScriptStringXtoCP should return S_OK not %08x\n", hr);
- if (rtl[Cp]) todo_wine
ok(Cp == Ch, "ScriptStringXtoCP should return Ch = %d not %d for X = %d\n", Cp, Ch, trail);
- if (rtl[Cp]) todo_wine
ok(iTrailing == TRUE, "ScriptStringXtoCP should return iTrailing = 1 not %d for X = %d\n",
iTrailing, X);
@@ -1399,10 +1395,9 @@ static void test_ScriptStringXtoCP_CPtoX(HDC hdc)
X++;
hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing);
ok(hr == S_OK, "ScriptStringXtoCP should return S_OK not %08x\n", hr);
- if (rtl[Cp]) todo_wine
ok(Cp + 1 == Ch, "ScriptStringXtoCP should return Ch = %d not %d for X = %d\n", Cp + 1, Ch, trail);
if (rtl[Cp+1])
- todo_wine ok(iTrailing == TRUE, "ScriptStringXtoCP should return iTrailing = 1 not %d for X = %d\n",
+ ok(iTrailing == TRUE, "ScriptStringXtoCP should return iTrailing = 1 not %d for X = %d\n",
iTrailing, X);
else
ok(iTrailing == FALSE, "ScriptStringXtoCP should return iTrailing = 0 not %d for X = %d\n",
@@ -1416,10 +1411,9 @@ static void test_ScriptStringXtoCP_CPtoX(HDC hdc)
X--;
hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing);
ok(hr == S_OK, "ScriptStringXtoCP should return S_OK not %08x\n", hr);
- if (rtl[Cp]) todo_wine
ok(Cp - 1 == Ch, "ScriptStringXtoCP should return Ch = %d not %d for X = %d\n", Cp - 1, Ch, trail);
if (Cp != 0 && rtl[Cp-1])
- todo_wine ok(iTrailing == FALSE, "ScriptStringXtoCP should return iTrailing = 0 not %d for X = %d\n",
+ ok(iTrailing == FALSE, "ScriptStringXtoCP should return iTrailing = 0 not %d for X = %d\n",
iTrailing, X);
else
ok(iTrailing == TRUE, "ScriptStringXtoCP should return iTrailing = 1 not %d for X = %d\n",
@@ -1436,8 +1430,8 @@ static void test_ScriptStringXtoCP_CPtoX(HDC hdc)
X--;
hr = ScriptStringXtoCP(ssa, X, &Ch, &iTrailing);
ok(hr == S_OK, "ScriptStringXtoCP should return S_OK not %08x\n", hr);
- todo_wine ok(Ch == 1, "ScriptStringXtoCP should return Ch = 1 not %d for X outside leading edge when rtl\n", Ch);
- todo_wine ok(iTrailing == FALSE, "ScriptStringXtoCP should return iTrailing = 0 not %d for X = outside leading edge when rtl\n",
+ ok(Ch == 1, "ScriptStringXtoCP should return Ch = 1 not %d for X outside leading edge when rtl\n", Ch);
+ ok(iTrailing == FALSE, "ScriptStringXtoCP should return iTrailing = 0 not %d for X = outside leading edge when rtl\n",
iTrailing);
}
else
diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c
index 65f6d2c..e483868 100644
--- a/dlls/usp10/usp10.c
+++ b/dlls/usp10/usp10.c
@@ -936,6 +936,7 @@ HRESULT WINAPI ScriptStringCPtoX(SCRIPT_STRING_ANALYSIS ssa, int icp, BOOL fTrai
int runningX = 0;
int runningCp = 0;
StringAnalysis* analysis = ssa;
+ BOOL itemTrailing;
TRACE("(%p), %d, %d, (%p)\n", ssa, icp, fTrailing, pX);
@@ -950,15 +951,19 @@ HRESULT WINAPI ScriptStringCPtoX(SCRIPT_STRING_ANALYSIS ssa, int icp, BOOL fTrai
for(i=0; i<analysis->numItems; i++)
{
+ if (analysis->pItem[i].a.fRTL)
+ itemTrailing = !fTrailing;
+ else
+ itemTrailing = fTrailing;
for(j=0; j<analysis->glyphs[i].numGlyphs; j++)
{
- if(runningCp == icp && fTrailing == FALSE)
+ if(runningCp == icp && itemTrailing == FALSE)
{
*pX = runningX;
return S_OK;
}
runningX += analysis->glyphs[i].piAdvance[j];
- if(runningCp == icp && fTrailing == TRUE)
+ if(runningCp == icp && itemTrailing == TRUE)
{
*pX = runningX;
return S_OK;
@@ -992,8 +997,16 @@ HRESULT WINAPI ScriptStringXtoCP(SCRIPT_STRING_ANALYSIS ssa, int iX, int* piCh,
/* out of range */
if(iX < 0)
{
- *piCh = -1;
- *piTrailing = TRUE;
+ if (analysis->pItem[0].a.fRTL)
+ {
+ *piCh = 1;
+ *piTrailing = FALSE;
+ }
+ else
+ {
+ *piCh = -1;
+ *piTrailing = TRUE;
+ }
return S_OK;
}
@@ -1009,6 +1022,9 @@ HRESULT WINAPI ScriptStringXtoCP(SCRIPT_STRING_ANALYSIS ssa, int iX, int* piCh,
*piTrailing = TRUE;
else
*piTrailing = FALSE;
+
+ if (analysis->pItem[i].a.fRTL)
+ *piTrailing = !*piTrailing;
return S_OK;
}
runningX += width;
More information about the wine-cvs
mailing list