[pango/pango2: 115/168] fc: Don't add empty generic families




commit 5534374839dd62e080553e16502856bb3a2d1971
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]