usp10: Have load_GSUB_feature return LoadedFeature*.

This commit is contained in:
Aric Stewart 2012-01-03 06:51:30 -06:00 committed by Alexandre Julliard
parent f04b6b2fc8
commit c632f71e08
1 changed files with 19 additions and 25 deletions

View File

@ -1159,7 +1159,7 @@ static OPENTYPE_TAG get_opentype_script(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCac
} }
} }
static LPCVOID load_GSUB_feature(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache *psc, const char* feat) static LoadedFeature* load_GSUB_feature(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache *psc, const char* feat)
{ {
LoadedFeature *feature = NULL; LoadedFeature *feature = NULL;
@ -1189,28 +1189,20 @@ static LPCVOID load_GSUB_feature(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache *psc
GSUB_GetFontFeatureTags(psc, MS_MAKE_TAG('l','a','t','n'), MS_MAKE_TAG('d','f','l','t'), FALSE, MS_MAKE_TAG(feat[0],feat[1],feat[2],feat[3]), 1, &tags, &cTags, &feature); GSUB_GetFontFeatureTags(psc, MS_MAKE_TAG('l','a','t','n'), MS_MAKE_TAG('d','f','l','t'), FALSE, MS_MAKE_TAG(feat[0],feat[1],feat[2],feat[3]), 1, &tags, &cTags, &feature);
} }
if (feature) TRACE("Feature %s located at %p\n",debugstr_an(feat,4),feature);
{ return feature;
TRACE("Feature %s located at %p\n",debugstr_an(feat,4),feature->feature);
return feature->feature;
}
else
{
TRACE("Feature %s not located\n",debugstr_an(feat,4));
return NULL;
}
} }
static INT apply_GSUB_feature_to_glyph(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, WORD *glyphs, INT index, INT write_dir, INT* glyph_count, const char* feat) static INT apply_GSUB_feature_to_glyph(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, WORD *glyphs, INT index, INT write_dir, INT* glyph_count, const char* feat)
{ {
const GSUB_Feature *feature; LoadedFeature *feature;
feature = load_GSUB_feature(hdc, psa, psc, feat); feature = load_GSUB_feature(hdc, psa, psc, feat);
if (!feature) if (!feature)
return GSUB_E_NOFEATURE; return GSUB_E_NOFEATURE;
TRACE("applying feature %s\n",feat); TRACE("applying feature %s\n",feat);
return GSUB_apply_feature_all_lookups(psc->GSUB_Table, feature, glyphs, index, write_dir, glyph_count); return GSUB_apply_feature_all_lookups(psc->GSUB_Table, feature->feature, glyphs, index, write_dir, glyph_count);
} }
static VOID *load_gsub_table(HDC hdc) static VOID *load_gsub_table(HDC hdc)
@ -1477,14 +1469,16 @@ static int apply_GSUB_feature(HDC hdc, SCRIPT_ANALYSIS *psa, ScriptCache* psc, W
{ {
if (psc->GSUB_Table) if (psc->GSUB_Table)
{ {
LoadedFeature *load_feature;
const GSUB_Feature *feature; const GSUB_Feature *feature;
const GSUB_LookupList *lookup; const GSUB_LookupList *lookup;
const GSUB_Header *header = psc->GSUB_Table; const GSUB_Header *header = psc->GSUB_Table;
int lookup_index, lookup_count; int lookup_index, lookup_count;
feature = load_GSUB_feature(hdc, psa, psc, feat); load_feature = load_GSUB_feature(hdc, psa, psc, feat);
if (!feature) if (!load_feature)
return GSUB_E_NOFEATURE; return GSUB_E_NOFEATURE;
feature = load_feature->feature;
TRACE("applying feature %s\n",debugstr_an(feat,4)); TRACE("applying feature %s\n",debugstr_an(feat,4));
lookup = (const GSUB_LookupList*)((const BYTE*)header + GET_BE_WORD(header->LookupList)); lookup = (const GSUB_LookupList*)((const BYTE*)header + GET_BE_WORD(header->LookupList));
@ -2195,7 +2189,7 @@ static inline void shift_syllable_glyph_indexs(IndicSyllable *glyph_index, INT i
glyph_index->pref+= shift; glyph_index->pref+= shift;
} }
static void Apply_Indic_BasicForm(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwChars, INT cChars, IndicSyllable *syllable, WORD *pwOutGlyphs, INT* pcGlyphs, WORD *pwLogClust, lexical_function lexical, IndicSyllable *glyph_index, const GSUB_Feature *feature ) static void Apply_Indic_BasicForm(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR* pwChars, INT cChars, IndicSyllable *syllable, WORD *pwOutGlyphs, INT* pcGlyphs, WORD *pwLogClust, lexical_function lexical, IndicSyllable *glyph_index, LoadedFeature *feature )
{ {
int index = glyph_index->start; int index = glyph_index->start;
@ -2206,7 +2200,7 @@ static void Apply_Indic_BasicForm(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *ps
{ {
INT nextIndex; INT nextIndex;
INT prevCount = *pcGlyphs; INT prevCount = *pcGlyphs;
nextIndex = GSUB_apply_feature_all_lookups(psc->GSUB_Table, feature, pwOutGlyphs, index, 1, pcGlyphs); nextIndex = GSUB_apply_feature_all_lookups(psc->GSUB_Table, feature->feature, pwOutGlyphs, index, 1, pcGlyphs);
if (nextIndex > GSUB_E_NOGLYPH) if (nextIndex > GSUB_E_NOGLYPH)
{ {
UpdateClusters(nextIndex, *pcGlyphs - prevCount, 1, cChars, pwLogClust); UpdateClusters(nextIndex, *pcGlyphs - prevCount, 1, cChars, pwLogClust);
@ -2332,13 +2326,13 @@ static void ShapeIndicSyllables(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa,
{ {
int c; int c;
int overall_shift = 0; int overall_shift = 0;
const GSUB_Feature *locl = (modern)?load_GSUB_feature(hdc, psa, psc, "locl"):NULL; LoadedFeature *locl = (modern)?load_GSUB_feature(hdc, psa, psc, "locl"):NULL;
const GSUB_Feature *nukt = load_GSUB_feature(hdc, psa, psc, "nukt"); LoadedFeature *nukt = load_GSUB_feature(hdc, psa, psc, "nukt");
const GSUB_Feature *akhn = load_GSUB_feature(hdc, psa, psc, "akhn"); LoadedFeature *akhn = load_GSUB_feature(hdc, psa, psc, "akhn");
const GSUB_Feature *rkrf = (modern)?load_GSUB_feature(hdc, psa, psc, "rkrf"):NULL; LoadedFeature *rkrf = (modern)?load_GSUB_feature(hdc, psa, psc, "rkrf"):NULL;
const GSUB_Feature *pstf = load_GSUB_feature(hdc, psa, psc, "pstf"); LoadedFeature *pstf = load_GSUB_feature(hdc, psa, psc, "pstf");
const GSUB_Feature *vatu = (!rkrf)?load_GSUB_feature(hdc, psa, psc, "vatu"):NULL; LoadedFeature *vatu = (!rkrf)?load_GSUB_feature(hdc, psa, psc, "vatu"):NULL;
const GSUB_Feature *cjct = (modern)?load_GSUB_feature(hdc, psa, psc, "cjct"):NULL; LoadedFeature *cjct = (modern)?load_GSUB_feature(hdc, psa, psc, "cjct"):NULL;
BOOL rphf = (load_GSUB_feature(hdc, psa, psc, "rphf") != NULL); BOOL rphf = (load_GSUB_feature(hdc, psa, psc, "rphf") != NULL);
BOOL pref = (load_GSUB_feature(hdc, psa, psc, "pref") != NULL); BOOL pref = (load_GSUB_feature(hdc, psa, psc, "pref") != NULL);
BOOL blwf = (load_GSUB_feature(hdc, psa, psc, "blwf") != NULL); BOOL blwf = (load_GSUB_feature(hdc, psa, psc, "blwf") != NULL);
@ -3592,7 +3586,7 @@ rpRangeProperties = &ShapingData[psa->eScript].defaultTextRange;
HRESULT SHAPE_CheckFontForRequiredFeatures(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa) HRESULT SHAPE_CheckFontForRequiredFeatures(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa)
{ {
const GSUB_Feature *feature; LoadedFeature *feature;
int i; int i;
if (!ShapingData[psa->eScript].requiredFeatures) if (!ShapingData[psa->eScript].requiredFeatures)