[fc-match/fc-list/fc-query/fc-scan] Add --brief that is like --verbose without charset
diff --git a/fc-list/fc-list.c b/fc-list/fc-list.c
index f6c7282..95963e7 100644
--- a/fc-list/fc-list.c
+++ b/fc-list/fc-list.c
@@ -49,6 +49,7 @@
#include <getopt.h>
const struct option longopts[] = {
{"verbose", 0, 0, 'v'},
+ {"brief", 0, 0, 'b'},
{"format", 1, 0, 'f'},
{"quiet", 0, 0, 'q'},
{"version", 0, 0, 'V'},
@@ -67,22 +68,24 @@
{
FILE *file = error ? stderr : stdout;
#if HAVE_GETOPT_LONG
- fprintf (file, "usage: %s [-vqVh] [-f FORMAT] [--verbose] [--format=FORMAT] [--quiet] [--version] [--help] [pattern] {element ...} \n",
+ fprintf (file, "usage: %s [-vbqVh] [-f FORMAT] [--verbose] [--brief] [--format=FORMAT] [--quiet] [--version] [--help] [pattern] {element ...} \n",
program);
#else
- fprintf (file, "usage: %s [-vqVh] [-f FORMAT] [pattern] {element ...} \n",
+ fprintf (file, "usage: %s [-vbqVh] [-f FORMAT] [pattern] {element ...} \n",
program);
#endif
fprintf (file, "List fonts matching [pattern]\n");
fprintf (file, "\n");
#if HAVE_GETOPT_LONG
fprintf (file, " -v, --verbose display entire font pattern verbosely\n");
+ fprintf (file, " -b, --brief display entire font pattern briefly\n");
fprintf (file, " -f, --format=FORMAT use the given output format\n");
fprintf (file, " -q, --quiet suppress all normal output, exit 1 if no fonts matched\n");
fprintf (file, " -V, --version display font config version and exit\n");
fprintf (file, " -h, --help display this help and exit\n");
#else
fprintf (file, " -v (verbose) display entire font pattern verbosely\n");
+ fprintf (file, " -b (brief) display entire font pattern briefly\n");
fprintf (file, " -f FORMAT (format) use the given output format\n");
fprintf (file, " -q, (quiet) suppress all normal output, exit 1 if no fonts matched\n");
fprintf (file, " -V (version) display font config version and exit\n");
@@ -95,6 +98,7 @@
main (int argc, char **argv)
{
int verbose = 0;
+ int brief = 0;
int quiet = 0;
const FcChar8 *format = NULL;
int nfont = 0;
@@ -106,15 +110,18 @@
int c;
#if HAVE_GETOPT_LONG
- while ((c = getopt_long (argc, argv, "vf:qVh", longopts, NULL)) != -1)
+ while ((c = getopt_long (argc, argv, "vbf:qVh", longopts, NULL)) != -1)
#else
- while ((c = getopt (argc, argv, "vf:qVh")) != -1)
+ while ((c = getopt (argc, argv, "vbf:qVh")) != -1)
#endif
{
switch (c) {
case 'v':
verbose = 1;
break;
+ case 'b':
+ brief = 1;
+ break;
case 'f':
format = (FcChar8 *) strdup (optarg);
break;
@@ -155,7 +162,7 @@
pat = FcPatternCreate ();
if (quiet && !os)
os = FcObjectSetCreate ();
- if (!verbose && !format && !os)
+ if (!verbose && !brief && !format && !os)
os = FcObjectSetBuild (FC_FAMILY, FC_STYLE, FC_FILE, (char *) 0);
if (!format)
format = (const FcChar8 *) "%{=fclist}\n";
@@ -171,8 +178,13 @@
for (j = 0; j < fs->nfont; j++)
{
- if (verbose)
+ if (verbose || brief)
{
+ if (brief)
+ {
+ FcPatternDel (fs->fonts[j], FC_CHARSET);
+ FcPatternDel (fs->fonts[j], FC_LANG);
+ }
FcPatternPrint (fs->fonts[j]);
}
else
diff --git a/fc-match/fc-match.c b/fc-match/fc-match.c
index f96c009..88f4ac8 100644
--- a/fc-match/fc-match.c
+++ b/fc-match/fc-match.c
@@ -52,6 +52,7 @@
{"sort", 0, 0, 's'},
{"all", 0, 0, 'a'},
{"verbose", 0, 0, 'v'},
+ {"brief", 0, 0, 'b'},
{"format", 1, 0, 'f'},
{"version", 0, 0, 'V'},
{"help", 0, 0, 'h'},
@@ -69,7 +70,7 @@
{
FILE *file = error ? stderr : stdout;
#if HAVE_GETOPT_LONG
- fprintf (file, "usage: %s [-savVh] [-f FORMAT] [--sort] [--all] [--verbose] [--format=FORMAT] [--version] [--help] [pattern] {element...}\n",
+ fprintf (file, "usage: %s [-savbVh] [-f FORMAT] [--sort] [--all] [--verbose] [--brief] [--format=FORMAT] [--version] [--help] [pattern] {element...}\n",
program);
#else
fprintf (file, "usage: %s [-savVh] [-f FORMAT] [pattern] {element...}\n",
@@ -81,6 +82,7 @@
fprintf (file, " -s, --sort display sorted list of matches\n");
fprintf (file, " -a, --all display unpruned sorted list of matches\n");
fprintf (file, " -v, --verbose display entire font pattern verbosely\n");
+ fprintf (file, " -b, --brief display entire font pattern briefly\n");
fprintf (file, " -f, --format=FORMAT use the given output format\n");
fprintf (file, " -V, --version display font config version and exit\n");
fprintf (file, " -h, --help display this help and exit\n");
@@ -88,6 +90,7 @@
fprintf (file, " -s, (sort) display sorted list of matches\n");
fprintf (file, " -a (all) display unpruned sorted list of matches\n");
fprintf (file, " -v (verbose) display entire font pattern verbosely\n");
+ fprintf (file, " -b (brief) display entire font pattern briefly\n");
fprintf (file, " -f FORMAT (format) use the given output format\n");
fprintf (file, " -V (version) display font config version and exit\n");
fprintf (file, " -h (help) display this help and exit\n");
@@ -99,6 +102,7 @@
main (int argc, char **argv)
{
int verbose = 0;
+ int brief = 0;
int sort = 0, all = 0;
const FcChar8 *format = NULL;
int i;
@@ -110,9 +114,9 @@
int c;
#if HAVE_GETOPT_LONG
- while ((c = getopt_long (argc, argv, "asvf:Vh", longopts, NULL)) != -1)
+ while ((c = getopt_long (argc, argv, "asvbf:Vh", longopts, NULL)) != -1)
#else
- while ((c = getopt (argc, argv, "asvf:Vh")) != -1)
+ while ((c = getopt (argc, argv, "asvbf:Vh")) != -1)
#endif
{
switch (c) {
@@ -125,6 +129,9 @@
case 'v':
verbose = 1;
break;
+ case 'b':
+ brief = 1;
+ break;
case 'f':
format = (FcChar8 *) strdup (optarg);
break;
@@ -218,8 +225,13 @@
font = FcPatternFilter (fs->fonts[j], os);
- if (verbose)
+ if (verbose || brief)
{
+ if (brief)
+ {
+ FcPatternDel (font, FC_CHARSET);
+ FcPatternDel (font, FC_LANG);
+ }
FcPatternPrint (font);
}
else
diff --git a/fc-query/fc-query.c b/fc-query/fc-query.c
index 9c9900b..8a96da0 100644
--- a/fc-query/fc-query.c
+++ b/fc-query/fc-query.c
@@ -53,6 +53,7 @@
#include <getopt.h>
static const struct option longopts[] = {
{"index", 1, 0, 'i'},
+ {"brief", 0, 0, 'b'},
{"format", 1, 0, 'f'},
{"version", 0, 0, 'V'},
{"help", 0, 0, 'h'},
@@ -70,21 +71,23 @@
{
FILE *file = error ? stderr : stdout;
#if HAVE_GETOPT_LONG
- fprintf (file, "usage: %s [-Vh] [-i index] [-f FORMAT] [--index index] [--format FORMAT] [--version] [--help] font-file...\n",
+ fprintf (file, "usage: %s [-bVh] [-i index] [-f FORMAT] [--index index] [--brief] [--format FORMAT] [--version] [--help] font-file...\n",
program);
#else
- fprintf (file, "usage: %s [-Vh] [-i index] [-f FORMAT] font-file...\n",
+ fprintf (file, "usage: %s [-bVh] [-i index] [-f FORMAT] font-file...\n",
program);
#endif
fprintf (file, "Query font files and print resulting pattern(s)\n");
fprintf (file, "\n");
#if HAVE_GETOPT_LONG
fprintf (file, " -i, --index INDEX display the INDEX face of each font file only\n");
+ fprintf (file, " -b, --brief display font pattern briefly\n");
fprintf (file, " -f, --format=FORMAT use the given output format\n");
fprintf (file, " -V, --version display font config version and exit\n");
fprintf (file, " -h, --help display this help and exit\n");
#else
fprintf (file, " -i INDEX (index) display the INDEX face of each font file only\n");
+ fprintf (file, " -b (brief) display font pattern briefly\n");
fprintf (file, " -f FORMAT (format) use the given output format\n");
fprintf (file, " -V (version) display font config version and exit\n");
fprintf (file, " -h (help) display this help and exit\n");
@@ -96,6 +99,7 @@
main (int argc, char **argv)
{
unsigned int id = (unsigned int) -1;
+ int brief = 0;
FcFontSet *fs;
FcChar8 *format = NULL;
int err = 0;
@@ -104,15 +108,18 @@
int c;
#if HAVE_GETOPT_LONG
- while ((c = getopt_long (argc, argv, "i:f:Vh", longopts, NULL)) != -1)
+ while ((c = getopt_long (argc, argv, "i:bf:Vh", longopts, NULL)) != -1)
#else
- while ((c = getopt (argc, argv, "i:f:Vh")) != -1)
+ while ((c = getopt (argc, argv, "i:bf:Vh")) != -1)
#endif
{
switch (c) {
case 'i':
id = (unsigned int) strtol (optarg, NULL, 0); /* strtol() To handle -1. */
break;
+ case 'b':
+ brief = 1;
+ break;
case 'f':
format = (FcChar8 *) strdup (optarg);
break;
@@ -149,6 +156,12 @@
{
FcPattern *pat = fs->fonts[i];
+ if (brief)
+ {
+ FcPatternDel (pat, FC_CHARSET);
+ FcPatternDel (pat, FC_LANG);
+ }
+
if (format)
{
FcChar8 *s;
diff --git a/fc-scan/fc-scan.c b/fc-scan/fc-scan.c
index 58a0b15..41bd260 100644
--- a/fc-scan/fc-scan.c
+++ b/fc-scan/fc-scan.c
@@ -52,6 +52,7 @@
#define _GNU_SOURCE
#include <getopt.h>
static const struct option longopts[] = {
+ {"brief", 0, 0, 'b'},
{"format", 1, 0, 'f'},
{"version", 0, 0, 'V'},
{"help", 0, 0, 'h'},
@@ -69,19 +70,21 @@
{
FILE *file = error ? stderr : stdout;
#if HAVE_GETOPT_LONG
- fprintf (file, "usage: %s [-Vh] [-f FORMAT] [--format FORMAT] [--version] [--help] font-file...\n",
+ fprintf (file, "usage: %s [-bVh] [-f FORMAT] [--brief] [--format FORMAT] [--version] [--help] font-file...\n",
program);
#else
- fprintf (file, "usage: %s [-Vh] [-f FORMAT] font-file...\n",
+ fprintf (file, "usage: %s [-bVh] [-f FORMAT] font-file...\n",
program);
#endif
fprintf (file, "Scan font files and directories, and print resulting pattern(s)\n");
fprintf (file, "\n");
#if HAVE_GETOPT_LONG
+ fprintf (file, " -b, --brief display font pattern briefly\n");
fprintf (file, " -f, --format=FORMAT use the given output format\n");
fprintf (file, " -V, --version display font config version and exit\n");
fprintf (file, " -h, --help display this help and exit\n");
#else
+ fprintf (file, " -b (brief) display font pattern briefly\n");
fprintf (file, " -f FORMAT (format) use the given output format\n");
fprintf (file, " -V (version) display font config version and exit\n");
fprintf (file, " -h (help) display this help and exit\n");
@@ -92,6 +95,7 @@
int
main (int argc, char **argv)
{
+ int brief = 0;
FcChar8 *format = NULL;
int i;
FcFontSet *fs;
@@ -105,6 +109,9 @@
#endif
{
switch (c) {
+ case 'b':
+ brief = 1;
+ break;
case 'f':
format = (FcChar8 *) strdup (optarg);
break;
@@ -152,6 +159,12 @@
{
FcPattern *pat = fs->fonts[i];
+ if (brief)
+ {
+ FcPatternDel (pat, FC_CHARSET);
+ FcPatternDel (pat, FC_LANG);
+ }
+
if (format)
{
FcChar8 *s;