mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 11:43:31 +00:00
usp10: Better handle 0 cases when caching scripts, languages and features.
This commit is contained in:
parent
e4a855d2f3
commit
9af6b11808
1 changed files with 37 additions and 28 deletions
|
@ -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++)
|
||||
{
|
||||
|
@ -879,6 +881,7 @@ static void GSUB_initialize_script_cache(ScriptCache *psc)
|
|||
psc->scripts[i].table = ((const BYTE*)script + offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
@ -937,6 +942,7 @@ static void GSUB_initialize_language_cache(LoadedScript *script)
|
|||
script->languages[i].table = ((const BYTE*)table + offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
|
@ -1038,6 +1046,7 @@ static void GSUB_initialize_feature_cache(LPCVOID table, LoadedLanguage *languag
|
|||
language->features[i].lookups[j] = GET_BE_WORD(feature->LookupListIndex[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue