[pango/pango2: 25/44] fc: Don't add empty generic families




commit a3344271ea1f5176fa23400c3a49818decd1d72c
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Jun 14 21:37:48 2022 -0400

    fc: Don't add empty generic families
    
    Those are harmful, since they make us think
    that we have a generic family, when really,
    we don't.

 pango/pangofc-fontmap.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c
index 9ac45f1a..1bae2744 100644
--- a/pango/pangofc-fontmap.c
+++ b/pango/pangofc-fontmap.c
@@ -494,7 +494,10 @@ pango_fc_font_map_populate (PangoFontMap *map)
       FcPatternDestroy (pattern);
       g_hash_table_unref (families_hash);
 
-      pango_font_map_add_family (map, PANGO_FONT_FAMILY (generic_family));
+      if (g_list_model_get_n_items (G_LIST_MODEL (generic_family)) > 0)
+        pango_font_map_add_family (map, PANGO_FONT_FAMILY (generic_family));
+      else
+        g_object_unref (generic_family);
     }
 
   FcLangSetDestroy (no_langs);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]