diff --git a/ChangeLog b/ChangeLog index 2a37be5..ed9e05b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-10-21 Patrick Lam + * fc-list/fc-list.c (main): + * src/fcname.c (FcNameUnparse, FcNameUnparseEscaped): + * fontconfig/fontconfig.h: + + Prevent fc-list from escaping strings when printing them. + 2005-10-20 Marcus Meissner reviewed by: plam diff --git a/fc-list/fc-list.c b/fc-list/fc-list.c index 04026cf..48fbb60 100644 --- a/fc-list/fc-list.c +++ b/fc-list/fc-list.c @@ -150,7 +150,7 @@ main (int argc, char **argv) FcChar8 *font; FcChar8 *file; - font = FcNameUnparse (fs->fonts[j]); + font = FcNameUnparseEscaped (fs->fonts[j], FcFalse); if (FcPatternGetString (fs->fonts[j], FC_FILE, 0, &file) == FcResultMatch) printf ("%s: ", file); printf ("%s\n", font); diff --git a/fontconfig/fontconfig.h b/fontconfig/fontconfig.h index d74088d..36982f4 100644 --- a/fontconfig/fontconfig.h +++ b/fontconfig/fontconfig.h @@ -665,6 +665,9 @@ FcNameParse (const FcChar8 *name); FcChar8 * FcNameUnparse (FcPattern *pat); +FcChar8 * +FcNameUnparseEscaped (FcPattern *pat, FcBool escape); + /* fcpat.c */ FcPattern * FcPatternCreate (void); diff --git a/src/fcname.c b/src/fcname.c index 97efcb2..825a7d5 100644 --- a/src/fcname.c +++ b/src/fcname.c @@ -823,6 +823,12 @@ FcNameUnparseValueList (FcStrBuf *buf, FcChar8 * FcNameUnparse (FcPattern *pat) +{ + return FcNameUnparseEscaped (pat, FcTrue); +} + +FcChar8 * +FcNameUnparseEscaped (FcPattern *pat, FcBool escape) { FcStrBuf buf; FcChar8 buf_static[8192]; @@ -835,7 +841,7 @@ FcNameUnparse (FcPattern *pat) e = FcPatternFindElt (pat, FC_FAMILY); if (e) { - if (!FcNameUnparseValueList (&buf, e->values, (FcChar8 *) FC_ESCAPE_FIXED)) + if (!FcNameUnparseValueList (&buf, e->values, escape ? (FcChar8 *) FC_ESCAPE_FIXED : 0)) goto bail0; } e = FcPatternFindElt (pat, FC_SIZE); @@ -843,7 +849,7 @@ FcNameUnparse (FcPattern *pat) { if (!FcNameUnparseString (&buf, (FcChar8 *) "-", 0)) goto bail0; - if (!FcNameUnparseValueList (&buf, e->values, (FcChar8 *) FC_ESCAPE_FIXED)) + if (!FcNameUnparseValueList (&buf, e->values, escape ? (FcChar8 *) FC_ESCAPE_FIXED : 0)) goto bail0; } for (l = _FcObjectTypes; l; l = l->next) @@ -861,12 +867,12 @@ FcNameUnparse (FcPattern *pat) { if (!FcNameUnparseString (&buf, (FcChar8 *) ":", 0)) goto bail0; - if (!FcNameUnparseString (&buf, (FcChar8 *) o->object, (FcChar8 *) FC_ESCAPE_VARIABLE)) + if (!FcNameUnparseString (&buf, (FcChar8 *) o->object, escape ? (FcChar8 *) FC_ESCAPE_VARIABLE : 0)) goto bail0; if (!FcNameUnparseString (&buf, (FcChar8 *) "=", 0)) goto bail0; - if (!FcNameUnparseValueList (&buf, e->values, - (FcChar8 *) FC_ESCAPE_VARIABLE)) + if (!FcNameUnparseValueList (&buf, e->values, escape ? + (FcChar8 *) FC_ESCAPE_VARIABLE : 0)) goto bail0; } }