Don't zero out full names for FC_REF_CONSTANT fonts; also, duplicate full
names when transferring, and free full names when freeing the associated font. Reported by Jinghua Luo.
This commit is contained in:
parent
303bcf9b9d
commit
d7b3ac6367
|
@ -1,3 +1,11 @@
|
||||||
|
2005-11-02 Patrick Lam <plam@mit.edu>
|
||||||
|
* src/fcpat.c (FcPatternDestroy, FcPatternTransferFullName):
|
||||||
|
|
||||||
|
Don't zero out full names for FC_REF_CONSTANT fonts;
|
||||||
|
also, duplicate full names when transferring, and free
|
||||||
|
full names when freeing the associated font.
|
||||||
|
Reported by Jinghua Luo.
|
||||||
|
|
||||||
2005-11-02 Patrick Lam <plam@mit.edu>
|
2005-11-02 Patrick Lam <plam@mit.edu>
|
||||||
* fc-cache/fc-cache.c (scanDirs):
|
* fc-cache/fc-cache.c (scanDirs):
|
||||||
* src/fcpat.c (FcValueListSerialize):
|
* src/fcpat.c (FcValueListSerialize):
|
||||||
|
|
18
src/fcpat.c
18
src/fcpat.c
|
@ -39,6 +39,13 @@ FcPatternFindFullFname (const FcPattern *p);
|
||||||
static FcPatternEltPtr
|
static FcPatternEltPtr
|
||||||
FcPatternEltPtrCreateDynamic (FcPatternElt * e);
|
FcPatternEltPtrCreateDynamic (FcPatternElt * e);
|
||||||
|
|
||||||
|
/* If you are trying to duplicate an FcPattern which will be used for
|
||||||
|
* rendering, be aware that (internally) you also have to use
|
||||||
|
* FcPatternTransferFullFname to transfer the associated filename. If
|
||||||
|
* you are copying the font (externally) using FcPatternGetString,
|
||||||
|
* then everything's fine; this caveat only applies if you're copying
|
||||||
|
* the bits individually. */
|
||||||
|
|
||||||
FcPattern *
|
FcPattern *
|
||||||
FcPatternCreate (void)
|
FcPatternCreate (void)
|
||||||
{
|
{
|
||||||
|
@ -297,12 +304,15 @@ FcPatternDestroy (FcPattern *p)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (FcPatternFindFullFname (p))
|
|
||||||
FcPatternAddFullFname (p, 0);
|
|
||||||
|
|
||||||
if (p->ref == FC_REF_CONSTANT || --p->ref > 0)
|
if (p->ref == FC_REF_CONSTANT || --p->ref > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (FcPatternFindFullFname (p))
|
||||||
|
{
|
||||||
|
FcStrFree (FcPatternFindFullFname (p));
|
||||||
|
FcPatternAddFullFname (p, 0);
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < p->num; i++)
|
for (i = 0; i < p->num; i++)
|
||||||
FcValueListDestroy ((FcPatternEltU(p->elts)+i)->values);
|
FcValueListDestroy ((FcPatternEltU(p->elts)+i)->values);
|
||||||
|
|
||||||
|
@ -1993,5 +2003,5 @@ FcPatternTransferFullFname (const FcPattern *new, const FcPattern *orig)
|
||||||
{
|
{
|
||||||
FcChar8 * s;
|
FcChar8 * s;
|
||||||
FcPatternGetString (orig, FC_FILE, 0, &s);
|
FcPatternGetString (orig, FC_FILE, 0, &s);
|
||||||
FcPatternAddFullFname (new, FcPatternFindFullFname(orig));
|
FcPatternAddFullFname (new, FcStrCopy (FcPatternFindFullFname(orig)));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue