Bug 22862 - <alias> ignores <match> <test>s

Allow to use the test elements in the alias element.
This commit is contained in:
Akira TAGOH 2012-04-04 14:47:57 +09:00
parent e181ab4de5
commit ddefa5021f
2 changed files with 22 additions and 7 deletions

View File

@ -113,7 +113,7 @@
<!ATTLIST patelt <!ATTLIST patelt
name CDATA #REQUIRED> name CDATA #REQUIRED>
<!ELEMENT alias (family*, prefer?, accept?, default?)> <!ELEMENT alias (test?, family*, prefer?, accept?, default?)>
<!ATTLIST alias <!ATTLIST alias
binding (weak|strong|same) "weak"> binding (weak|strong|same) "weak">
<!ELEMENT prefer (family)*> <!ELEMENT prefer (family)*>

View File

@ -1583,7 +1583,7 @@ FcParseAlias (FcConfigParse *parse)
FcExpr *family = 0, *accept = 0, *prefer = 0, *def = 0, *new = 0; FcExpr *family = 0, *accept = 0, *prefer = 0, *def = 0, *new = 0;
FcEdit *edit = 0, *next; FcEdit *edit = 0, *next;
FcVStack *vstack; FcVStack *vstack;
FcTest *test; FcTest *test = NULL;
FcValueBinding binding; FcValueBinding binding;
if (!FcConfigLexBinding (parse, FcConfigGetAttribute (parse, "binding"), &binding)) if (!FcConfigLexBinding (parse, FcConfigGetAttribute (parse, "binding"), &binding))
@ -1626,6 +1626,11 @@ FcParseAlias (FcConfigParse *parse)
def = vstack->u.expr; def = vstack->u.expr;
vstack->tag = FcVStackNone; vstack->tag = FcVStackNone;
break; break;
case FcVStackTest:
vstack->u.test->next = test;
test = vstack->u.test;
vstack->tag = FcVStackNone;
break;
default: default:
FcConfigMessage (parse, FcSevereWarning, "bad alias"); FcConfigMessage (parse, FcSevereWarning, "bad alias");
break; break;
@ -1683,11 +1688,21 @@ FcParseAlias (FcConfigParse *parse)
} }
if (edit) if (edit)
{ {
test = FcTestCreate (parse, FcMatchPattern, FcTest *t = FcTestCreate (parse, FcMatchPattern,
FcQualAny, FcQualAny,
(FcChar8 *) FC_FAMILY, (FcChar8 *) FC_FAMILY,
FcOpEqual, FcOpEqual,
family); family);
if (test)
{
FcTest *p = test;
while (p->next)
p = p->next;
p->next = t;
}
else
test = t;
if (test) if (test)
if (!FcConfigAddEdit (parse->config, test, edit, FcMatchPattern)) if (!FcConfigAddEdit (parse->config, test, edit, FcMatchPattern))
FcTestDestroy (test); FcTestDestroy (test);