]> git.wh0rd.org - fontconfig.git/commitdiff
Copy the full pathname whenever duplicating an FcPattern; otherwise,
authorPatrick Lam <plam@MIT.EDU>
Tue, 1 Nov 2005 06:57:25 +0000 (06:57 +0000)
committerPatrick Lam <plam@MIT.EDU>
Tue, 1 Nov 2005 06:57:25 +0000 (06:57 +0000)
    applications continue breaking.

ChangeLog
src/fcint.h
src/fclist.c
src/fcmatch.c
src/fcpat.c

index 783603c363a6ab37e4975ea23077e58b75fe8523..a69de9d2daa58853def6351563b44f96e737b710 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2005-10-31  Patrick Lam  <plam@mit.edu>
+       * src/fcint.h:
+       * src/fclist.c (FcListAppend):
+       * src/fcmatch.c (FcFontRenderPrepare):
+       * src/fcpat.c (FcPatternTransferFullFname, FcPatternDuplicate,
+                      FcPatternFreeze, FcPatternBaseFreeze):
+
+       Copy the full pathname whenever duplicating an FcPattern; otherwise,
+       applications continue breaking.
+
 2005-10-31  Patrick Lam  <plam@mit.edu>
        * fc-cat/fc-cat.c (FcCacheFileRead, main):
        * src/fcfreetype.c (FcFreeTypeQuery):
index fccb9412f2fad07d1a03b397cc3c4a80c7f212cc..d13bba6a0f13d92fb4d5c984515cc5a8425d4c4d 100644 (file)
@@ -808,8 +808,8 @@ FcPatternAppend (FcPattern *p, FcPattern *s);
 void
 FcPatternAddFullFname (const FcPattern *p, const char *fname);
 
-const char *
-FcPatternFindFullFname (const FcPattern *p);
+void
+FcPatternTransferFullFname (const FcPattern *new, const FcPattern *orig);
 
 const FcChar8 *
 FcStrStaticName (const FcChar8 *name);
index fa567a0491338eec3a2ee039a7bcf5097bebed42..38c20e00db58f35cf9591f1c52d97b78f316e763 100644 (file)
@@ -424,11 +424,7 @@ FcListAppend (FcListHashTable      *table,
 
         /* Also, copy over the full path info. */
        if (!strcmp (os->objects[o], FC_FILE))
-       {
-           FcChar8 * s;
-           FcPatternGetString (font, FC_FILE, 0, &s);
-           FcPatternAddFullFname (bucket->pattern, FcPatternFindFullFname(font));
-       }
+           FcPatternTransferFullFname (bucket->pattern, font);
 
        e = FcPatternFindElt (font, os->objects[o]);
        if (e)
index a359a8b883b96b5d1fee4937e387b1b581290a51..38d083ee5283261de28432cc9c279e243f54ef18 100644 (file)
@@ -489,6 +489,10 @@ FcFontRenderPrepare (FcConfig          *config,
            FcPatternAdd (new, FcObjectPtrU(pe->object), 
                           FcValueCanonicalize(&FcValueListPtrU(pe->values)->value), FcTrue);
     }
+
+    if (FcPatternFindElt (font, FC_FILE))
+       FcPatternTransferFullFname (new, font);
+
     FcConfigSubstituteWithPat (config, new, pat, FcMatchFont);
     return new;
 }
index 6d8f35709703bf8989e19824672b780e7ccdb654..b7f52793c6e63a0515038a53660e4a0776c037b8 100644 (file)
@@ -34,6 +34,8 @@ static int fcpatternelt_ptr, fcpatternelt_count;
 static FcValueList ** fcvaluelists = 0;
 static int fcvaluelist_bank_count = 0, fcvaluelist_ptr, fcvaluelist_count;
 
+static const char *
+FcPatternFindFullFname (const FcPattern *p);
 static FcPatternEltPtr
 FcPatternEltPtrCreateDynamic (FcPatternElt * e);
 
@@ -580,6 +582,9 @@ FcPatternBaseFreeze (FcPattern *b)
            (FcPatternEltU(b->elts)+i)->object;
     }
 
+    if (FcPatternFindElt (b, FC_FILE))
+       FcPatternTransferFullFname (ep, b);
+
     ent->hash = hash;
     ent->next = *bucket;
     *bucket = ent;
@@ -647,6 +652,10 @@ FcPatternFreeze (FcPattern *p)
        if (!FcValueListPtrU((FcPatternEltU(p->elts)+i)->values))
            goto bail;
     }
+
+    if (FcPatternFindElt (p, FC_FILE))
+       FcPatternTransferFullFname (b, p);
+
     /*
      * Freeze base
      */
@@ -1257,6 +1266,13 @@ FcPatternDuplicate (const FcPattern *orig)
                                FcValueCanonicalize(&FcValueListPtrU(l)->value),
                               FcTrue))
                goto bail1;
+
+       if (!strcmp ((char *)FcObjectPtrU((e + i)->object), FC_FILE))
+       {
+           FcChar8 * s;
+           FcPatternGetString (orig, FC_FILE, 0, &s);
+           FcPatternAddFullFname (new, FcPatternFindFullFname(orig));
+       }
     }
 
     return new;
@@ -1957,7 +1973,7 @@ FcPatternAddFullFname (const FcPattern *p, const char *fname)
     pb->next->m.fname = fname;
 }
 
-const char *
+static const char *
 FcPatternFindFullFname (const FcPattern *p)
 {
     struct patternDirBucket    *pb;
@@ -1971,3 +1987,10 @@ FcPatternFindFullFname (const FcPattern *p)
     return 0;
 }
 
+void
+FcPatternTransferFullFname (const FcPattern *new, const FcPattern *orig)
+{
+    FcChar8 * s;
+    FcPatternGetString (orig, FC_FILE, 0, &s);
+    FcPatternAddFullFname (new, FcPatternFindFullFname(orig));
+}