]>
git.wh0rd.org - fontconfig.git/blob - fc-list/fc-list.c
1d2d67b30b5ceed878011414826013616b949631
4 * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
6 * Permission to use, copy, modify, distribute, and sell this software and its
7 * documentation for any purpose is hereby granted without fee, provided that
8 * the above copyright notice appear in all copies and that both that
9 * copyright notice and this permission notice appear in supporting
10 * documentation, and that the name of Keith Packard not be used in
11 * advertising or publicity pertaining to distribution of the software without
12 * specific, written prior permission. Keith Packard makes no
13 * representations about the suitability of this software for any purpose. It
14 * is provided "as is" without express or implied warranty.
16 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22 * PERFORMANCE OF THIS SOFTWARE.
25 #include <fontconfig/fontconfig.h>
38 const struct option longopts
[] = {
39 {"version", 0, 0, 'V'},
40 {"verbose", 0, 0, 'v'},
47 extern int optind
, opterr
, optopt
;
51 static void usage (char *program
)
53 fprintf (stderr
, "usage: %s [-vV?] [--verbose] [--version] [--help] [dirs]\n",
55 fprintf (stderr
, "Build font information caches in [dirs]\n"
56 "(all directories in font configuration by default).\n");
57 fprintf (stderr
, "\n");
58 fprintf (stderr
, " -v, --verbose display status information while busy\n");
59 fprintf (stderr
, " -V, --version display font config version and exit\n");
60 fprintf (stderr
, " -?, --help display this help and exit\n");
65 main (int argc
, char **argv
)
69 FcObjectSet
*os
= FcObjectSetBuild (FC_FAMILY
, FC_LANG
, 0);
72 #if HAVE_GETOPT_LONG || HAVE_GETOPT
76 while ((c
= getopt_long (argc
, argv
, "Vv?", longopts
, NULL
)) != -1)
78 while ((c
= getopt (argc
, argv
, "Vv?")) != -1)
83 fprintf (stderr
, "fontconfig version %d.%d.%d\n",
84 FC_MAJOR
, FC_MINOR
, FC_REVISION
);
100 fprintf (stderr
, "Can't init font config library\n");
104 pat
= FcNameParse (argv
[i
]);
106 pat
= FcPatternCreate ();
108 fs
= FcFontList (0, pat
, os
);
110 FcPatternDestroy (pat
);
116 for (j
= 0; j
< fs
->nfont
; j
++)
120 font
= FcNameUnparse (fs
->fonts
[j
]);
121 printf ("%s\n", font
);
124 FcFontSetDestroy (fs
);