[gtk+] GtkFontChooser: Prevent font fallback in the preview



commit 0f9fc277c2a8175fe1e8fc9b0884b43d08bc4b79
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Aug 15 17:29:34 2014 -0400

    GtkFontChooser: Prevent font fallback in the preview
    
    We don't want to preview the fallback fonts, after all.
    https://bugzilla.gnome.org/show_bug.cgi?id=570414

 gtk/gtkfontchooserwidget.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c
index e7d347d..f184316 100644
--- a/gtk/gtkfontchooserwidget.c
+++ b/gtk/gtkfontchooserwidget.c
@@ -540,6 +540,7 @@ static void
 gtk_font_chooser_widget_init (GtkFontChooserWidget *fontchooser)
 {
   GtkFontChooserWidgetPrivate *priv;
+  PangoAttrList *attrs;
 
   fontchooser->priv = gtk_font_chooser_widget_get_instance_private (fontchooser);
   priv = fontchooser->priv;
@@ -552,8 +553,14 @@ gtk_font_chooser_widget_init (GtkFontChooserWidget *fontchooser)
   priv->font_desc = pango_font_description_new ();
 
   /* Set default preview text */
-  gtk_entry_set_text (GTK_ENTRY (priv->preview),
-                      pango_language_get_sample_string (NULL));
+  gtk_entry_set_text (GTK_ENTRY (priv->preview), priv->preview_text);
+
+  /* Prevent font fallback */
+  attrs = pango_attr_list_new ();
+  pango_attr_list_insert (attrs, pango_attr_fallback_new (FALSE));
+  gtk_entry_set_attributes (GTK_ENTRY (priv->preview), attrs);
+  pango_attr_list_unref (attrs);
+
   gtk_widget_add_events (priv->preview, GDK_SCROLL_MASK);
 
   /* Set the upper values of the spin/scale with G_MAXINT / PANGO_SCALE */


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