Commit 6fff2cda authored by Keith Packard's avatar Keith Packard

Add binding property to edit element

parent 327a7fd4
......@@ -9,12 +9,18 @@
Common X11R6 font directories
-->
<dir>/usr/X11R6/lib/X11/fonts/truetype</dir>
<dir>/usr/X11R6/lib/X11/fonts/Type1</dir>
<dir>/usr/X11R6/lib/X11/fonts/TrueType</dir>
<dir>/usr/X11R6/lib/X11/fonts</dir>
<dir>/usr/share/fonts</dir>
<!-- FONTPATH_END -->
<!--
Enable sub-pixel rendering
<match target="font">
<edit name="rgba" mode="assign"><const>rgb</const></edit>
</match>
-->
<!--
Accept deprecated 'mono' alias, replacing it with 'monospace'
-->
......
......@@ -140,7 +140,8 @@
<!ELEMENT edit (%expr;)*>
<!ATTLIST edit
name CDATA #REQUIRED
mode (assign|assign_replace|prepend|append|prepend_first|append_last) "assign">
mode (assign|assign_replace|prepend|append|prepend_first|append_last) "assign"
binding (weak|strong) "weak">
<!--
Elements of expressions follow
......
......@@ -903,7 +903,7 @@ FcConfigMatchValueList (FcPattern *p,
}
static FcValueList *
FcConfigValues (FcPattern *p, FcExpr *e)
FcConfigValues (FcPattern *p, FcExpr *e, FcValueBinding binding)
{
FcValueList *l;
......@@ -916,14 +916,14 @@ FcConfigValues (FcPattern *p, FcExpr *e)
if (e->op == FcOpComma)
{
l->value = FcConfigEvaluate (p, e->u.tree.left);
l->next = FcConfigValues (p, e->u.tree.right);
l->next = FcConfigValues (p, e->u.tree.right, binding);
}
else
{
l->value = FcConfigEvaluate (p, e);
l->next = 0;
}
l->binding = FcValueBindingWeak;
l->binding = binding;
while (l && l->value.type == FcTypeVoid)
{
FcValueList *next = l->next;
......@@ -1146,7 +1146,7 @@ FcConfigSubstitute (FcConfig *config,
/*
* Evaluate the list of expressions
*/
l = FcConfigValues (p, e->expr);
l = FcConfigValues (p, e->expr, e->binding);
/*
* Locate any test associated with this field
*/
......
......@@ -151,6 +151,7 @@ typedef struct _FcEdit {
const char *field;
FcOp op;
FcExpr *expr;
FcValueBinding binding;
} FcEdit;
typedef struct _FcSubst {
......@@ -515,7 +516,7 @@ void
FcExprDestroy (FcExpr *e);
FcEdit *
FcEditCreate (const char *field, FcOp op, FcExpr *expr);
FcEditCreate (const char *field, FcOp op, FcExpr *expr, FcValueBinding binding);
void
FcEditDestroy (FcEdit *e);
......
/*
* $XFree86: xc/lib/fontconfig/src/fcxml.c,v 1.14 2002/06/21 07:01:11 keithp Exp $
* $XFree86: xc/lib/fontconfig/src/fcxml.c,v 1.16 2002/07/12 19:19:16 keithp Exp $
*
* Copyright 2002 Keith Packard, member of The XFree86 Project, Inc.
*
......@@ -251,7 +251,7 @@ FcExprDestroy (FcExpr *e)
}
FcEdit *
FcEditCreate (const char *field, FcOp op, FcExpr *expr)
FcEditCreate (const char *field, FcOp op, FcExpr *expr, FcValueBinding binding)
{
FcEdit *e = (FcEdit *) malloc (sizeof (FcEdit));
......@@ -261,6 +261,7 @@ FcEditCreate (const char *field, FcOp op, FcExpr *expr)
e->field = field; /* already saved in grammar */
e->op = op;
e->expr = expr;
e->binding = binding;
}
return e;
}
......@@ -1170,7 +1171,8 @@ FcParseAlias (FcConfigParse *parse)
{
edit = FcEditCreate (FcConfigSaveField ("family"),
FcOpPrepend,
prefer);
prefer,
FcValueBindingWeak);
if (edit)
edit->next = 0;
else
......@@ -1181,7 +1183,8 @@ FcParseAlias (FcConfigParse *parse)
next = edit;
edit = FcEditCreate (FcConfigSaveField ("family"),
FcOpAppend,
accept);
accept,
FcValueBindingWeak);
if (edit)
edit->next = next;
else
......@@ -1191,8 +1194,9 @@ FcParseAlias (FcConfigParse *parse)
{
next = edit;
edit = FcEditCreate (FcConfigSaveField ("family"),
FcOpAppendLast,
def);
FcOpAppendLast,
def,
FcValueBindingWeak);
if (edit)
edit->next = next;
else
......@@ -1436,7 +1440,9 @@ FcParseEdit (FcConfigParse *parse)
{
const FcChar8 *name;
const FcChar8 *mode_string;
const FcChar8 *binding_string;
FcOp mode;
FcValueBinding binding;
FcExpr *expr;
FcEdit *edit;
......@@ -1458,8 +1464,23 @@ FcParseEdit (FcConfigParse *parse)
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
{
FcConfigMessage (parse, FcSevereWarning, "invalid edit binding \"%s\"", binding_string);
return;
}
}
expr = FcPopExprs (parse, FcOpComma);
edit = FcEditCreate ((char *) FcStrCopy (name), mode, expr);
edit = FcEditCreate ((char *) FcStrCopy (name), mode, expr, binding);
if (!edit)
{
FcConfigMessage (parse, FcSevereError, "out of memory");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment