summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fc-list/fc-list.c29
-rw-r--r--fc-list/fc-list.sgml12
-rw-r--r--fc-match/fc-match.c48
-rw-r--r--fc-match/fc-match.sgml29
4 files changed, 77 insertions, 41 deletions
diff --git a/fc-list/fc-list.c b/fc-list/fc-list.c
index f7a66b5..470b4b9 100644
--- a/fc-list/fc-list.c
+++ b/fc-list/fc-list.c
@@ -76,13 +76,13 @@ usage (char *program, int error)
fprintf (file, "List fonts matching [pattern]\n");
fprintf (file, "\n");
#if HAVE_GETOPT_LONG
- fprintf (file, " -v, --verbose display entire font pattern\n");
+ fprintf (file, " -v, --verbose display entire font pattern verbosely\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\n");
+ fprintf (file, " -v (verbose) display entire font pattern verbosely\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");
@@ -144,13 +144,12 @@ main (int argc, char **argv)
if (argv[i])
{
pat = FcNameParse ((FcChar8 *) argv[i]);
- if (!verbose)
- while (argv[++i])
- {
- if (!os)
- os = FcObjectSetCreate ();
- FcObjectSetAdd (os, argv[i]);
- }
+ while (argv[++i])
+ {
+ if (!os)
+ os = FcObjectSetCreate ();
+ FcObjectSetAdd (os, argv[i]);
+ }
}
else
pat = FcPatternCreate ();
@@ -170,9 +169,6 @@ main (int argc, char **argv)
for (j = 0; j < fs->nfont; j++)
{
- FcChar8 *font;
- FcChar8 *file;
-
if (verbose)
{
FcPatternPrint (fs->fonts[j]);
@@ -187,11 +183,14 @@ main (int argc, char **argv)
}
else
{
- font = FcNameUnparse (fs->fonts[j]);
+ FcChar8 *str;
+ FcChar8 *file;
+
+ str = FcNameUnparse (fs->fonts[j]);
if (FcPatternGetString (fs->fonts[j], FC_FILE, 0, &file) == FcResultMatch)
printf ("%s: ", file);
- printf ("%s\n", font);
- free (font);
+ printf ("%s\n", str);
+ free (str);
}
}
}
diff --git a/fc-list/fc-list.sgml b/fc-list/fc-list.sgml
index cc98779..ffa0891 100644
--- a/fc-list/fc-list.sgml
+++ b/fc-list/fc-list.sgml
@@ -81,9 +81,9 @@ manpage.1: manpage.sgml
<para><command>&dhpackage;</command> lists fonts and styles
available on the system for applications using fontconfig.
- With <option>--verbose</option>, the whole font pattern
- for each font is printed, otherwise only the elements requested
- are printed (family and style if none provided).</para>
+ If any elements are specified, only those are printed.
+ Otherwise family and style are printed, unless verbose
+ output is requested.</para>
</refsect1>
<refsect1>
<title>OPTIONS</title>
@@ -98,9 +98,9 @@ manpage.1: manpage.sgml
<option>--verbose</option>
</term>
<listitem>
- <para>Print whole font pattern for each match. Provided
- <replaceable>element</replaceable>s are ignored in this
- case.</para>
+ <para>Print verbose output of the whole font pattern for each match,
+ or <replaceable>element</replaceable>s if any is
+ provided.</para>
</listitem>
</varlistentry>
<varlistentry>
diff --git a/fc-match/fc-match.c b/fc-match/fc-match.c
index c402905..6f3d2dc 100644
--- a/fc-match/fc-match.c
+++ b/fc-match/fc-match.c
@@ -69,25 +69,25 @@ usage (char *program, int error)
{
FILE *file = error ? stderr : stdout;
#if HAVE_GETOPT_LONG
- fprintf (file, "usage: %s [-savVh] [-f FORMAT] [--sort] [--all] [--verbose] [--format=FORMAT] [--version] [--help] [pattern]\n",
+ fprintf (file, "usage: %s [-savVh] [-f FORMAT] [--sort] [--all] [--verbose] [--format=FORMAT] [--version] [--help] [pattern] {element...}\n",
program);
#else
- fprintf (file, "usage: %s [-savVh] [-f FORMAT] [pattern]\n",
+ fprintf (file, "usage: %s [-savVh] [-f FORMAT] [pattern] {element...}\n",
program);
#endif
- fprintf (file, "List fonts matching [pattern]\n");
+ fprintf (file, "List best font matching [pattern]\n");
fprintf (file, "\n");
#if HAVE_GETOPT_LONG
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\n");
+ fprintf (file, " -v, --verbose display entire font pattern verbosely\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, " -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\n");
+ fprintf (file, " -v (verbose) display entire font pattern verbosely\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");
@@ -102,6 +102,7 @@ main (int argc, char **argv)
int sort = 0, all = 0;
FcChar8 *format = NULL;
int i;
+ FcObjectSet *os = 0;
FcFontSet *fs;
FcPattern *pat;
FcResult result;
@@ -148,7 +149,15 @@ main (int argc, char **argv)
return 1;
}
if (argv[i])
+ {
pat = FcNameParse ((FcChar8 *) argv[i]);
+ while (argv[++i])
+ {
+ if (!os)
+ os = FcObjectSetCreate ();
+ FcObjectSetAdd (os, argv[i]);
+ }
+ }
else
pat = FcPatternCreate ();
@@ -192,25 +201,35 @@ main (int argc, char **argv)
for (j = 0; j < fs->nfont; j++)
{
+ FcPattern *font;
+
+ font = FcPatternFilter (fs->fonts[j], os);
+
if (verbose)
{
- FcPatternPrint (fs->fonts[j]);
+ FcPatternPrint (font);
}
else if (format)
{
FcChar8 *s;
- s = FcPatternFormat (fs->fonts[j], format);
- printf ("%s", s);
+ s = FcPatternFormat (font, format);
free (s);
}
+ else if (os)
+ {
+ FcChar8 *str;
+ str = FcNameUnparse (font);
+ printf ("%s\n", str);
+ free (str);
+ }
else
{
FcChar8 *family;
FcChar8 *style;
FcChar8 *file;
- if (FcPatternGetString (fs->fonts[j], FC_FILE, 0, &file) != FcResultMatch)
+ if (FcPatternGetString (font, FC_FILE, 0, &file) != FcResultMatch)
file = (FcChar8 *) "<unknown filename>";
else
{
@@ -218,16 +237,23 @@ main (int argc, char **argv)
if (slash)
file = slash+1;
}
- if (FcPatternGetString (fs->fonts[j], FC_FAMILY, 0, &family) != FcResultMatch)
+ if (FcPatternGetString (font, FC_FAMILY, 0, &family) != FcResultMatch)
family = (FcChar8 *) "<unknown family>";
- if (FcPatternGetString (fs->fonts[j], FC_STYLE, 0, &style) != FcResultMatch)
+ if (FcPatternGetString (font, FC_STYLE, 0, &style) != FcResultMatch)
style = (FcChar8 *) "<unknown style>";
printf ("%s: \"%s\" \"%s\"\n", file, family, style);
}
+
+ FcPatternDestroy (font);
}
FcFontSetDestroy (fs);
}
+
+ if (os)
+ FcObjectSetDestroy (os);
+
FcFini ();
+
return 0;
}
diff --git a/fc-match/fc-match.sgml b/fc-match/fc-match.sgml
index 8c71033..86e6b46 100644
--- a/fc-match/fc-match.sgml
+++ b/fc-match/fc-match.sgml
@@ -73,7 +73,8 @@ manpage.1: manpage.sgml
</group>
<arg><option>--version</option></arg>
<arg><option>--help</option></arg>
- <arg><option><replaceable>font-pattern</replaceable></option></arg>
+ <sbr>
+ <arg><option><replaceable>pattern</replaceable></option> <arg rep="repeat"><option><replaceable>element</replaceable></option></arg> </arg>
</cmdsynopsis>
</refsynopsisdiv>
@@ -81,14 +82,15 @@ manpage.1: manpage.sgml
<title>DESCRIPTION</title>
<para><command>&dhpackage;</command> matches
- <replaceable>font-pattern</replaceable> (empty
+ <replaceable>pattern</replaceable> (empty
pattern by default) using the normal fontconfig matching rules to find
the best font available. If <option>--sort</option> is given, the sorted list of best
-matching fonts is displayed. With <option>--verbose</option>, the whole font pattern
-for each match is printed, otherwise only the file, family and style
-are printed. The <option>--all</option> option works like
+matching fonts is displayed.
+The <option>--all</option> option works like
<option>--sort</option> except that no pruning is done on the list of fonts.</para>
-
+If any elements are specified, only those are printed.
+Otherwise short file name, family, and style are printed, unless verbose
+output is requested.</para>
</refsect1>
<refsect1>
<title>OPTIONS</title>
@@ -120,7 +122,9 @@ are printed. The <option>--all</option> option works like
<option>--verbose</option>
</term>
<listitem>
- <para>Print whole font pattern for each match.</para>
+ <para>Print verbose output of the whole font pattern for each match,
+ or <replaceable>element</replaceable>s if any is
+ provided.</para>
</listitem>
</varlistentry>
<varlistentry>
@@ -150,13 +154,20 @@ are printed. The <option>--all</option> option works like
</listitem>
</varlistentry>
<varlistentry>
- <term><option><replaceable>font-pattern</replaceable></option>
+ <term><option><replaceable>pattern</replaceable></option>
</term>
<listitem>
<para>Displays fonts matching
- <replaceable>font-pattern</replaceable> (uses empty pattern by default).</para>
+ <replaceable>pattern</replaceable> (uses empty pattern by default).</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option><replaceable>element</replaceable></option>
+ </term>
+ <listitem>
+ <para>If set, the <replaceable>element</replaceable> property
+ is displayed for matching fonts.</para>
+ </listitem>
</variablelist>
</refsect1>