]> git.wh0rd.org Git - fontconfig.git/commitdiff
Print out full pathname in fc-match -v as well. Reported by Frederic
authorPatrick Lam <plam@MIT.EDU>
Sat, 7 Jan 2006 06:36:24 +0000 (06:36 +0000)
committerPatrick Lam <plam@MIT.EDU>
Sat, 7 Jan 2006 06:36:24 +0000 (06:36 +0000)
    Crozat.
Fix bug where fc-match crashes when given __DUMMY__ property to match on.
(I added the __DUMMY__ string to enable callers of FcObjectToPtrLookup to
    distinguish an error return from a successful return. -PL)
reviewed by: plam

ChangeLog
src/fcdbg.c
src/fcname.c

index 645cb83b529b7f06584ea67eca5726954a053f59..7fcda1cdbb6399ecad884b5aa36ea38a87760e2d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2006-01-06  Patrick Lam  <plam@mit.edu>
+       * src/fcdbg.c (FcPatternPrint):
+
+       Print out full pathname in fc-match -v as well.  Reported by
+       Frederic Crozat.
+       
+2006-01-06  Mike Fabian  <mfabian@suse.de>
+       reviewed by: plam
+       
+       * src/fcname.c (FcNameParse):
+
+       Fix bug where fc-match crashes when given __DUMMY__ property to
+       match on.
+
+       (I added the __DUMMY__ string to enable callers of
+       FcObjectToPtrLookup to distinguish an error return from a
+       successful return. -PL)
+
 2006-01-05  Patrick Lam  <plam@mit.edu>
        * AUTHORS:
 
index 607ddc1e46fc916759df50b4fc4801a367ed576b..e5481890fa7245a4abdcafcd8c0755fc7d419d3e 100644 (file)
@@ -111,7 +111,26 @@ FcPatternPrint (const FcPattern *p)
     {
        e = FcPatternEltU(p->elts) + i;
        printf ("\t%s:", FcObjectPtrU(e->object));
-       FcValueListPrint (e->values);
+       /* so that fc-match properly displays file: foo... */
+       if (e->object == FcObjectToPtr(FC_FILE))
+       {
+           FcChar8 * s;
+           FcPatternGetString (p, FC_FILE, 0, &s);
+           printf (" \"%s\"", s);
+           switch (FcValueListPtrU(e->values)->binding) {
+           case FcValueBindingWeak:
+               printf ("(w)");
+               break;
+           case FcValueBindingStrong:
+               printf ("(s)");
+               break;
+           case FcValueBindingSame:
+               printf ("(=)");
+               break;
+           }
+       }
+       else
+           FcValueListPrint (e->values);
        printf ("\n");
     }
     printf ("\n");
index d7100359f7e29bcccae4c3b8445218ef4e8a719f..3c902cde625e3fd685eb352ad08e39efd6091d74 100644 (file)
 #include "fcint.h"
 
 /* Please do not revoke any of these bindings. */
+/* The __DUMMY__ object enables callers to distinguish the error return
+ * of FcObjectToPtrLookup from FC_FAMILY's FcObjectPtr, which would
+ * otherwise be 0. */
 static const FcObjectType _FcBaseObjectTypes[] = {
-    { "__DUMMY__",      FcTypeVoid, },
+    { "__DUMMY__",      FcTypeVoid, }, 
     { FC_FAMILY,       FcTypeString, },
     { FC_FAMILYLANG,   FcTypeString, },
     { FC_STYLE,                FcTypeString, },
@@ -207,8 +210,8 @@ FcObjectToPtrLookup (const char * object)
        }
     }
 
-    /* We didn't match.  Look for the correct FcObjectTypeList
-     * to replace it in-place. */
+    /* We didn't match.  Look for the application's FcObjectTypeList
+     * and replace it in-place. */
     for (l = _FcObjectTypes; l; l = l->next)
     {
        if (l->types == _FcUserObjectNames)
@@ -703,7 +706,7 @@ FcNameParse (const FcChar8 *name)
                for (;;)
                {
                    name = FcNameFindNext (name, ":,", save, &delim);
-                   if (t)
+                   if (t && strcmp (t->object, _FcBaseObjectTypes[0].object))
                    {
                        v = FcNameConvert (t->type, save, &m);
                        if (!FcPatternAdd (pat, t->object, v, FcTrue))