[pango/pango2: 114/178] fc: Don't add empty generic families




commit 8a0f7b51dc72c9b9baf7671f2bac519ce1bb29bb
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 9ac45f1ae..1bae2744b 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]