usp10: Updates to ScriptGetFontScriptTags.
This commit is contained in:
parent
da07748ca2
commit
1fc015636e
@ -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));
|
script = (const GSUB_ScriptList*)((const BYTE*)header + GET_BE_WORD(header->ScriptList));
|
||||||
|
|
||||||
*pcTags = 0;
|
*pcTags = GET_BE_WORD(script->ScriptCount);
|
||||||
TRACE("%i scripts in this font\n",GET_BE_WORD(script->ScriptCount));
|
TRACE("%i scripts in this font\n",*pcTags);
|
||||||
if (!searchingFor && cMaxTags < GET_BE_WORD(script->ScriptCount))
|
|
||||||
|
if (!searchingFor && cMaxTags < *pcTags)
|
||||||
rc = E_OUTOFMEMORY;
|
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 (searchingFor)
|
||||||
{
|
{
|
||||||
if (strncmp(script->ScriptRecord[i].ScriptTag, (char*)&searchingFor,4)==0)
|
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);
|
int offset = GET_BE_WORD(script->ScriptRecord[i].Script);
|
||||||
*script_table = ((const BYTE*)script + offset);
|
*script_table = ((const BYTE*)script + offset);
|
||||||
}
|
}
|
||||||
|
rc = S_OK;
|
||||||
break;
|
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;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -2880,6 +2880,11 @@ static void test_ScriptGetFontFunctions(HDC hdc)
|
|||||||
SCRIPT_CACHE sc = NULL;
|
SCRIPT_CACHE sc = NULL;
|
||||||
OPENTYPE_TAG tags[5];
|
OPENTYPE_TAG tags[5];
|
||||||
int count = 0;
|
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);
|
hr = pScriptGetFontScriptTags(hdc, &sc, NULL, 0, NULL, NULL);
|
||||||
ok(hr == E_INVALIDARG,"Incorrect return code\n");
|
ok(hr == E_INVALIDARG,"Incorrect return code\n");
|
||||||
@ -2903,6 +2908,15 @@ static void test_ScriptGetFontFunctions(HDC hdc)
|
|||||||
else if (hr == E_OUTOFMEMORY)
|
else if (hr == E_OUTOFMEMORY)
|
||||||
ok(count == 0, "Count should be 0 with E_OUTOFMEMORY return\n");
|
ok(count == 0, "Count should be 0 with E_OUTOFMEMORY return\n");
|
||||||
ok(sc != NULL, "ScriptCache should be initialized\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);
|
ScriptFreeCache(&sc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user