A private FcObjectGetSet() is implemented that provides an
FcObjectSet of all registered elements. FcFontSetList() is
then modified to use the object set from FcObjectGetSet() if
provided object-set is NULL.
Alternatively FcObjectGetSet() can be made public. In that
case fc-list can use that as a base if --verbose is included,
and also add any elements provided by the user (though that has
no effect, as all elements from the cache are already registered).
Currently fc-list ignores user-provided elements if --verbose
is specified.
fprintf (stderr, "List fonts matching [pattern]\n");
fprintf (stderr, "\n");
#if HAVE_GETOPT_LONG
fprintf (stderr, "List fonts matching [pattern]\n");
fprintf (stderr, "\n");
#if HAVE_GETOPT_LONG
- fprintf (stderr, " -v, --verbose display status information while busy\n");
+ fprintf (stderr, " -v, --verbose display entire font pattern\n");
fprintf (stderr, " -V, --version display font config version and exit\n");
fprintf (stderr, " -?, --help display this help and exit\n");
#else
fprintf (stderr, " -V, --version display font config version and exit\n");
fprintf (stderr, " -?, --help display this help and exit\n");
#else
- fprintf (stderr, " -v (verbose) display status information while busy\n");
+ fprintf (stderr, " -v (verbose) display entire font pattern\n");
fprintf (stderr, " -V (version) display font config version and exit\n");
fprintf (stderr, " -? (help) display this help and exit\n");
#endif
fprintf (stderr, " -V (version) display font config version and exit\n");
fprintf (stderr, " -? (help) display this help and exit\n");
#endif
int
main (int argc, char **argv)
{
int
main (int argc, char **argv)
{
int i;
FcObjectSet *os = 0;
FcFontSet *fs;
int i;
FcObjectSet *os = 0;
FcFontSet *fs;
FC_MAJOR, FC_MINOR, FC_REVISION);
exit (0);
case 'v':
FC_MAJOR, FC_MINOR, FC_REVISION);
exit (0);
case 'v':
break;
default:
usage (argv[0]);
break;
default:
usage (argv[0]);
if (argv[i])
{
pat = FcNameParse ((FcChar8 *) argv[i]);
if (argv[i])
{
pat = FcNameParse ((FcChar8 *) argv[i]);
- while (argv[++i])
- {
- if (!os)
- os = FcObjectSetCreate ();
- FcObjectSetAdd (os, argv[i]);
- }
+ if (!verbose)
+ while (argv[++i])
+ {
+ if (!os)
+ os = FcObjectSetCreate ();
+ FcObjectSetAdd (os, argv[i]);
+ }
}
else
pat = FcPatternCreate ();
}
else
pat = FcPatternCreate ();
os = FcObjectSetBuild (FC_FAMILY, FC_STYLE, (char *) 0);
fs = FcFontList (0, pat, os);
os = FcObjectSetBuild (FC_FAMILY, FC_STYLE, (char *) 0);
fs = FcFontList (0, pat, os);
- FcObjectSetDestroy (os);
+ if (os)
+ FcObjectSetDestroy (os);
if (pat)
FcPatternDestroy (pat);
if (pat)
FcPatternDestroy (pat);
FcChar8 *font;
FcChar8 *file;
FcChar8 *font;
FcChar8 *file;
- font = FcNameUnparse (fs->fonts[j]);
- if (FcPatternGetString (fs->fonts[j], FC_FILE, 0, &file) == FcResultMatch)
- printf ("%s: ", file);
- printf ("%s\n", font);
- free (font);
+ if (verbose)
+ FcPatternPrint (fs->fonts[j]);
+ else
+ {
+ font = FcNameUnparse (fs->fonts[j]);
+ if (FcPatternGetString (fs->fonts[j], FC_FILE, 0, &file) == FcResultMatch)
+ printf ("%s: ", file);
+ printf ("%s\n", font);
+ free (font);
+ }
}
FcFontSetDestroy (fs);
}
}
FcFontSetDestroy (fs);
}
<title>DESCRIPTION</title>
<para><command>&dhpackage;</command> lists fonts and styles
<title>DESCRIPTION</title>
<para><command>&dhpackage;</command> lists fonts and styles
- available on the system for applications using fontconfig.</para>
-
+ 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>
</refsect1>
<refsect1>
<title>OPTIONS</title>
</refsect1>
<refsect1>
<title>OPTIONS</title>
<option>--verbose</option>
</term>
<listitem>
<option>--verbose</option>
</term>
<listitem>
- <para>Display status information while busy.</para>
+ <para>Print whole font pattern for each match. Provided
+ <replaceable>element</replaceable>s are ignored in this
+ case.</para>
</listitem>
</varlistentry>
<varlistentry>
</listitem>
</varlistentry>
<varlistentry>
FcPrivate const char *
FcObjectName (FcObject object);
FcPrivate const char *
FcObjectName (FcObject object);
+FcPrivate FcObjectSet *
+FcObjectGetSet (void);
+
FcPrivate FcBool
FcObjectInit (void);
FcPrivate FcBool
FcObjectInit (void);
FcListHashTable table;
int i;
FcListBucket *bucket;
FcListHashTable table;
int i;
FcListBucket *bucket;
goto bail0;
}
FcListHashTableInit (&table);
goto bail0;
}
FcListHashTableInit (&table);
+
+ if (!os)
+ {
+ os = FcObjectGetSet ();
+ destroy_os = 1;
+ }
+
/*
* Walk all available fonts adding those that
* match to the hash table
/*
* Walk all available fonts adding those that
* match to the hash table
bail1:
FcListHashTableCleanup (&table);
bail0:
bail1:
FcListHashTableCleanup (&table);
bail0:
+ if (destroy_os)
+ FcObjectSetDestroy (os);
+FcObjectSet *
+FcObjectGetSet (void)
+{
+ int i;
+ FcObjectSet *os = NULL;
+
+
+ os = FcObjectSetCreate ();
+ for (i = 0; i < FcObjectsNumber; i++)
+ FcObjectSetAdd (os, FcObjects[i].object);
+
+ return os;
+}
+
FcBool
FcObjectInit (void)
{
FcBool
FcObjectInit (void)
{