From d3a9da00a66565ac14e971d96aeeb9a143ef5368 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 16 Jul 2019 15:57:46 -0400 Subject: pango-list: Add a --verbose option --- utils/pango-list.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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++) { -- cgit v1.2.1