Commit 02ed2ea8 authored by Kenichi Handa's avatar Kenichi Handa

Include "font.h".

(x_default_font_parameter) [USE_FONT_BACKEND]: New function.
(Fx_create_frame) [USE_FONT_BACKEND]: If enable_font_backend is
nonzero, register all available font drivers.  Call
x_default_font_parameter for deciding a font.
(x_create_tip_frame) [USE_FONT_BACKEND]: Likewise.
parent c1c4887e
......@@ -49,6 +49,10 @@ Boston, MA 02110-1301, USA. */
#include "termhooks.h"
#include "atimer.h"
#ifdef USE_FONT_BACKEND
#include "font.h"
#endif /* USE_FONT_BACKEND */
#ifdef HAVE_X_WINDOWS
#include <ctype.h>
......@@ -537,6 +541,8 @@ x_top_window_to_frame (dpyinfo, wdesc)
static void x_default_font_parameter P_ ((struct frame *, Lisp_Object));
static Lisp_Object unwind_create_frame P_ ((Lisp_Object));
static Lisp_Object unwind_create_tip_frame P_ ((Lisp_Object));
......@@ -2958,6 +2964,43 @@ unwind_create_frame (frame)
return Qnil;
}
#ifdef USE_FONT_BACKEND
static void
x_default_font_parameter (f, parms)
struct frame *f;
Lisp_Object parms;
{
struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
Lisp_Object font = x_get_arg (dpyinfo, parms, Qfont, "font", "Font",
RES_TYPE_STRING);
if (! STRINGP (font))
{
char *names[]
= { "-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1",
"-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-1",
"-*-*-medium-r-normal-*-*-140-*-*-c-*-iso8859-1",
/* This was formerly the first thing tried, but it finds
too many fonts and takes too long. */
"-*-*-medium-r-*-*-*-*-*-*-c-*-iso8859-1",
/* If those didn't work, look for something which will
at least work. */
"-*-fixed-*-*-*-*-*-140-*-*-c-*-iso8859-1",
NULL };
int i;
for (i = 0; names[i]; i++)
{
font = font_open_by_name (f, names[i]);
if (! NILP (font))
break;
}
if (NILP (font))
font = build_string ("fixed");
}
x_default_parameter (f, parms, Qfont, font, "font", "Font", RES_TYPE_STRING);
}
#endif /* USE_FONT_BACKEND */
DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
1, 1, 0,
......@@ -3133,8 +3176,32 @@ This function is an internal primitive--use `make-frame' instead. */)
specbind (Qx_resource_name, name);
}
f->resx = dpyinfo->resx;
f->resy = dpyinfo->resy;
#ifdef USE_FONT_BACKEND
if (enable_font_backend)
{
/* Perhaps, we must allow frame parameter, say `font-backend',
to specify which font backends to use. */
#ifdef HAVE_FREETYPE
#ifdef HAVE_XFT
register_font_driver (&xftfont_driver, f);
#else /* not HAVE_XFT */
register_font_driver (&ftxfont_driver, f);
#endif /* not HAVE_XFT */
#endif /* HAVE_FREETYPE */
register_font_driver (&xfont_driver, f);
}
#endif /* USE_FONT_BACKEND */
/* Extract the window parameters from the supplied values
that are needed to determine window geometry. */
#ifdef USE_FONT_BACKEND
if (enable_font_backend)
x_default_font_parameter (f, parms);
else
#endif /* USE_FONT_BACKEND */
{
Lisp_Object font;
......@@ -4719,8 +4786,32 @@ x_create_tip_frame (dpyinfo, parms, text)
specbind (Qx_resource_name, name);
}
f->resx = dpyinfo->resx;
f->resy = dpyinfo->resy;
#ifdef USE_FONT_BACKEND
if (enable_font_backend)
{
/* Perhaps, we must allow frame parameter, say `font-backend',
to specify which font backends to use. */
#ifdef HAVE_FREETYPE
#ifdef HAVE_XFT
register_font_driver (&xftfont_driver, f);
#else /* not HAVE_XFT */
register_font_driver (&ftxfont_driver, f);
#endif /* not HAVE_XFT */
#endif /* HAVE_FREETYPE */
register_font_driver (&xfont_driver, f);
}
#endif /* USE_FONT_BACKEND */
/* Extract the window parameters from the supplied values that are
needed to determine window geometry. */
#ifdef USE_FONT_BACKEND
if (enable_font_backend)
x_default_font_parameter (f, parms);
else
#endif /* USE_FONT_BACKEND */
{
Lisp_Object font;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment