[Top][All Lists]

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

master b6db2ed: Remember the full GTK font description

From: Robert Pluim
Subject: master b6db2ed: Remember the full GTK font description
Date: Tue, 19 Nov 2019 07:42:26 -0500 (EST)

branch: master
commit b6db2ed1ea5d29dbd31871972d702739e88d3818
Author: Robert Pluim <address@hidden>
Commit: Robert Pluim <address@hidden>

    Remember the full GTK font description
    Remember the full font description instead of just the family so that
    size/style/weight settings are preserved.
    * gtkutil.c (xg_get_font) [HAVE_GTK3]: Use the pango font
    description to set/get the current font (Bug#28901).
 src/gtkutil.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/gtkutil.c b/src/gtkutil.c
index 25ef5dd..cf5c31a 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -2282,7 +2282,16 @@ xg_get_font (struct frame *f, const char *default_name)
     default_name = x_last_font_name;
   if (default_name)
-    gtk_font_chooser_set_font (GTK_FONT_CHOOSER (w), default_name);
+    {
+#ifdef HAVE_GTK3
+      PangoFontDescription *desc
+        = pango_font_description_from_string (default_name);
+      gtk_font_chooser_set_font_desc (GTK_FONT_CHOOSER (w), desc);
+      pango_font_description_free (desc);
+      gtk_font_chooser_set_font (GTK_FONT_CHOOSER (w), default_name);
+    }
   gtk_widget_set_name (w, "emacs-fontdialog");
   done = xg_dialog_run (f, w);
@@ -2306,8 +2315,10 @@ xg_get_font (struct frame *f, const char *default_name)
                        QCweight, XG_WEIGHT_TO_SYMBOL (weight),
                        QCslant, XG_STYLE_TO_SYMBOL (style));
+          char *font_desc_str = pango_font_description_to_string (desc);
+          dupstring (&x_last_font_name, font_desc_str);
+          g_free (font_desc_str);
          pango_font_description_free (desc);
-         dupstring (&x_last_font_name, family);
 #else /* Use old font selector, which just returns the font name.  */

reply via email to

[Prev in Thread] Current Thread [Next in Thread]