Jeff Latimer : usp10: Add ScriptItemize functionality.
Alexandre Julliard
julliard at wine.codeweavers.com
Sat Feb 18 09:23:03 CST 2006
Module: wine
Branch: refs/heads/master
Commit: e4a154cfb9966dc38b5ac72106e84d8310a8c273
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=e4a154cfb9966dc38b5ac72106e84d8310a8c273
Author: Jeff Latimer <lats at yless4u.com.au>
Date: Sat Feb 18 16:00:29 2006 +0100
usp10: Add ScriptItemize functionality.
---
dlls/usp10/tests/usp10.c | 10 ++++----
dlls/usp10/usp10.c | 60 +++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 64 insertions(+), 6 deletions(-)
diff --git a/dlls/usp10/tests/usp10.c b/dlls/usp10/tests/usp10.c
index 83c297a..0b55991 100644
--- a/dlls/usp10/tests/usp10.c
+++ b/dlls/usp10/tests/usp10.c
@@ -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);
diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c
index dd26867..76d0db0 100644
--- a/dlls/usp10/usp10.c
+++ b/dlls/usp10/usp10.c
@@ -156,13 +156,71 @@ HRESULT WINAPI ScriptItemize(const WCHAR
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;
}
More information about the wine-cvs
mailing list