changeset 95974:337a71ccee89

(Fx_select_font): Give GTK font dialog the default font name.
author Chong Yidong <cyd@stupidchicken.com>
date Sun, 15 Jun 2008 19:42:53 +0000
parents a46630597077
children 87c7c322ae9e
files src/xfns.c
diffstat 1 files changed, 16 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/xfns.c	Sun Jun 15 19:42:31 2008 +0000
+++ b/src/xfns.c	Sun Jun 15 19:42:53 2008 +0000
@@ -5645,8 +5645,8 @@
      Lisp_Object frame, ignored;
 {
   FRAME_PTR f = check_x_frame (frame);
-  char *fontname;
-  Lisp_Object font = Qnil;
+  char *name;
+  Lisp_Object default_font, font = Qnil;
   int count = SPECPDL_INDEX ();
 
   check_x ();
@@ -5660,12 +5660,21 @@
 
   BLOCK_INPUT;
 
-  fontname = xg_get_font_name (f, NULL);
-
-  if (fontname)
+  XSETFONT (default_font, FRAME_FONT (f));
+  if (FONTP (default_font))
     {
-      font = build_string (fontname);
-      xfree (fontname);
+      char *default_name = alloca (256);
+      if (font_unparse_gtkname (default_font, f, default_name, 256) < 0)
+	default_name = NULL;
+      name = xg_get_font_name (f, default_name);
+    }
+  else
+    name = xg_get_font_name (f, NULL);
+
+  if (name)
+    {
+      font = build_string (name);
+      xfree (name);
     }
 
   UNBLOCK_INPUT;