diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2011-06-20 11:55:25 -0400 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2011-06-20 11:55:25 -0400 |
commit | e61eba94efffbdbec6f9e08f3fb04b75f0ba2a3f (patch) | |
tree | ef246cf44ee9d370152f92fe6bebbfd3f92cd567 /fc-cat | |
parent | a15ac5d3840552528874f1d5ad166eb00906ce80 (diff) |
Switch fc-cat to use FcPatternFormat()
Added the a builtin "fccat" to FcPatternFormat().
Diffstat (limited to 'fc-cat')
-rw-r--r-- | fc-cat/fc-cat.c | 39 |
1 files changed, 11 insertions, 28 deletions
diff --git a/fc-cat/fc-cat.c b/fc-cat/fc-cat.c index c6c39934..5ee947ec 100644 --- a/fc-cat/fc-cat.c +++ b/fc-cat/fc-cat.c @@ -194,11 +194,9 @@ file_base_name (const FcChar8 *cache, const FcChar8 *file) static FcBool cache_print_set (FcFontSet *set, FcStrSet *dirs, const FcChar8 *base_name, FcBool verbose) { - FcChar8 *name, *dir; - const FcChar8 *file, *base; - int ret; + FcChar8 *dir; + const FcChar8 *base; int n; - int id; int ndir = 0; FcStrList *list; @@ -227,37 +225,22 @@ cache_print_set (FcFontSet *set, FcStrSet *dirs, const FcChar8 *base_name, FcBoo for (n = 0; n < set->nfont; n++) { FcPattern *font = set->fonts[n]; + FcChar8 *s; - if (FcPatternGetString (font, FC_FILE, 0, (FcChar8 **) &file) != FcResultMatch) - goto bail3; - base = file_base_name (base_name, file); - if (FcPatternGetInteger (font, FC_INDEX, 0, &id) != FcResultMatch) - goto bail3; - if (!write_string (stdout, base)) - goto bail3; - if (PUTC (' ', stdout) == EOF) - goto bail3; - if (!write_int (stdout, id)) - goto bail3; - if (PUTC (' ', stdout) == EOF) - goto bail3; - name = FcNameUnparse (font); - if (!name) - goto bail3; - ret = write_string (stdout, name); - FcStrFree (name); - if (!ret) - goto bail3; - if (PUTC ('\n', stdout) == EOF) - goto bail3; + s = FcPatternFormat (font, "%{=fccat}\n"); + if (s) + { + printf ("%s", s); + free (s); + } } if (verbose && !set->nfont && !ndir) printf ("<empty>\n"); - + FcStrListDone (list); return FcTrue; - + bail3: FcStrListDone (list); bail2: |