2

Is there anything like the opposite of fc-list, which will list font files which were explicitly blacklisted/rejected by fontconfig?

0

No, and I don't think there will be unless something re-implements the entire parsing logic of fontconfig. When you blacklist a font, applications (including fc-list) simply don't see them.

If you check the source, there is no logging, no (extra) debugging and no hooks.

That said, it's a simple patch to fontconfig to log the matching and rejection:

--- src/fccfg.c.orig    2018-10-04 18:55:53.000000000 +0100
+++ src/fccfg.c 2018-10-04 19:15:46.000000000 +0100
@@ -2349,9 +2349,16 @@
 {
     int i;

-    for (i = 0; i < patterns->nfont; i++)
-   if (FcListPatternMatchAny (patterns->fonts[i], font))
-       return FcTrue;
+    printf("!check for <%s>:\n",
+        FcPatternFormat((FcPattern *)font,(FcChar8 *)"%{file}"));
+    for (i = 0; i < patterns->nfont; i++) {
+        FcPatternPrint(patterns->fonts[i]);
+       if (FcListPatternMatchAny (patterns->fonts[i], font)) {
+            printf("!pattern match %i of %i\n",i,patterns->nfont);
+           return FcTrue;
+        }
+    }
+    if (patterns->nfont) printf("!pattern does not match\n");
     return FcFalse;
 }

@@ -2359,10 +2366,19 @@
 FcConfigAcceptFont (FcConfig           *config,
                const FcPattern *font)
 {
-    if (FcConfigPatternsMatch (config->acceptPatterns, font))
-   return FcTrue;
-    if (FcConfigPatternsMatch (config->rejectPatterns, font))
-   return FcFalse;
+    if (FcConfigPatternsMatch (config->acceptPatterns, font)) {
+        printf("!accepting file by pattern: ");
+        printf("%s\n",FcPatternFormat((FcPattern *)font,(FcChar8 *)"%{file}"));
+       return FcTrue;
+    }
+    if (FcConfigPatternsMatch (config->rejectPatterns, font)) {
+        printf("!rejecting file by pattern: ");
+        printf("%s\n",FcPatternFormat((FcPattern *)font,(FcChar8 *)"%{file}"));
+       return FcFalse;
+    }
+    printf("!default accept: %s\n",
+        FcPatternFormat((FcPattern *)font,(FcChar8 *)"%{file}"));
+    
     return FcTrue;
 }

The above applies cleanly to fontconfig-2.11.95, which is the most recent source I had lying around. FC_DEBUG prints to stderr, the above prints to stdout to avoid interleaving output issues (FcPatternPrint() prints to stdout).

That code resides in libfontconfig.so, you can test the results with something like:

LD_PRELOAD=src/.libs/libfontconfig.so.1.9.1 fc-list 

and assuming you have anything interesting in your config you should see the results.

2

fontconfig has debugging traces which can be enabled with an environment variable. This is probably lower-level than you would like (no nice reports), but the information is there.

The feature is described in Debugging Applications, in the user manual:

To help diagnose font and applications problems, fontconfig is built with a large amount of internal debugging left enabled. It is controlled by means of the FC_DEBUG environment variable. The value of this variable is interpreted as a number, and each bit within that value controls different debugging messages.

Further reading:

  • That didn't help, but it's something I'll keep in mind for future font issues. – Matthew Cline Sep 18 '16 at 19:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.