From: Chong Yidong Date: Sun, 15 Jun 2008 19:42:53 +0000 (+0000) Subject: (Fx_select_font): Give GTK font dialog the default font name. X-Git-Tag: emacs-pretest-23.0.90~4754 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=53c7540dc3fe0288fe55d8e569de497d70cb0684;p=emacs.git (Fx_select_font): Give GTK font dialog the default font name. --- diff --git a/src/xfns.c b/src/xfns.c index 8d4b105ea8f..57b14d3f9d2 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -5645,8 +5645,8 @@ If FRAME is omitted or nil, it defaults to the selected frame. */) 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 @@ If FRAME is omitted or nil, it defaults to the selected frame. */) BLOCK_INPUT; - fontname = xg_get_font_name (f, NULL); + XSETFONT (default_font, FRAME_FONT (f)); + if (FONTP (default_font)) + { + 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 (fontname) + if (name) { - font = build_string (fontname); - xfree (fontname); + font = build_string (name); + xfree (name); } UNBLOCK_INPUT;