From 51b592fb337528c8e5c14376d4ff9e08db43b868 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 24 Aug 1996 00:03:22 +0000 Subject: [PATCH] (x_term_init): If the default Xt font does not exist on the X server, add a resource so that dialog boxes use a common font. --- src/xterm.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/xterm.c b/src/xterm.c index 5dfffb0ef8e..78c427bf904 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -6108,6 +6108,30 @@ x_term_init (display_name, xrm_option, resource_name) init_sigio (connection); #endif /* ! defined (SIGIO) */ +#ifdef USE_LUCID + /* Make sure that we have a valid font for dialog boxes + so that Xt does not crash. */ + { + Display *dpy = dpyinfo->display; + XrmValue d, fr, to; + Font font; + + d.addr = (XPointer)&dpy; + d.size = sizeof (Display *); + fr.addr = XtDefaultFont; + fr.size = sizeof (XtDefaultFont); + to.size = sizeof (Font *); + to.addr = (XPointer)&font; + x_catch_errors (dpy); + if (!XtCallConverter (dpy, XtCvtStringToFont, &d, 1, &fr, &to, NULL)) + abort (); + if (x_had_errors_p (dpy) || !XQueryFont (dpy, font)) + XrmPutLineResource (&xrdb, "Emacs.dialog.*.font: 9x15"); + x_uncatch_errors (dpy); + } +#endif + + UNBLOCK_INPUT; return dpyinfo; -- 2.39.2