]> git.wh0rd.org - fontconfig.git/commitdiff
Add binding property to edit element
authorKeith Packard <keithp@keithp.com>
Wed, 31 Jul 2002 01:36:37 +0000 (01:36 +0000)
committerKeith Packard <keithp@keithp.com>
Wed, 31 Jul 2002 01:36:37 +0000 (01:36 +0000)
fonts.conf.in
fonts.dtd
src/fccfg.c
src/fcint.h
src/fcxml.c

index aa90605521b1eeab514c326a4dd904bb115b6233..7b67238415c1579c0a45f767c6594bbbebc55e38 100644 (file)
@@ -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'
 -->
index 6d387f9e3c0ce9c27ab2eec457d4214eabb1267e..a6aedbbba9852997943a0c10b507d2e8691695e8 100644 (file)
--- a/fonts.dtd
+++ b/fonts.dtd
 <!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
index 4d5151973f95fbed984d64473775536b0729dddc..478f5a6f7e78072936d792a18181714144bf688f 100644 (file)
@@ -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
             */
index 4e67599016dba23497ff01d6d398232ce0b61f20..d80e31243c7dc5325e380b373d0823561aaf317e 100644 (file)
@@ -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);
index f45d40fb2064c193af12c9b0f8e792c60657f6c9..5fea07cf3c906b5923e40e72c2ca112e989fe1a2 100644 (file)
@@ -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");