summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2022-07-09 10:18:05 -0400
committerMatthias Clasen <mclasen@redhat.com>2022-07-09 11:39:36 -0400
commit2c59c10084d0d1bf35a00189204bf71c2c72da99 (patch)
tree8fc7cfe64629b9fcf6f76feada099bef37e31392
parenta1eadd9d8f0e5c662ba34f94a9bb998aa2c2c759 (diff)
downloadpango-2c59c10084d0d1bf35a00189204bf71c2c72da99.tar.gz
pango-list: Dump generic families
-rw-r--r--utils/pango-list.c39
1 files changed, 31 insertions, 8 deletions
diff --git a/utils/pango-list.c b/utils/pango-list.c
index 5dd21313..887f3c2d 100644
--- a/utils/pango-list.c
+++ b/utils/pango-list.c
@@ -9,7 +9,7 @@
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
@@ -160,10 +160,33 @@ main (int argc,
if (opt_verbose)
{
+ unsigned int n;
+
+ if (PANGO2_IS_GENERIC_FAMILY (family))
+ {
+ GListModel *fams = pango2_generic_family_get_families (PANGO2_GENERIC_FAMILY (family));
+ n = g_list_model_get_n_items (fams);
+ g_print (" (generic, %d %s)", n, n == 1 ? "family" : "families");
+ g_object_unref (fams);
+ }
+
+ n = g_list_model_get_n_items (G_LIST_MODEL (family));
+ g_print (" (%d %s)", n, n == 1 ? "face" : "faces");
+
if (PANGO2_IS_GENERIC_FAMILY (family))
- g_print ("(generic)");
+ {
+ GListModel *fams = pango2_generic_family_get_families (PANGO2_GENERIC_FAMILY (family));
+
+ for (int i = 0; i < g_list_model_get_n_items (fams); i++)
+ {
+ Pango2FontFamily *f = PANGO2_FONT_FAMILY (g_list_model_get_item (fams, i));
+ g_print ("\n\t%s", pango2_font_family_get_name (f));
+
+ g_object_unref (f);
+ }
- g_print (" (%d faces)", g_list_model_get_n_items (G_LIST_MODEL (family)));
+ g_object_unref (fams);
+ }
}
g_print ("\n");
@@ -173,12 +196,12 @@ main (int argc,
width = 0;
for (j = 0; j < g_list_model_get_n_items (G_LIST_MODEL (family)); j++)
- {
+ {
Pango2FontFace *face = g_list_model_get_item (G_LIST_MODEL (family), j);
- const char *face_name = pango2_font_face_get_name (face);
- gboolean is_synth = pango2_font_face_is_synthesized (face);
- const char *synth_str = is_synth ? "*" : "";
- const char *variable_str = "";
+ const char *face_name = pango2_font_face_get_name (face);
+ gboolean is_synth = pango2_font_face_is_synthesized (face);
+ const char *synth_str = is_synth ? "*" : "";
+ const char *variable_str = "";
width = MAX (width, strlen (synth_str) + strlen (variable_str) + strlen (face_name));
g_object_unref (face);
}