FcStrFree (s);
}
+static FcBool
+FcConfigLexBinding (FcConfigParse *parse,
+ const FcChar8 *binding_string,
+ FcValueBinding *binding_ret)
+{
+ FcValueBinding binding;
+
+ if (!binding_string)
+ binding = FcValueBindingWeak;
+ else
+ {
+ if (!strcmp ((char *) binding_string, "weak"))
+ binding = FcValueBindingWeak;
+ else if (!strcmp ((char *) binding_string, "strong"))
+ binding = FcValueBindingStrong;
+ else if (!strcmp ((char *) binding_string, "same"))
+ binding = FcValueBindingSame;
+ else
+ {
+ FcConfigMessage (parse, FcSevereWarning, "invalid binding \"%s\"", binding_string);
+ return FcFalse;
+ }
+ }
+ *binding_ret = binding;
+ return FcTrue;
+}
+
static void
FcParseFamilies (FcConfigParse *parse, FcVStackTag tag)
{
FcEdit *edit = 0, *next;
FcVStack *vstack;
FcTest *test;
+ FcValueBinding binding;
+ if (!FcConfigLexBinding (parse, FcConfigGetAttribute (parse, "binding"), &binding))
+ return;
while ((vstack = FcVStackPop (parse)))
{
switch (vstack->tag) {
FC_FAMILY_OBJECT,
FcOpPrepend,
prefer,
- FcValueBindingWeak);
+ binding);
if (edit)
edit->next = 0;
else
FC_FAMILY_OBJECT,
FcOpAppend,
accept,
- FcValueBindingWeak);
+ binding);
if (edit)
edit->next = next;
else
FC_FAMILY_OBJECT,
FcOpAppendLast,
def,
- FcValueBindingWeak);
+ binding);
if (edit)
edit->next = next;
else
return FcConfigLexOp (compare, fcCompareOps, NUM_COMPARE_OPS);
}
-
static void
FcParseTest (FcConfigParse *parse)
{
{
const FcChar8 *name;
const FcChar8 *mode_string;
- const FcChar8 *binding_string;
FcOp mode;
FcValueBinding binding;
FcExpr *expr;
return;
}
}
- binding_string = FcConfigGetAttribute (parse, "binding");
- if (!binding_string)
- binding = FcValueBindingWeak;
- else
- {
- if (!strcmp ((char *) binding_string, "weak"))
- binding = FcValueBindingWeak;
- else if (!strcmp ((char *) binding_string, "strong"))
- binding = FcValueBindingStrong;
- else if (!strcmp ((char *) binding_string, "same"))
- binding = FcValueBindingSame;
- else
- {
- FcConfigMessage (parse, FcSevereWarning, "invalid edit binding \"%s\"", binding_string);
- return;
- }
- }
+ if (!FcConfigLexBinding (parse, FcConfigGetAttribute (parse, "binding"), &binding))
+ return;
+
expr = FcPopBinary (parse, FcOpComma);
edit = FcEditCreate (parse, FcObjectFromName ((char *) name),
mode, expr, binding);