]> git.wh0rd.org Git - fontconfig.git/commitdiff
Bug 26718 - "fc-match sans file" doesn't work
authorBehdad Esfahbod <behdad@behdad.org>
Mon, 20 Jun 2011 15:22:17 +0000 (11:22 -0400)
committerBehdad Esfahbod <behdad@behdad.org>
Mon, 20 Jun 2011 15:22:17 +0000 (11:22 -0400)
- Do not throw away FC_FILE in FcNameUnparse
- Update the builtin "fclist" format to remove FC_FILE properly instead
- Switch fc-list to use FcPatternFormat()

Note that I had previously broken fc-list and it was not showing the
file name anymore.  No one noticed that it seems!  Now fixed.

fc-list/fc-list.c
src/fcformat.c
src/fcname.c

index 12c2ca55029ed49b60ac939dc77c5e4f694a9871..ad383328e2d1f3a1d5cd8fcd9b98054b08f1d784 100644 (file)
@@ -156,7 +156,9 @@ main (int argc, char **argv)
     if (quiet && !os)
        os = FcObjectSetCreate ();
     if (!verbose && !format && !os)
-       os = FcObjectSetBuild (FC_FAMILY, FC_STYLE, (char *) 0);
+       os = FcObjectSetBuild (FC_FAMILY, FC_STYLE, FC_FILE, (char *) 0);
+    if (!format)
+        format = "%{=fclist}\n";
     fs = FcFontList (0, pat, os);
     if (os)
        FcObjectSetDestroy (os);
@@ -173,7 +175,7 @@ main (int argc, char **argv)
            {
                FcPatternPrint (fs->fonts[j]);
            }
-           else if (format)
+           else
            {
                FcChar8 *s;
 
@@ -184,17 +186,6 @@ main (int argc, char **argv)
                    free (s);
                }
            }
-           else
-           {
-               FcChar8 *str;
-               FcChar8 *file;
-
-               str = FcNameUnparse (fs->fonts[j]);
-               if (FcPatternGetString (fs->fonts[j], FC_FILE, 0, &file) == FcResultMatch)
-                   printf ("%s: ", file);
-               printf ("%s\n", str);
-               free (str);
-           }
        }
     }
 
index 1368b7186b1b3467bf2a183e820b3699ef422bf3..796957db9ab0f005e23a6d615c5c08678f03a1c2 100644 (file)
@@ -75,7 +75,7 @@
 
 
 #define FCMATCH_FORMAT "%{file:-<unknown filename>|basename}: \"%{family[0]:-<unknown family>}\" \"%{style[0]:-<unknown style>}\""
-#define FCLIST_FORMAT  "%{?file{%{file}: }}%{=unparse}"
+#define FCLIST_FORMAT  "%{?file{%{file}: }}%{-file{%{=unparse}}}"
 #define PKGKIT_FORMAT  "%{[]family{font(%{family|downcase|delete( )})\n}}%{[]lang{font(:lang=%{lang|downcase|translate(_,-)})\n}}"
 
 
index 86c10b65edf050f9a8218abf6135e26bfe8b3427..d77eff6f7518d2785d8c634aae13525229f0796f 100644 (file)
@@ -874,8 +874,7 @@ FcNameUnparseEscaped (FcPattern *pat, FcBool escape)
        {
            o = &l->types[i];
            if (!strcmp (o->object, FC_FAMILY) ||
-               !strcmp (o->object, FC_SIZE) ||
-               !strcmp (o->object, FC_FILE))
+               !strcmp (o->object, FC_SIZE))
                continue;
        
            e = FcPatternObjectFindElt (pat, FcObjectFromName (o->object));