summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2008-06-10 20:56:58 +0000
committerChong Yidong <cyd@stupidchicken.com>2008-06-10 20:56:58 +0000
commit9bf80974813dbad1f95dae3116e29bbaf42a213d (patch)
tree5b958904976503de69283fd447248e1750069721
parent3402c0a6f1ced295fd038dd41d361024da087cfd (diff)
downloademacs-9bf80974813dbad1f95dae3116e29bbaf42a213d.tar.gz
(Fx_font_dialog): New function.
-rw-r--r--src/xfns.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/xfns.c b/src/xfns.c
index 875c1599fe5..df350a36e93 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -5628,6 +5628,47 @@ directories. */)
return unbind_to (count, decoded_file);
}
+
+#ifdef HAVE_FREETYPE
+
+DEFUN ("x-font-dialog", Fx_font_dialog, Sx_font_dialog, 0, 0, 0,
+ doc: /* Read a font name using a font selection dialog.
+The font name is returned as a string. */)
+ ()
+{
+ FRAME_PTR f = SELECTED_FRAME ();
+ char *fontname;
+ Lisp_Object font = Qnil;
+ int count = SPECPDL_INDEX ();
+
+ check_x ();
+
+ if (popup_activated ())
+ error ("Trying to use a menu from within a menu-entry");
+
+ /* Prevent redisplay. */
+ specbind (Qinhibit_redisplay, Qt);
+ record_unwind_protect (clean_up_dialog, Qnil);
+
+ BLOCK_INPUT;
+
+ fontname = xg_get_font_name (f, NULL);
+
+ if (fontname)
+ {
+ font = build_string (fontname);
+ xfree (fontname);
+ }
+
+ UNBLOCK_INPUT;
+
+ if (NILP (font))
+ Fsignal (Qquit, Qnil);
+
+ return unbind_to (count, font);
+}
+#endif /* HAVE_FREETYPE */
+
#endif /* USE_GTK */
@@ -5993,6 +6034,10 @@ the tool bar buttons. */);
#if defined (USE_MOTIF) || defined (USE_GTK)
defsubr (&Sx_file_dialog);
#endif
+
+#ifdef USE_GTK
+ defsubr (&Sx_font_dialog);
+#endif
}
#endif /* HAVE_X_WINDOWS */