usp10: Correct where the trailing flag transitions in the middle of a glyph.

This commit is contained in:
Aric Stewart 2011-10-12 11:33:40 -05:00 committed by Alexandre Julliard
parent 8a41d75e29
commit c1607a04b9
2 changed files with 31 additions and 1 deletions

View File

@ -1910,6 +1910,21 @@ static void test_ScriptXtoX(void)
else /* win2k3 */
ok(piCP == 10, "Negative iX should return piCP=10 not %d\n", piCP);
for (iX = 0; iX <= 7; iX++)
{
WORD clust = 0;
INT advance = 16;
hr = ScriptXtoCP(iX, 1, 1, &clust, psva, &advance, &sa, &piCP, &piTrailing);
ok(piCP==0 && piTrailing==0,"%i should return 0(%i) and 0(%i)\n",iX, piCP,piTrailing);
}
for (iX = 8; iX < 16; iX++)
{
WORD clust = 0;
INT advance = 16;
hr = ScriptXtoCP(iX, 1, 1, &clust, psva, &advance, &sa, &piCP, &piTrailing);
ok(piCP==0 && piTrailing==1,"%i should return 0(%i) and 1(%i)\n",iX, piCP,piTrailing);
}
sa.fRTL = TRUE;
hr = ScriptXtoCP(-1, 10, 10, pwLogClust_RTL, psva, piAdvance, &sa, &piCP, &piTrailing);
ok(hr == S_OK, "ScriptXtoCP should return S_OK not %08x\n", hr);
@ -1924,6 +1939,21 @@ static void test_ScriptXtoX(void)
ok(piCP == -1, "iX=%d should return piCP=-1 not %d\n", iX, piCP);
ok(piTrailing == 1, "iX=%d should return piTrailing=1 not %d\n", iX, piTrailing);
for (iX = 1; iX <= 8; iX++)
{
WORD clust = 0;
INT advance = 16;
hr = ScriptXtoCP(iX, 1, 1, &clust, psva, &advance, &sa, &piCP, &piTrailing);
ok(piCP==0 && piTrailing==1,"%i should return 0(%i) and 1(%i)\n",iX,piCP,piTrailing);
}
for (iX = 9; iX < 16; iX++)
{
WORD clust = 0;
INT advance = 16;
hr = ScriptXtoCP(iX, 1, 1, &clust, psva, &advance, &sa, &piCP, &piTrailing);
ok(piCP==0 && piTrailing==0,"%i should return 0(%i) and 0(%i)\n",iX,piCP,piTrailing);
}
sa.fRTL = FALSE;
test_item_ScriptXtoX(&sa, 10, 10, offsets, pwLogClust, piAdvance);
sa.fRTL = TRUE;

View File

@ -1806,7 +1806,7 @@ HRESULT WINAPI ScriptXtoCP(int iX,
{
if (iPosX > iX)
item--;
if (item < cChars && ((iPosX - iLastPosX) / 2.0) + iX > iPosX)
if (item < cChars && ((iPosX - iLastPosX) / 2.0) + iX >= iPosX)
*piTrailing = 1;
else
*piTrailing = 0;