summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-07-16 15:57:46 -0400
committerMatthias Clasen <mclasen@redhat.com>2019-07-16 15:57:46 -0400
commitd3a9da00a66565ac14e971d96aeeb9a143ef5368 (patch)
tree854795e294ba6dfd91e55384ecea4b39fc12877a
parentcfe579c7b325cf3b0950802ed596179960a7e460 (diff)
downloadpango-d3a9da00a66565ac14e971d96aeeb9a143ef5368.tar.gz
pango-list: Add a --verbose option
-rw-r--r--utils/pango-list.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/utils/pango-list.c b/utils/pango-list.c
index 642b09fc..6c6274fe 100644
--- a/utils/pango-list.c
+++ b/utils/pango-list.c
@@ -28,16 +28,39 @@ int
main (int argc,
char **argv)
{
+ gboolean opt_verbose = FALSE;
+ GOptionEntry entries[] = {
+ {"verbose", 0, 0, G_OPTION_ARG_NONE, &opt_verbose, "Print verbose information", NULL },
+ { NULL, }
+ };
+ GOptionContext *context;
PangoFontMap *fontmap;
PangoFontFamily **families;
int n_families;
int i, j, k;
+ GError *error = NULL;
g_set_prgname ("pango-list");
+ context = g_option_context_new ("");
+ g_option_context_add_main_entries (context, entries, NULL);
+ if (!g_option_context_parse (context, &argc, &argv, &error))
+ {
+ if (error != NULL)
+ g_error ("%s", error->message);
+ else
+ g_error ("Option parse error");
+ exit (1);
+ }
+
+ g_option_context_free (context);
+
/* Use PangoCairo to get default fontmap so it works on every platform. */
fontmap = pango_cairo_font_map_get_default ();
+ if (opt_verbose)
+ g_print ("Using %s\n\n", G_OBJECT_TYPE_NAME (fontmap));
+
pango_font_map_list_families (fontmap, &families, &n_families);
for (i = 0; i < n_families; i++)
{