diff options
author | Keith Packard <keithp@keithp.com> | 2002-07-31 01:36:37 +0000 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2002-07-31 01:36:37 +0000 |
commit | 6fff2cda0ad09dfc84df2a70e95258b9dd28160b (patch) | |
tree | a99c2d0e7f8a3143b4c181d3de55a670af6cb20d /src | |
parent | 327a7fd491f17f23e37e260f8d74397e2ef933aa (diff) |
Add binding property to edit element
Diffstat (limited to 'src')
-rw-r--r-- | src/fccfg.c | 8 | ||||
-rw-r--r-- | src/fcint.h | 3 | ||||
-rw-r--r-- | src/fcxml.c | 35 |
3 files changed, 34 insertions, 12 deletions
diff --git a/src/fccfg.c b/src/fccfg.c index 4d51519..478f5a6 100644 --- a/src/fccfg.c +++ b/src/fccfg.c @@ -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 */ diff --git a/src/fcint.h b/src/fcint.h index 4e67599..d80e312 100644 --- a/src/fcint.h +++ b/src/fcint.h @@ -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); diff --git a/src/fcxml.c b/src/fcxml.c index f45d40f..5fea07c 100644 --- a/src/fcxml.c +++ b/src/fcxml.c @@ -1,5 +1,5 @@ /* - * $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"); |