Aric Stewart : usp10: Updates to ScriptGetFontScriptTags.
Alexandre Julliard
julliard at winehq.org
Fri Dec 30 10:27:02 CST 2011
Module: wine
Branch: master
Commit: 1fc015636e452380b3e99c48f5b9d68b131bb06c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1fc015636e452380b3e99c48f5b9d68b131bb06c
Author: Aric Stewart <aric at codeweavers.com>
Date: Thu Dec 29 14:50:08 2011 -0600
usp10: Updates to ScriptGetFontScriptTags.
---
dlls/usp10/shape.c | 21 ++++++++++++---------
dlls/usp10/tests/usp10.c | 14 ++++++++++++++
2 files changed, 26 insertions(+), 9 deletions(-)
diff --git a/dlls/usp10/shape.c b/dlls/usp10/shape.c
index 91f706b..0574591 100644
--- a/dlls/usp10/shape.c
+++ b/dlls/usp10/shape.c
@@ -3788,12 +3788,19 @@ static HRESULT GSUB_GetFontScriptTags(LPCVOID table, OPENTYPE_TAG searchingFor,
script = (const GSUB_ScriptList*)((const BYTE*)header + GET_BE_WORD(header->ScriptList));
- *pcTags = 0;
- TRACE("%i scripts in this font\n",GET_BE_WORD(script->ScriptCount));
- if (!searchingFor && cMaxTags < GET_BE_WORD(script->ScriptCount))
+ *pcTags = GET_BE_WORD(script->ScriptCount);
+ TRACE("%i scripts in this font\n",*pcTags);
+
+ if (!searchingFor && cMaxTags < *pcTags)
rc = E_OUTOFMEMORY;
- for (i = 0; i < GET_BE_WORD(script->ScriptCount); i++)
+ else if (searchingFor)
+ rc = USP_E_SCRIPT_NOT_IN_FONT;
+
+ for (i = 0; i < *pcTags; i++)
{
+ if (i < cMaxTags)
+ pScriptTags[i] = MS_MAKE_TAG(script->ScriptRecord[i].ScriptTag[0], script->ScriptRecord[i].ScriptTag[1], script->ScriptRecord[i].ScriptTag[2], script->ScriptRecord[i].ScriptTag[3]);
+
if (searchingFor)
{
if (strncmp(script->ScriptRecord[i].ScriptTag, (char*)&searchingFor,4)==0)
@@ -3805,14 +3812,10 @@ static HRESULT GSUB_GetFontScriptTags(LPCVOID table, OPENTYPE_TAG searchingFor,
int offset = GET_BE_WORD(script->ScriptRecord[i].Script);
*script_table = ((const BYTE*)script + offset);
}
+ rc = S_OK;
break;
}
}
- else if (i < cMaxTags)
- {
- pScriptTags[i] = MS_MAKE_TAG(script->ScriptRecord[i].ScriptTag[0], script->ScriptRecord[i].ScriptTag[1], script->ScriptRecord[i].ScriptTag[2], script->ScriptRecord[i].ScriptTag[3]);
- *pcTags = *pcTags + 1;
- }
}
return rc;
}
diff --git a/dlls/usp10/tests/usp10.c b/dlls/usp10/tests/usp10.c
index cdd1510..aa03ffe 100644
--- a/dlls/usp10/tests/usp10.c
+++ b/dlls/usp10/tests/usp10.c
@@ -2880,6 +2880,11 @@ static void test_ScriptGetFontFunctions(HDC hdc)
SCRIPT_CACHE sc = NULL;
OPENTYPE_TAG tags[5];
int count = 0;
+ int outnItems=0;
+ SCRIPT_ITEM outpItems[15];
+ SCRIPT_CONTROL Control;
+ SCRIPT_STATE State;
+ static const WCHAR test_phagspa[] = {0xa84f, 0xa861, 0xa843, 0x0020, 0xa863, 0xa861, 0xa859, 0x0020, 0xa850, 0xa85c, 0xa85e};
hr = pScriptGetFontScriptTags(hdc, &sc, NULL, 0, NULL, NULL);
ok(hr == E_INVALIDARG,"Incorrect return code\n");
@@ -2903,6 +2908,15 @@ static void test_ScriptGetFontFunctions(HDC hdc)
else if (hr == E_OUTOFMEMORY)
ok(count == 0, "Count should be 0 with E_OUTOFMEMORY return\n");
ok(sc != NULL, "ScriptCache should be initialized\n");
+
+ memset(&Control, 0, sizeof(Control));
+ memset(&State, 0, sizeof(State));
+
+ hr = ScriptItemize(test_phagspa, 10, 15, &Control, &State, outpItems, &outnItems);
+ ok(hr == S_OK, "ScriptItemize failed: 0x%08x\n", hr);
+ memset(tags,0,sizeof(tags));
+ hr = pScriptGetFontScriptTags(hdc, &sc, &outpItems[0].a, 5, tags, &count);
+ ok( hr == USP_E_SCRIPT_NOT_IN_FONT || broken(hr == S_OK), "wrong return code\n");
ScriptFreeCache(&sc);
}
}
More information about the wine-cvs
mailing list