Add the default language to the pattern prior to do build the substitution

the default language is referred from the FC_LANG environment variable
or the current locale
This commit is contained in:
Akira TAGOH 2012-05-22 14:17:10 +09:00
parent 2261a64ce1
commit 550fd49d4f
1 changed files with 18 additions and 0 deletions

View File

@ -1407,6 +1407,7 @@ FcConfigSubstituteWithPat (FcConfig *config,
FcEdit *e; FcEdit *e;
FcValueList *l; FcValueList *l;
FcPattern *m; FcPattern *m;
FcStrSet *strs;
if (!config) if (!config)
{ {
@ -1434,6 +1435,23 @@ FcConfigSubstituteWithPat (FcConfig *config,
return FcFalse; return FcFalse;
FcMemAlloc (FC_MEM_SUBSTATE, config->maxObjects * sizeof (FcSubState)); FcMemAlloc (FC_MEM_SUBSTATE, config->maxObjects * sizeof (FcSubState));
strs = FcGetDefaultLangs ();
if (strs)
{
FcStrList *l = FcStrListCreate (strs);
FcChar8 *lang;
FcValue v;
FcStrSetDestroy (strs);
while (l && (lang = FcStrListNext (l)))
{
v.type = FcTypeString;
v.u.s = lang;
FcPatternObjectAddWithBinding (p, FC_LANG_OBJECT, v, FcValueBindingWeak, FcTrue);
}
FcStrListDone (l);
}
if (FcDebug () & FC_DBG_EDIT) if (FcDebug () & FC_DBG_EDIT)
{ {
printf ("FcConfigSubstitute "); printf ("FcConfigSubstitute ");