From 3c1bda5c747e4039b11c7dc897c826885f6400de Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 8 Jul 2018 17:34:35 +0200 Subject: [pango-list] Improve output format Also write out description of each face. This is really broken for free-style style names (as we knew), and very slow, as is O(N^3.log(N)) in the number of fonts... --- utils/pango-list.c | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/utils/pango-list.c b/utils/pango-list.c index 280e2a94..aed5d74b 100644 --- a/utils/pango-list.c +++ b/utils/pango-list.c @@ -48,27 +48,45 @@ main (int argc, int n_faces; const char *family_name = pango_font_family_get_name (families[i]); + g_print ("%s\n", family_name); pango_font_family_list_faces (families[i], &faces, &n_faces); for (j = 0; j < n_faces; j++) { - int *sizes; - int n_sizes; - const char *face_name = pango_font_face_get_face_name (faces[j]); gboolean is_synth = pango_font_face_is_synthesized (faces[j]); const char *synth_str = is_synth ? "*" : ""; - PangoFontDescription *desc = NULL;/*pango_font_face_describe (faces[j]);*/ + g_print (" %s%s\n", synth_str, face_name); + + if (1) + { + int *sizes; + int n_sizes; + pango_font_face_list_sizes (faces[j], &sizes, &n_sizes); + if (n_sizes) + { + g_print (" {"); + for (k = 0; k < n_sizes; k++) + { + if (k) + g_print (","); + g_print ("%g", pango_units_to_double (sizes[k])); + } + g_print ("\n"); + } + g_free (sizes); + } + + if (1) + { + PangoFontDescription *desc = pango_font_face_describe (faces[j]); + char *desc_str = pango_font_description_to_string (desc); - pango_font_face_list_sizes (faces[j], &sizes, &n_sizes); - if (!n_sizes) - g_print ("%s%s, %s\n", synth_str, family_name, face_name); - else - for (k = 0; k < n_sizes; k++) - g_print ("%s%s, %s, %g\n", synth_str, family_name, face_name, pango_units_to_double (sizes[k])); + g_print (" \"%s\"\n", desc_str); - g_free (sizes); - pango_font_description_free (desc); + g_free (desc_str); + pango_font_description_free (desc); + } } g_free (faces); -- cgit v1.2.1