Commit 0c93b91d authored by Behdad Esfahbod's avatar Behdad Esfahbod

Implement FcPatternFormat and use it in cmdline tools (bug #17107)

Still need to add more features, but the API is there, and used
by cmdline tools with -f or --format.
parent 5cf04b20
...@@ -395,3 +395,21 @@ Converts the given pattern into the standard text format described above. ...@@ -395,3 +395,21 @@ Converts the given pattern into the standard text format described above.
The return value is not static, but instead refers to newly allocated memory The return value is not static, but instead refers to newly allocated memory
which should be freed by the caller using free(). which should be freed by the caller using free().
@@ @@
@RET@ FcChar8 *
@FUNC@ FcPatternFormat
@TYPE1@ FcPattern * @ARG1@ pat
@TYPE2@ const FcChar8 * @ARG2@ format
@PURPOSE@ Format a pattern into a string according to a format specifier
@DESC@
Converts the given pattern into text format described by the format specifier.
The format specifier is similar to a C style printf string, which the
printf(2) man page provides a good introduction to. However, as RPM already
knows the type of data that is being printed, you must omit the type
specifier. In its place put the element name you wish to print enclosed in
curly braces ({}). For example, to print the family name and style the
pattern, use the format "%{family} %{style}\n".
The return value refers to newly allocated memory which should be freed by the
caller using free().
@@
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
#else #else
...@@ -47,9 +48,10 @@ ...@@ -47,9 +48,10 @@
#define _GNU_SOURCE #define _GNU_SOURCE
#include <getopt.h> #include <getopt.h>
const struct option longopts[] = { const struct option longopts[] = {
{"version", 0, 0, 'V'},
{"verbose", 0, 0, 'v'}, {"verbose", 0, 0, 'v'},
{"format", 1, 0, 'f'},
{"quiet", 0, 0, 'q'}, {"quiet", 0, 0, 'q'},
{"version", 0, 0, 'V'},
{"help", 0, 0, 'h'}, {"help", 0, 0, 'h'},
{NULL,0,0,0}, {NULL,0,0,0},
}; };
...@@ -65,21 +67,23 @@ usage (char *program, int error) ...@@ -65,21 +67,23 @@ usage (char *program, int error)
{ {
FILE *file = error ? stderr : stdout; FILE *file = error ? stderr : stdout;
#if HAVE_GETOPT_LONG #if HAVE_GETOPT_LONG
fprintf (file, "usage: %s [-vqVh] [--verbose] [--quiet] [--version] [--help] [pattern] {element ...} \n", fprintf (file, "usage: %s [-vqVh] [-f FORMAT] [--verbose] [--format=FORMAT] [--quiet] [--version] [--help] [pattern] {element ...} \n",
program); program);
#else #else
fprintf (file, "usage: %s [-vqVh] [pattern] {element ...} \n", fprintf (file, "usage: %s [-vqVh] [-f FORMAT] [pattern] {element ...} \n",
program); program);
#endif #endif
fprintf (file, "List fonts matching [pattern]\n"); fprintf (file, "List fonts matching [pattern]\n");
fprintf (file, "\n"); fprintf (file, "\n");
#if HAVE_GETOPT_LONG #if HAVE_GETOPT_LONG
fprintf (file, " -v, --verbose display entire font pattern\n"); fprintf (file, " -v, --verbose display entire font pattern\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, " -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, " -V, --version display font config version and exit\n");
fprintf (file, " -h, --help display this help and exit\n"); fprintf (file, " -h, --help display this help and exit\n");
#else #else
fprintf (file, " -v (verbose) display entire font pattern\n"); fprintf (file, " -v (verbose) display entire font pattern\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, " -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, " -V (version) display font config version and exit\n");
fprintf (file, " -h (help) display this help and exit\n"); fprintf (file, " -h (help) display this help and exit\n");
...@@ -92,6 +96,7 @@ main (int argc, char **argv) ...@@ -92,6 +96,7 @@ main (int argc, char **argv)
{ {
int verbose = 0; int verbose = 0;
int quiet = 0; int quiet = 0;
FcChar8 *format = NULL;
int nfont = 0; int nfont = 0;
int i; int i;
FcObjectSet *os = 0; FcObjectSet *os = 0;
...@@ -101,22 +106,25 @@ main (int argc, char **argv) ...@@ -101,22 +106,25 @@ main (int argc, char **argv)
int c; int c;
#if HAVE_GETOPT_LONG #if HAVE_GETOPT_LONG
while ((c = getopt_long (argc, argv, "Vqvh", longopts, NULL)) != -1) while ((c = getopt_long (argc, argv, "vf:qVh", longopts, NULL)) != -1)
#else #else
while ((c = getopt (argc, argv, "Vqvh")) != -1) while ((c = getopt (argc, argv, "vf:qVh")) != -1)
#endif #endif
{ {
switch (c) { switch (c) {
case 'V':
fprintf (stderr, "fontconfig version %d.%d.%d\n",
FC_MAJOR, FC_MINOR, FC_REVISION);
exit (0);
case 'v': case 'v':
verbose = 1; verbose = 1;
break; break;
case 'f':
format = (FcChar8 *) strdup (optarg);
break;
case 'q': case 'q':
quiet = 1; quiet = 1;
break; break;
case 'V':
fprintf (stderr, "fontconfig version %d.%d.%d\n",
FC_MAJOR, FC_MINOR, FC_REVISION);
exit (0);
case 'h': case 'h':
usage (argv[0], 0); usage (argv[0], 0);
default: default:
...@@ -148,7 +156,7 @@ main (int argc, char **argv) ...@@ -148,7 +156,7 @@ main (int argc, char **argv)
pat = FcPatternCreate (); pat = FcPatternCreate ();
if (quiet && !os) if (quiet && !os)
os = FcObjectSetCreate (); os = FcObjectSetCreate ();
if (!verbose && !os) if (!verbose && !format && !os)
os = FcObjectSetBuild (FC_FAMILY, FC_STYLE, (char *) 0); os = FcObjectSetBuild (FC_FAMILY, FC_STYLE, (char *) 0);
fs = FcFontList (0, pat, os); fs = FcFontList (0, pat, os);
if (os) if (os)
...@@ -166,7 +174,17 @@ main (int argc, char **argv) ...@@ -166,7 +174,17 @@ main (int argc, char **argv)
FcChar8 *file; FcChar8 *file;
if (verbose) if (verbose)
{
FcPatternPrint (fs->fonts[j]); FcPatternPrint (fs->fonts[j]);
}
else if (format)
{
FcChar8 *s;
s = FcPatternFormat (fs->fonts[j], format);
printf ("%s", s);
free (s);
}
else else
{ {
font = FcNameUnparse (fs->fonts[j]); font = FcNameUnparse (fs->fonts[j]);
......
...@@ -65,6 +65,10 @@ manpage.1: manpage.sgml ...@@ -65,6 +65,10 @@ manpage.1: manpage.sgml
<arg><option>-vVh</option></arg> <arg><option>-vVh</option></arg>
<arg><option>--verbose</option></arg> <arg><option>--verbose</option></arg>
<group>
<arg><option>-f</option> <option><replaceable>format</replaceable></option></arg>
<arg><option>--format</option> <option><replaceable>format</replaceable></option></arg>
</group>
<arg><option>--version</option></arg> <arg><option>--version</option></arg>
<arg><option>--help</option></arg> <arg><option>--help</option></arg>
<sbr> <sbr>
...@@ -100,11 +104,13 @@ manpage.1: manpage.sgml ...@@ -100,11 +104,13 @@ manpage.1: manpage.sgml
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>-h</option> <term><option>-f</option>
<option>--help</option> <option>--format</option>
<option><replaceable>format</replaceable></option>
</term> </term>
<listitem> <listitem>
<para>Show summary of options.</para> <para>Format output according to the format specifier
<replaceable>format</replaceable>.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
...@@ -115,6 +121,14 @@ manpage.1: manpage.sgml ...@@ -115,6 +121,14 @@ manpage.1: manpage.sgml
<para>Show version of the program and exit.</para> <para>Show version of the program and exit.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><option>-h</option>
<option>--help</option>
</term>
<listitem>
<para>Show summary of options.</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><option><replaceable>pattern</replaceable></option> <term><option><replaceable>pattern</replaceable></option>
</term> </term>
...@@ -164,6 +178,8 @@ manpage.1: manpage.sgml ...@@ -164,6 +178,8 @@ manpage.1: manpage.sgml
<command>fc-cache</command>(1) <command>fc-cache</command>(1)
<command>fc-match</command>(1) <command>fc-match</command>(1)
<command>fc-query</command>(1) <command>fc-query</command>(1)
<function>FcFontList</function>(3)
<function>FcPatternFormat</function>(3)
</para> </para>
<para>The fontconfig user's guide, in HTML format: <para>The fontconfig user's guide, in HTML format:
......
...@@ -51,8 +51,9 @@ ...@@ -51,8 +51,9 @@
static const struct option longopts[] = { static const struct option longopts[] = {
{"sort", 0, 0, 's'}, {"sort", 0, 0, 's'},
{"all", 0, 0, 'a'}, {"all", 0, 0, 'a'},
{"version", 0, 0, 'V'},
{"verbose", 0, 0, 'v'}, {"verbose", 0, 0, 'v'},
{"format", 1, 0, 'f'},
{"version", 0, 0, 'V'},
{"help", 0, 0, 'h'}, {"help", 0, 0, 'h'},
{NULL,0,0,0}, {NULL,0,0,0},
}; };
...@@ -68,10 +69,10 @@ usage (char *program, int error) ...@@ -68,10 +69,10 @@ usage (char *program, int error)
{ {
FILE *file = error ? stderr : stdout; FILE *file = error ? stderr : stdout;
#if HAVE_GETOPT_LONG #if HAVE_GETOPT_LONG
fprintf (file, "usage: %s [-savVh] [--sort] [--all] [--verbose] [--version] [--help] [pattern]\n", fprintf (file, "usage: %s [-savVh] [-f FORMAT] [--sort] [--all] [--verbose] [--format=FORMAT] [--version] [--help] [pattern]\n",
program); program);
#else #else
fprintf (file, "usage: %s [-savVh] [pattern]\n", fprintf (file, "usage: %s [-savVh] [-f FORMAT] [pattern]\n",
program); program);
#endif #endif
fprintf (file, "List fonts matching [pattern]\n"); fprintf (file, "List fonts matching [pattern]\n");
...@@ -80,12 +81,14 @@ usage (char *program, int error) ...@@ -80,12 +81,14 @@ usage (char *program, int error)
fprintf (file, " -s, --sort display sorted list of matches\n"); fprintf (file, " -s, --sort display sorted list of matches\n");
fprintf (file, " -a, --all display unpruned 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\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, " -V, --version display font config version and exit\n");
fprintf (file, " -h, --help display this help and exit\n"); fprintf (file, " -h, --help display this help and exit\n");
#else #else
fprintf (file, " -s, (sort) display sorted list of matches\n"); fprintf (file, " -s, (sort) display sorted list of matches\n");
fprintf (file, " -a (all) display unpruned 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\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, " -V (version) display font config version and exit\n");
fprintf (file, " -h (help) display this help and exit\n"); fprintf (file, " -h (help) display this help and exit\n");
#endif #endif
...@@ -97,6 +100,7 @@ main (int argc, char **argv) ...@@ -97,6 +100,7 @@ main (int argc, char **argv)
{ {
int verbose = 0; int verbose = 0;
int sort = 0, all = 0; int sort = 0, all = 0;
FcChar8 *format = NULL;
int i; int i;
FcFontSet *fs; FcFontSet *fs;
FcPattern *pat; FcPattern *pat;
...@@ -105,9 +109,9 @@ main (int argc, char **argv) ...@@ -105,9 +109,9 @@ main (int argc, char **argv)
int c; int c;
#if HAVE_GETOPT_LONG #if HAVE_GETOPT_LONG
while ((c = getopt_long (argc, argv, "asVvh", longopts, NULL)) != -1) while ((c = getopt_long (argc, argv, "asvf:Vh", longopts, NULL)) != -1)
#else #else
while ((c = getopt (argc, argv, "asVvh")) != -1) while ((c = getopt (argc, argv, "asvf:Vh")) != -1)
#endif #endif
{ {
switch (c) { switch (c) {
...@@ -117,13 +121,16 @@ main (int argc, char **argv) ...@@ -117,13 +121,16 @@ main (int argc, char **argv)
case 's': case 's':
sort = 1; sort = 1;
break; break;
case 'v':
verbose = 1;
break;
case 'f':
format = (FcChar8 *) strdup (optarg);
break;
case 'V': case 'V':
fprintf (stderr, "fontconfig version %d.%d.%d\n", fprintf (stderr, "fontconfig version %d.%d.%d\n",
FC_MAJOR, FC_MINOR, FC_REVISION); FC_MAJOR, FC_MINOR, FC_REVISION);
exit (0); exit (0);
case 'v':
verbose = 1;
break;
case 'h': case 'h':
usage (argv[0], 0); usage (argv[0], 0);
default: default:
...@@ -189,6 +196,14 @@ main (int argc, char **argv) ...@@ -189,6 +196,14 @@ main (int argc, char **argv)
{ {
FcPatternPrint (fs->fonts[j]); FcPatternPrint (fs->fonts[j]);
} }
else if (format)
{
FcChar8 *s;
s = FcPatternFormat (fs->fonts[j], format);
printf ("%s", s);
free (s);
}
else else
{ {
FcChar8 *family; FcChar8 *family;
......
...@@ -67,6 +67,10 @@ manpage.1: manpage.sgml ...@@ -67,6 +67,10 @@ manpage.1: manpage.sgml
<arg><option>--all</option></arg> <arg><option>--all</option></arg>
<arg><option>--sort</option></arg> <arg><option>--sort</option></arg>
<arg><option>--verbose</option></arg> <arg><option>--verbose</option></arg>
<group>
<arg><option>-f</option> <option><replaceable>format</replaceable></option></arg>
<arg><option>--format</option> <option><replaceable>format</replaceable></option></arg>
</group>
<arg><option>--version</option></arg> <arg><option>--version</option></arg>
<arg><option>--help</option></arg> <arg><option>--help</option></arg>
<arg><option><replaceable>font-pattern</replaceable></option></arg> <arg><option><replaceable>font-pattern</replaceable></option></arg>
...@@ -94,6 +98,23 @@ are printed. The <option>--all</option> option works like ...@@ -94,6 +98,23 @@ are printed. The <option>--all</option> option works like
options is included below.</para> options is included below.</para>
<variablelist> <variablelist>
<varlistentry>
<term><option>-a</option>
<option>--all</option>
</term>
<listitem>
<para>Displays sorted list of best matching fonts, but do not do any
pruning on the list.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-s</option>
<option>--sort</option>
</term>
<listitem>
<para>Displays sorted list of best matching fonts.</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><option>-v</option> <term><option>-v</option>
<option>--verbose</option> <option>--verbose</option>
...@@ -103,11 +124,13 @@ are printed. The <option>--all</option> option works like ...@@ -103,11 +124,13 @@ are printed. The <option>--all</option> option works like
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>-h</option> <term><option>-f</option>
<option>--help</option> <option>--format</option>
<option><replaceable>format</replaceable></option>
</term> </term>
<listitem> <listitem>
<para>Show summary of options.</para> <para>Format output according to the format specifier
<replaceable>format</replaceable>.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
...@@ -119,20 +142,11 @@ are printed. The <option>--all</option> option works like ...@@ -119,20 +142,11 @@ are printed. The <option>--all</option> option works like
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>-a</option> <term><option>-h</option>
<option>--all</option> <option>--help</option>
</term>
<listitem>
<para>Displays sorted list of best matching fonts, but do not do any
pruning on the list.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-s</option>
<option>--sort</option>
</term> </term>
<listitem> <listitem>
<para>Displays sorted list of best matching fonts.</para> <para>Show summary of options.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
...@@ -154,6 +168,9 @@ are printed. The <option>--all</option> option works like ...@@ -154,6 +168,9 @@ are printed. The <option>--all</option> option works like
<command>fc-cache</command>(1) <command>fc-cache</command>(1)
<command>fc-list</command>(1) <command>fc-list</command>(1)
<command>fc-query</command>(1) <command>fc-query</command>(1)
<function>FcFontMatch</function>(3)
<function>FcFontSort</function>(3)
<function>FcPatternFormat</function>(3)
</para> </para>
<para>The fontconfig user's guide, in HTML format: <para>The fontconfig user's guide, in HTML format:
......
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#include <getopt.h> #include <getopt.h>
static const struct option longopts[] = { static const struct option longopts[] = {
{"index", 1, 0, 'i'}, {"index", 1, 0, 'i'},
{"format", 1, 0, 'f'},
{"version", 0, 0, 'V'}, {"version", 0, 0, 'V'},
{"help", 0, 0, 'h'}, {"help", 0, 0, 'h'},
{NULL,0,0,0}, {NULL,0,0,0},
...@@ -69,20 +70,22 @@ usage (char *program, int error) ...@@ -69,20 +70,22 @@ usage (char *program, int error)
{ {
FILE *file = error ? stderr : stdout; FILE *file = error ? stderr : stdout;
#if HAVE_GETOPT_LONG #if HAVE_GETOPT_LONG
fprintf (file, "usage: %s [-Vh] [-i index] [--index index] [--version] [--help] font-file...\n", fprintf (file, "usage: %s [-Vh] [-i index] [-f FORMAT] [--index index] [--format FORMAT] [--version] [--help] font-file...\n",
program); program);
#else #else
fprintf (file, "usage: %s [-Vh] [-i index] font-file...\n", fprintf (file, "usage: %s [-Vh] [-i index] [-f FORMAT] font-file...\n",
program); program);
#endif #endif
fprintf (file, "Query font files and print resulting pattern(s)\n"); fprintf (file, "Query font files and print resulting pattern(s)\n");
fprintf (file, "\n"); fprintf (file, "\n");
#if HAVE_GETOPT_LONG #if HAVE_GETOPT_LONG
fprintf (file, " -i, --index INDEX display the INDEX face of each font file only\n"); fprintf (file, " -i, --index INDEX display the INDEX face of each font file only\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, " -V, --version display font config version and exit\n");
fprintf (file, " -h, --help display this help and exit\n"); fprintf (file, " -h, --help display this help and exit\n");
#else #else
fprintf (file, " -i INDEX (index) display the INDEX face of each font file only\n"); fprintf (file, " -i INDEX (index) display the INDEX face of each font file only\n");
fprintf (file, " -f FORMAT (format) use the given output format\n");
fprintf (file, " -a (all) display unpruned sorted list of matches\n"); fprintf (file, " -a (all) display unpruned sorted list of matches\n");
fprintf (file, " -V (version) display font config version and exit\n"); fprintf (file, " -V (version) display font config version and exit\n");
fprintf (file, " -h (help) display this help and exit\n"); fprintf (file, " -h (help) display this help and exit\n");
...@@ -95,6 +98,7 @@ main (int argc, char **argv) ...@@ -95,6 +98,7 @@ main (int argc, char **argv)
{ {
int index_set = 0; int index_set = 0;
int set_index = 0; int set_index = 0;
FcChar8 *format = NULL;
int err = 0; int err = 0;
int i; int i;
FcBlanks *blanks; FcBlanks *blanks;
...@@ -112,6 +116,9 @@ main (int argc, char **argv) ...@@ -112,6 +116,9 @@ main (int argc, char **argv)
index_set = 1; index_set = 1;
set_index = atoi (optarg); set_index = atoi (optarg);
break; break;
case 'f':
format = (FcChar8 *) strdup (optarg);
break;
case 'V': case 'V':
fprintf (stderr, "fontconfig version %d.%d.%d\n", fprintf (stderr, "fontconfig version %d.%d.%d\n",
FC_MAJOR, FC_MINOR, FC_REVISION); FC_MAJOR, FC_MINOR, FC_REVISION);
...@@ -151,7 +158,19 @@ main (int argc, char **argv) ...@@ -151,7 +158,19 @@ main (int argc, char **argv)
pat = FcFreeTypeQuery ((FcChar8 *) argv[i], index, blanks, &count); pat = FcFreeTypeQuery ((FcChar8 *) argv[i], index, blanks, &count);
if (pat) if (pat)
{ {
FcPatternPrint (pat); if (format)
{
FcChar8 *s;
s = FcPatternFormat (pat, format);
printf ("%s", s);
free (s);
}
else
{
FcPatternPrint (pat);
}
FcPatternDestroy (pat); FcPatternDestroy (pat);
} }
else else
......
...@@ -63,13 +63,17 @@ manpage.1: manpage.sgml ...@@ -63,13 +63,17 @@ manpage.1: manpage.sgml
<command>&dhpackage;</command> <command>&dhpackage;</command>
<arg><option>-Vh</option></arg> <arg><option>-Vh</option></arg>
<arg><option>--version</option></arg>
<arg><option>--help</option></arg>
<sbr> <sbr>
<group> <group>
<arg><option>-i</option> <option><replaceable>index</replaceable></option></arg> <arg><option>-i</option> <option><replaceable>index</replaceable></option></arg>
<arg><option>--index</option> <option><replaceable>index</replaceable></option></arg> <arg><option>--index</option> <option><replaceable>index</replaceable></option></arg>
</group> </group>
<group>
<arg><option>-f</option> <option><replaceable>format</replaceable></option></arg>
<arg><option>--format</option> <option><replaceable>format</replaceable></option></arg>
</group>
<arg><option>--version</option></arg>
<arg><option>--help</option></arg>
<arg choice="req" rep="repeat"><option><replaceable>font-file</replaceable></option></arg> <arg choice="req" rep="repeat"><option><replaceable>font-file</replaceable></option></arg>
</cmdsynopsis> </cmdsynopsis>
...@@ -93,11 +97,23 @@ manpage.1: manpage.sgml ...@@ -93,11 +97,23 @@ manpage.1: manpage.sgml
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><option>-h</option> <term><option>-i</option>
<option>--help</option> <option>--index</option>
<option><replaceable>index</replaceable></option>
</term> </term>
<listitem> <listitem>
<para>Show summary of options.</para> <para>Only query face indexed <replaceable>index</replaceable> of
each file.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-f</option>
<option>--format</option>
<option><replaceable>format</replaceable></option>
</term>
<listitem>
<para>Format output according to the format specifier
<replaceable>format</replaceable>.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
...@@ -109,13 +125,11 @@ manpage.1: manpage.sgml ...@@ -109,13 +125,11 @@ manpage.1: manpage.sgml
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>-i</option> <term><option>-h</option>
<option>--index</option> <option>--help</option>
<option><replaceable>index</replaceable></option>
</term> </term>
<listitem> <listitem>
<para>Only query face indexed <replaceable>index</replaceable> of <para>Show summary of options.</para>
each file.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
...@@ -142,6 +156,8 @@ manpage.1: manpage.sgml ...@@ -142,6 +156,8 @@ manpage.1: manpage.sgml
<command>fc-cache</command>(1) <command>fc-cache</command>(1)
<command>fc-list</command>(1) <command>fc-list</command>(1)
<command>fc-match</command>(1) <command>fc-match</command>(1)
<function>FcFreeTypeQuery</function>(3)
<function>FcPatternFormat</function>(3)
</para> </para>
<para>The fontconfig user's guide, in HTML format: <para>The fontconfig user's guide, in HTML format:
......
...@@ -830,6 +830,9 @@ FcPatternVaBuild (FcPattern *p, va_list va); ...@@ -830,6 +830,9 @@ FcPatternVaBuild (FcPattern *p, va_list va);
FcPublic FcPattern * FcPublic FcPattern *
FcPatternBuild (FcPattern *p, ...) FC_ATTRIBUTE_SENTINEL(0); FcPatternBuild (FcPattern *p, ...) FC_ATTRIBUTE_SENTINEL(0);
FcPublic FcChar8 *
FcPatternFormat (FcPattern *pat, const FcChar8 *format);
/* fcstr.c */ /* fcstr.c */
FcPublic FcChar8 * FcPublic FcChar8 *
......
...@@ -94,6 +94,7 @@ libfontconfig_la_SOURCES = \ ...@@ -94,6 +94,7 @@ libfontconfig_la_SOURCES = \
fcdbg.c \ fcdbg.c \
fcdefault.c \ fcdefault.c \
fcdir.c \ fcdir.c \
fcformat.c \
fcfreetype.c \ fcfreetype.c \
fcfs.c \ fcfs.c \
fcinit.c \ fcinit.c \
......
/*
* Copyright © 2008 Red Hat, Inc.
*
* Red Hat Author(s): Behdad Esfahbod
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include "fcint.h"
#include <stdlib.h>
#include <string.h>