usp10: Add ScriptItemize functionality.

This commit is contained in:
Jeff Latimer 2006-02-18 16:00:29 +01:00 committed by Alexandre Julliard
parent 68d41b41b7
commit e4a154cfb9
2 changed files with 64 additions and 6 deletions

View File

@ -113,7 +113,7 @@ START_TEST(usp10)
ok (hr == 0, "ScriptItemize should return 0, returned %08x\n", (unsigned int) hr);
/* This test is for the interim operation of ScriptItemize where only one SCRIPT_ITEM is *
* returned. */
todo_wine ok (pcItems > 0, "The number of SCRIPT_ITEMS should be greater than 0\n");
ok (pcItems > 0, "The number of SCRIPT_ITEMS should be greater than 0\n");
if (pcItems > 0)
ok (pItem[0].iCharPos == 0 && pItem[1].iCharPos == cInChars,
"Start pos not = 0 (%d) or end pos not = %d (%d)\n",
@ -130,7 +130,7 @@ START_TEST(usp10)
hr = ScriptShape(NULL, &psc, TestItem1, cChars,
cMaxGlyphs, &pItem[0].a,
pwOutGlyphs, pwLogClust, psva, &pcGlyphs);
todo_wine ok (hr == E_OUTOFMEMORY, "If not enoungh output area cChars (%d) is > than CMaxGlyphs (%d) but not E_OUTOFMEMORY\n",
todo_wine ok (hr == E_OUTOFMEMORY, "If not enough output area cChars (%d) is > than CMaxGlyphs (%d) but not E_OUTOFMEMORY\n",
cChars, cMaxGlyphs);
cMaxGlyphs = 256;
hr = ScriptShape(NULL, &psc, TestItem1, cChars,
@ -159,7 +159,7 @@ START_TEST(usp10)
ok (hr == 0, "ScriptItemize should return 0, returned %08x\n", (unsigned int) hr);
/* This test is for the intertrim operation of ScriptItemize where only one SCRIPT_ITEM is *
* returned. */
todo_wine ok (pItem[0].iCharPos == 0 && pItem[1].iCharPos == cInChars,
ok (pItem[0].iCharPos == 0 && pItem[1].iCharPos == cInChars,
"Start pos not = 0 (%d) or end pos not = %d (%d)\n",
pItem[0].iCharPos, cInChars, pItem[1].iCharPos);
/* It would appear that we have a valid SCRIPT_ANALYSIS and can continue */
@ -172,7 +172,7 @@ START_TEST(usp10)
pwOutGlyphs, pwLogClust, psva, &pcGlyphs);
ok (hr != E_PENDING, "If psc should not be NULL (%08x) and the E_PENDING should be returned\n",
(unsigned int) hr);
todo_wine ok (hr == 0, "Should return 0 not (%08x)\n", (unsigned int) hr);
todo_wine ok (hr == 0, "ScriptShape should return 0 not (%08x)\n", (unsigned int) hr);
todo_wine ok (psc != NULL, "psc should not be null and have SCRIPT_CACHE buffer address\n");
todo_wine ok (pcGlyphs == cChars, "Chars in (%d) should equal Glyphs out (%d)\n", cChars, pcGlyphs);
for (cnt=0; cnt < cChars && TestItem2[cnt] == pwOutGlyphs[cnt]; cnt++) {}
@ -181,7 +181,7 @@ START_TEST(usp10)
if (hr ==0) {
hr = ScriptPlace(NULL, &psc, pwOutGlyphs, pcGlyphs, psva, &pItem[0].a, piAdvance,
pGoffset, pABC);
todo_wine ok (hr == 0, "Should return 0 not (%08x)\n", (unsigned int) hr);
todo_wine ok (hr == 0, "ScriptPlace should return 0 not (%08x)\n", (unsigned int) hr);
}
}
hr = ScriptFreeCache( &psc);

View File

@ -156,13 +156,71 @@ HRESULT WINAPI ScriptItemize(const WCHAR *pwcInChars, int cInChars, int cMaxItem
const SCRIPT_CONTROL *psControl, const SCRIPT_STATE *psState,
SCRIPT_ITEM *pItems, int *pcItems)
{
/* This implementation currently treats the entire string represented in
* pwcInChars as a single entity. Hence pcItems will be set to 1. */
FIXME("%s,%d,%d,%p,%p,%p,%p\n", debugstr_w(pwcInChars), cInChars, cMaxItems,
psControl, psState, pItems, pcItems);
if (!pwcInChars || !cInChars || !pItems || cMaxItems < 2)
return E_INVALIDARG;
*pcItems = 0;
/* Set a sensible default */
/* Set SCRIPT_ITEM */
pItems[0].iCharPos = 0;
/* Set the SCRIPT_ANALYSIS */
pItems[0].a.eScript = SCRIPT_UNDEFINED;
pItems[0].a.fRTL = 0;
pItems[0].a.fLayoutRTL = 0;
pItems[0].a.fLinkBefore = 0;
pItems[0].a.fLinkAfter = 0;
pItems[0].a.fLogicalOrder = 0;
pItems[0].a.fNoGlyphIndex = 0;
/* set the SCRIPT_STATE */
pItems[0].a.s.uBidiLevel = 0;
pItems[0].a.s.fOverrideDirection = 0;
pItems[0].a.s.fInhibitSymSwap = FALSE;
pItems[0].a.s.fCharShape = 0;
pItems[0].a.s.fDigitSubstitute = 0;
pItems[0].a.s.fInhibitLigate = 0;
pItems[0].a.s.fDisplayZWG = 0;
pItems[0].a.s.fArabicNumContext = 0;
pItems[0].a.s.fGcpClusters = 0;
pItems[0].a.s.fReserved = 0;
pItems[0].a.s.fEngineReserved = 0;
/* While not strickly necessary according to the spec, make sure the n+1
* item is set up to prevent random behaviour if the caller eroneously
* checks the n+1 structure */
pItems[1].a.eScript = 0;
pItems[1].a.fRTL = 0;
pItems[1].a.fLayoutRTL = 0;
pItems[1].a.fLinkBefore = 0;
pItems[1].a.fLinkAfter = 0;
pItems[1].a.fLogicalOrder = 0;
pItems[1].a.fNoGlyphIndex = 0;
/* set the SCRIPT_STATE */
pItems[1].a.s.uBidiLevel = 0;
pItems[1].a.s.fOverrideDirection = 0;
pItems[1].a.s.fInhibitSymSwap = FALSE;
pItems[1].a.s.fCharShape = 0;
pItems[1].a.s.fDigitSubstitute = 0;
pItems[1].a.s.fInhibitLigate = 0;
pItems[1].a.s.fDisplayZWG = 0;
pItems[1].a.s.fArabicNumContext = 0;
pItems[1].a.s.fGcpClusters = 0;
pItems[1].a.s.fReserved = 0;
pItems[1].a.s.fEngineReserved = 0;
/* Set one SCRIPT_STATE item being returned */
*pcItems = 1;
/* Set SCRIPT_ITEM */
pItems[1].iCharPos = cInChars - pItems[0].iCharPos ; /* the last + 1 item
contains the ptr to the lastchar */
TRACE("%s,%d,%d,%p,%p,%p,%p,%d\n", debugstr_w(pwcInChars), cInChars, cMaxItems,
psControl, psState, pItems, pcItems, *pcItems);
TRACE("Start Pos in string: %d, Stop Pos %d\n", pItems[0].iCharPos, pItems[1].iCharPos);
return 0;
}