]> git.wh0rd.org - fontconfig.git/blobdiff - src/fcmatch.c
Add architecture to cache filename.
[fontconfig.git] / src / fcmatch.c
index 57e0c0e78b8d6968624a4fbf342a475a1a1f0f18..88feb8a9fd7c1571427fcf22a84f981ee284dfd0 100644 (file)
@@ -22,9 +22,9 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
+#include "fcint.h"
 #include <string.h>
 #include <ctype.h>
-#include "fcint.h"
 #include <stdio.h>
 
 static double
@@ -495,9 +495,6 @@ FcFontRenderPrepare (FcConfig           *config,
                           FcValueCanonicalize(&FcValueListPtrU(pe->values)->value), FcTrue);
     }
 
-    if (FcPatternFindElt (font, FC_FILE))
-       FcPatternTransferFullFname (new, font);
-
     FcConfigSubstituteWithPat (config, new, pat, FcMatchFont);
     return new;
 }
@@ -791,7 +788,7 @@ FcSortCompare (const void *aa, const void *ab)
 }
 
 static FcBool
-FcSortWalk (FcSortNode **n, int nnode, FcFontSet *fs, FcCharSet **cs, FcBool trim)
+FcSortWalk (FcSortNode **n, int nnode, FcFontSet *fs, FcCharSet **cs, FcBool trim, FcBool build_cs)
 {
     FcCharSet  *ncs;
     FcSortNode *node;
@@ -808,16 +805,20 @@ FcSortWalk (FcSortNode **n, int nnode, FcFontSet *fs, FcCharSet **cs, FcBool tri
             */
            if (!trim || !*cs || !FcCharSetIsSubset (ncs, *cs))
            {
-               if (*cs)
-               {
-                   ncs = FcCharSetUnion (ncs, *cs);
-                   if (!ncs)
-                       return FcFalse;
-                   FcCharSetDestroy (*cs);
-               }
-               else
-                   ncs = FcCharSetCopy (ncs);
-               *cs = ncs;
+                if (trim || build_cs)
+                {
+                    if (*cs)
+                    {
+                        ncs = FcCharSetUnion (ncs, *cs);
+                        if (!ncs)
+                            return FcFalse;
+                        FcCharSetDestroy (*cs);
+                    }
+                    else
+                        ncs = FcCharSetCopy (ncs);
+                    *cs = ncs;
+                }
+
                FcPatternReference (node->pattern);
                if (FcDebug () & FC_DBG_MATCH)
                {
@@ -986,13 +987,16 @@ FcFontSetSort (FcConfig       *config,
 
     cs = 0;
 
-    if (!FcSortWalk (nodeps, nnodes, ret, &cs, trim))
+    if (!FcSortWalk (nodeps, nnodes, ret, &cs, trim, (csp!=0)))
        goto bail2;
 
     if (csp)
        *csp = cs;
     else
-       FcCharSetDestroy (cs);
+    {
+        if (cs)
+            FcCharSetDestroy (cs);
+    }
 
     free (nodes);