aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Djärv2009-07-10 17:07:36 +0000
committerJan Djärv2009-07-10 17:07:36 +0000
commite0ab5fcf0422af43346a6726cc445e567f820d30 (patch)
treec59cbe11afd5c4ed9f6b50094227c0b12bd44e18 /src
parentee5a613e68803d53b0a9c86029e0acc1d8baefad (diff)
downloademacs-e0ab5fcf0422af43346a6726cc445e567f820d30.tar.gz
emacs-e0ab5fcf0422af43346a6726cc445e567f820d30.zip
xfns.c (Fx_select_font): Remember last font selected in
x_last_font_name and use that the next time. Also try the frame parameter font-parameter as default to the font dialog.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/xfns.c28
2 files changed, 27 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 42749e66602..a75a48b8b9b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12009-07-10 Jan Djärv <jan.h.d@swipnet.se>
2
3 * xfns.c (Fx_select_font): Remember last font selected in
4 x_last_font_name and use that the next time. Also try the frame
5 parameter font-parameter as default to the font dialog.
6
12009-07-10 Kenichi Handa <handa@m17n.org> 72009-07-10 Kenichi Handa <handa@m17n.org>
2 8
3 * xftfont.c (xftfont_open): Fix typo: FC_RGBA->FC_HINT_STYLE. 9 * xftfont.c (xftfont_open): Fix typo: FC_RGBA->FC_HINT_STYLE.
diff --git a/src/xfns.c b/src/xfns.c
index 4c6aa4210dc..ed068b1ca23 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -208,6 +208,9 @@ extern Lisp_Object Vwindow_system_version;
208int image_cache_refcount, dpyinfo_refcount; 208int image_cache_refcount, dpyinfo_refcount;
209#endif 209#endif
210 210
211#if defined (USE_GTK) && defined (HAVE_FREETYPE)
212char *x_last_font_name;
213#endif
211 214
212 215
213/* Error if we are not connected to X. */ 216/* Error if we are not connected to X. */
@@ -5629,6 +5632,9 @@ If FRAME is omitted or nil, it defaults to the selected frame. */)
5629 FRAME_PTR f = check_x_frame (frame); 5632 FRAME_PTR f = check_x_frame (frame);
5630 char *name; 5633 char *name;
5631 Lisp_Object default_font, font = Qnil; 5634 Lisp_Object default_font, font = Qnil;
5635 Lisp_Object font_param;
5636 char *default_name = NULL;
5637 struct gcpro gcpro1;
5632 int count = SPECPDL_INDEX (); 5638 int count = SPECPDL_INDEX ();
5633 5639
5634 check_x (); 5640 check_x ();
@@ -5642,21 +5648,28 @@ If FRAME is omitted or nil, it defaults to the selected frame. */)
5642 5648
5643 BLOCK_INPUT; 5649 BLOCK_INPUT;
5644 5650
5645 XSETFONT (default_font, FRAME_FONT (f)); 5651 GCPRO1(font_param);
5646 if (FONTP (default_font)) 5652 font_param = Fframe_parameter (frame, Qfont_param);
5653
5654 if (x_last_font_name != NULL)
5655 default_name = x_last_font_name;
5656 else if (STRINGP (font_param))
5657 default_name = SDATA (font_param);
5658 else if (FONTP (default_font))
5647 { 5659 {
5648 char *default_name = alloca (256); 5660 XSETFONT (default_font, FRAME_FONT (f));
5661 default_name = alloca (256);
5649 if (font_unparse_gtkname (default_font, f, default_name, 256) < 0) 5662 if (font_unparse_gtkname (default_font, f, default_name, 256) < 0)
5650 default_name = NULL; 5663 default_name = NULL;
5651 name = xg_get_font_name (f, default_name);
5652 } 5664 }
5653 else 5665
5654 name = xg_get_font_name (f, NULL); 5666 name = xg_get_font_name (f, default_name);
5655 5667
5656 if (name) 5668 if (name)
5657 { 5669 {
5658 font = build_string (name); 5670 font = build_string (name);
5659 xfree (name); 5671 g_free (x_last_font_name);
5672 x_last_font_name = name;
5660 } 5673 }
5661 5674
5662 UNBLOCK_INPUT; 5675 UNBLOCK_INPUT;
@@ -6028,6 +6041,7 @@ the tool bar buttons. */);
6028 6041
6029#if defined (USE_GTK) && defined (HAVE_FREETYPE) 6042#if defined (USE_GTK) && defined (HAVE_FREETYPE)
6030 defsubr (&Sx_select_font); 6043 defsubr (&Sx_select_font);
6044 x_last_font_name = NULL;
6031#endif 6045#endif
6032} 6046}
6033 6047