Prevent fc-list from escaping strings when printing them.

This commit is contained in:
Patrick Lam 2005-10-21 19:47:43 +00:00
parent 250c1cd422
commit 2fa3f27e68
4 changed files with 22 additions and 6 deletions

View File

@ -1,3 +1,10 @@
2005-10-21 Patrick Lam <plam@mit.edu>
* 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 <meissner@suse.de> 2005-10-20 Marcus Meissner <meissner@suse.de>
reviewed by: plam reviewed by: plam

View File

@ -150,7 +150,7 @@ main (int argc, char **argv)
FcChar8 *font; FcChar8 *font;
FcChar8 *file; FcChar8 *file;
font = FcNameUnparse (fs->fonts[j]); font = FcNameUnparseEscaped (fs->fonts[j], FcFalse);
if (FcPatternGetString (fs->fonts[j], FC_FILE, 0, &file) == FcResultMatch) if (FcPatternGetString (fs->fonts[j], FC_FILE, 0, &file) == FcResultMatch)
printf ("%s: ", file); printf ("%s: ", file);
printf ("%s\n", font); printf ("%s\n", font);

View File

@ -665,6 +665,9 @@ FcNameParse (const FcChar8 *name);
FcChar8 * FcChar8 *
FcNameUnparse (FcPattern *pat); FcNameUnparse (FcPattern *pat);
FcChar8 *
FcNameUnparseEscaped (FcPattern *pat, FcBool escape);
/* fcpat.c */ /* fcpat.c */
FcPattern * FcPattern *
FcPatternCreate (void); FcPatternCreate (void);

View File

@ -823,6 +823,12 @@ FcNameUnparseValueList (FcStrBuf *buf,
FcChar8 * FcChar8 *
FcNameUnparse (FcPattern *pat) FcNameUnparse (FcPattern *pat)
{
return FcNameUnparseEscaped (pat, FcTrue);
}
FcChar8 *
FcNameUnparseEscaped (FcPattern *pat, FcBool escape)
{ {
FcStrBuf buf; FcStrBuf buf;
FcChar8 buf_static[8192]; FcChar8 buf_static[8192];
@ -835,7 +841,7 @@ FcNameUnparse (FcPattern *pat)
e = FcPatternFindElt (pat, FC_FAMILY); e = FcPatternFindElt (pat, FC_FAMILY);
if (e) if (e)
{ {
if (!FcNameUnparseValueList (&buf, e->values, (FcChar8 *) FC_ESCAPE_FIXED)) if (!FcNameUnparseValueList (&buf, e->values, escape ? (FcChar8 *) FC_ESCAPE_FIXED : 0))
goto bail0; goto bail0;
} }
e = FcPatternFindElt (pat, FC_SIZE); e = FcPatternFindElt (pat, FC_SIZE);
@ -843,7 +849,7 @@ FcNameUnparse (FcPattern *pat)
{ {
if (!FcNameUnparseString (&buf, (FcChar8 *) "-", 0)) if (!FcNameUnparseString (&buf, (FcChar8 *) "-", 0))
goto bail0; goto bail0;
if (!FcNameUnparseValueList (&buf, e->values, (FcChar8 *) FC_ESCAPE_FIXED)) if (!FcNameUnparseValueList (&buf, e->values, escape ? (FcChar8 *) FC_ESCAPE_FIXED : 0))
goto bail0; goto bail0;
} }
for (l = _FcObjectTypes; l; l = l->next) for (l = _FcObjectTypes; l; l = l->next)
@ -861,12 +867,12 @@ FcNameUnparse (FcPattern *pat)
{ {
if (!FcNameUnparseString (&buf, (FcChar8 *) ":", 0)) if (!FcNameUnparseString (&buf, (FcChar8 *) ":", 0))
goto bail0; 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; goto bail0;
if (!FcNameUnparseString (&buf, (FcChar8 *) "=", 0)) if (!FcNameUnparseString (&buf, (FcChar8 *) "=", 0))
goto bail0; goto bail0;
if (!FcNameUnparseValueList (&buf, e->values, if (!FcNameUnparseValueList (&buf, e->values, escape ?
(FcChar8 *) FC_ESCAPE_VARIABLE)) (FcChar8 *) FC_ESCAPE_VARIABLE : 0))
goto bail0; goto bail0;
} }
} }