usp10: Better handle 0 cases when caching scripts, languages and features.

This commit is contained in:
Aric Stewart 2012-02-27 12:51:57 -06:00 committed by Alexandre Julliard
parent e4a855d2f3
commit 9af6b11808
1 changed files with 37 additions and 28 deletions

View File

@ -871,6 +871,8 @@ static void GSUB_initialize_script_cache(ScriptCache *psc)
script = (const GSUB_ScriptList*)((const BYTE*)header + GET_BE_WORD(header->ScriptList));
psc->script_count = GET_BE_WORD(script->ScriptCount);
TRACE("initializing %i scripts in this font\n",psc->script_count);
if (psc->script_count)
{
psc->scripts = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(LoadedScript) * psc->script_count);
for (i = 0; i < psc->script_count; i++)
{
@ -880,6 +882,7 @@ static void GSUB_initialize_script_cache(ScriptCache *psc)
}
}
}
}
HRESULT OpenType_GSUB_GetFontScriptTags(ScriptCache *psc, OPENTYPE_TAG searchingFor, int cMaxTags, OPENTYPE_TAG *pScriptTags, int *pcTags, LPCVOID* script_table)
{
@ -926,6 +929,8 @@ static void GSUB_initialize_language_cache(LoadedScript *script)
script->default_language.tag = MS_MAKE_TAG('d','f','l','t');
script->default_language.table = (const BYTE*)table + GET_BE_WORD(table->DefaultLangSys);
if (script->language_count)
{
TRACE("Deflang %p, LangCount %i\n",script->default_language.table, script->language_count);
script->languages = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LoadedLanguage) * script->language_count);
@ -938,6 +943,7 @@ static void GSUB_initialize_language_cache(LoadedScript *script)
}
}
}
}
HRESULT OpenType_GSUB_GetFontLanguageTags(ScriptCache *psc, OPENTYPE_TAG script_tag, OPENTYPE_TAG searchingFor, int cMaxTags, OPENTYPE_TAG *pLanguageTags, int *pcTags, LPCVOID* language_table)
{
@ -1019,6 +1025,8 @@ static void GSUB_initialize_feature_cache(LPCVOID table, LoadedLanguage *languag
language->feature_count = GET_BE_WORD(lang->FeatureCount);
TRACE("%i features\n",language->feature_count);
if (language->feature_count)
{
language->features = HeapAlloc(GetProcessHeap(),0,sizeof(LoadedFeature)*language->feature_count);
feature_list = (const GSUB_FeatureList*)((const BYTE*)header + GET_BE_WORD(header->FeatureList));
@ -1039,6 +1047,7 @@ static void GSUB_initialize_feature_cache(LPCVOID table, LoadedLanguage *languag
}
}
}
}
HRESULT OpenType_GSUB_GetFontFeatureTags(ScriptCache *psc, OPENTYPE_TAG script_tag, OPENTYPE_TAG language_tag, BOOL filtered, OPENTYPE_TAG searchingFor, int cMaxTags, OPENTYPE_TAG *pFeatureTags, int *pcTags, LoadedFeature** feature)
{