[gtk/wip-fontchooser-tewaks] fontchooser: Be more careful about fonts




commit 98145b1fcb1507961a0a7c19d5da87106059e005
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jan 2 09:50:11 2022 -0500

    fontchooser: Be more careful about fonts
    
    When we show examples for OpenType features, we use
    U+27F6 RIGHTWARDS ARROW, so we should make sure that the
    fonts we use have some chance of covering that codepoint.
    In the past, we implicitly relied on pangos fontconfig
    backend always providing fontsets with 'infinite' coverage.
    Other backends may not be so forgiving. Increase our
    chances of avoiding hexboxes by appending the generic
    sans-serif family at the end.

 gtk/gtkfontchooserwidget.c | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c
index d7e7d3fef7..91630e0f17 100644
--- a/gtk/gtkfontchooserwidget.c
+++ b/gtk/gtkfontchooserwidget.c
@@ -1961,6 +1961,9 @@ update_feature_example (GtkFontChooserWidget *fontchooser,
 
           desc = pango_font_description_copy (font_desc);
           pango_font_description_unset_fields (desc, PANGO_FONT_MASK_SIZE);
+          str = g_strconcat (pango_font_description_get_family (desc), ",", "sans-serif", NULL);
+          pango_font_description_set_family (desc, str);
+          g_free (str);
           pango_attr_list_insert (attrs, pango_attr_font_desc_new (desc));
           pango_font_description_free (desc);
           str = g_strconcat (item->name, " 0", NULL);


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