Copy the full pathname whenever duplicating an FcPattern; otherwise,

applications continue breaking.
This commit is contained in:
Patrick Lam 2005-11-01 06:57:25 +00:00
parent d6946c1a11
commit 793154ed8d
5 changed files with 41 additions and 8 deletions

View File

@ -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> 2005-10-31 Patrick Lam <plam@mit.edu>
* fc-cat/fc-cat.c (FcCacheFileRead, main): * fc-cat/fc-cat.c (FcCacheFileRead, main):
* src/fcfreetype.c (FcFreeTypeQuery): * src/fcfreetype.c (FcFreeTypeQuery):

View File

@ -808,8 +808,8 @@ FcPatternAppend (FcPattern *p, FcPattern *s);
void void
FcPatternAddFullFname (const FcPattern *p, const char *fname); FcPatternAddFullFname (const FcPattern *p, const char *fname);
const char * void
FcPatternFindFullFname (const FcPattern *p); FcPatternTransferFullFname (const FcPattern *new, const FcPattern *orig);
const FcChar8 * const FcChar8 *
FcStrStaticName (const FcChar8 *name); FcStrStaticName (const FcChar8 *name);

View File

@ -424,11 +424,7 @@ FcListAppend (FcListHashTable *table,
/* Also, copy over the full path info. */ /* Also, copy over the full path info. */
if (!strcmp (os->objects[o], FC_FILE)) if (!strcmp (os->objects[o], FC_FILE))
{ FcPatternTransferFullFname (bucket->pattern, font);
FcChar8 * s;
FcPatternGetString (font, FC_FILE, 0, &s);
FcPatternAddFullFname (bucket->pattern, FcPatternFindFullFname(font));
}
e = FcPatternFindElt (font, os->objects[o]); e = FcPatternFindElt (font, os->objects[o]);
if (e) if (e)

View File

@ -489,6 +489,10 @@ FcFontRenderPrepare (FcConfig *config,
FcPatternAdd (new, FcObjectPtrU(pe->object), FcPatternAdd (new, FcObjectPtrU(pe->object),
FcValueCanonicalize(&FcValueListPtrU(pe->values)->value), FcTrue); FcValueCanonicalize(&FcValueListPtrU(pe->values)->value), FcTrue);
} }
if (FcPatternFindElt (font, FC_FILE))
FcPatternTransferFullFname (new, font);
FcConfigSubstituteWithPat (config, new, pat, FcMatchFont); FcConfigSubstituteWithPat (config, new, pat, FcMatchFont);
return new; return new;
} }

View File

@ -34,6 +34,8 @@ static int fcpatternelt_ptr, fcpatternelt_count;
static FcValueList ** fcvaluelists = 0; static FcValueList ** fcvaluelists = 0;
static int fcvaluelist_bank_count = 0, fcvaluelist_ptr, fcvaluelist_count; static int fcvaluelist_bank_count = 0, fcvaluelist_ptr, fcvaluelist_count;
static const char *
FcPatternFindFullFname (const FcPattern *p);
static FcPatternEltPtr static FcPatternEltPtr
FcPatternEltPtrCreateDynamic (FcPatternElt * e); FcPatternEltPtrCreateDynamic (FcPatternElt * e);
@ -580,6 +582,9 @@ FcPatternBaseFreeze (FcPattern *b)
(FcPatternEltU(b->elts)+i)->object; (FcPatternEltU(b->elts)+i)->object;
} }
if (FcPatternFindElt (b, FC_FILE))
FcPatternTransferFullFname (ep, b);
ent->hash = hash; ent->hash = hash;
ent->next = *bucket; ent->next = *bucket;
*bucket = ent; *bucket = ent;
@ -647,6 +652,10 @@ FcPatternFreeze (FcPattern *p)
if (!FcValueListPtrU((FcPatternEltU(p->elts)+i)->values)) if (!FcValueListPtrU((FcPatternEltU(p->elts)+i)->values))
goto bail; goto bail;
} }
if (FcPatternFindElt (p, FC_FILE))
FcPatternTransferFullFname (b, p);
/* /*
* Freeze base * Freeze base
*/ */
@ -1257,6 +1266,13 @@ FcPatternDuplicate (const FcPattern *orig)
FcValueCanonicalize(&FcValueListPtrU(l)->value), FcValueCanonicalize(&FcValueListPtrU(l)->value),
FcTrue)) FcTrue))
goto bail1; 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; return new;
@ -1957,7 +1973,7 @@ FcPatternAddFullFname (const FcPattern *p, const char *fname)
pb->next->m.fname = fname; pb->next->m.fname = fname;
} }
const char * static const char *
FcPatternFindFullFname (const FcPattern *p) FcPatternFindFullFname (const FcPattern *p)
{ {
struct patternDirBucket *pb; struct patternDirBucket *pb;
@ -1971,3 +1987,10 @@ FcPatternFindFullFname (const FcPattern *p)
return 0; return 0;
} }
void
FcPatternTransferFullFname (const FcPattern *new, const FcPattern *orig)
{
FcChar8 * s;
FcPatternGetString (orig, FC_FILE, 0, &s);
FcPatternAddFullFname (new, FcPatternFindFullFname(orig));
}