Commit c50b7e98 authored by Kenichi Handa's avatar Kenichi Handa
Browse files

(font_open_by_spec): New function.

(font_open_by_name): Use font_open_by_spec.
parent fb930676
2009-03-11 Kenichi Handa <handa@m17n.org> 2009-03-11 Kenichi Handa <handa@m17n.org>
   
* font.c (font_open_by_spec): New function.
(font_open_by_name): Use font_open_by_spec.
* frame.c (x_set_font): When ARG is a font-object, don't alter the * frame.c (x_set_font): When ARG is a font-object, don't alter the
fontset of the frame. fontset of the frame.
   
......
...@@ -3484,20 +3484,16 @@ font_done_for_face (f, face) ...@@ -3484,20 +3484,16 @@ font_done_for_face (f, face)
} }
/* Open a font best matching with NAME on frame F. If no proper font /* Open a font matching with font-spec SPEC on frame F. If no proper
is found, return Qnil. */ font is found, return Qnil. */
Lisp_Object Lisp_Object
font_open_by_name (f, name) font_open_by_spec (f, spec)
FRAME_PTR f; FRAME_PTR f;
char *name; Lisp_Object spec;
{ {
Lisp_Object args[2]; Lisp_Object attrs[LFACE_VECTOR_SIZE];
Lisp_Object spec, attrs[LFACE_VECTOR_SIZE];
args[0] = QCname;
args[1] = make_unibyte_string (name, strlen (name));
spec = Ffont_spec (2, args);
/* We set up the default font-related attributes of a face to prefer /* We set up the default font-related attributes of a face to prefer
a moderate font. */ a moderate font. */
attrs[LFACE_FAMILY_INDEX] = attrs[LFACE_FOUNDRY_INDEX] = Qnil; attrs[LFACE_FAMILY_INDEX] = attrs[LFACE_FOUNDRY_INDEX] = Qnil;
...@@ -3514,6 +3510,24 @@ font_open_by_name (f, name) ...@@ -3514,6 +3510,24 @@ font_open_by_name (f, name)
} }
/* Open a font matching with NAME on frame F. If no proper font is
found, return Qnil. */
Lisp_Object
font_open_by_name (f, name)
FRAME_PTR f;
char *name;
{
Lisp_Object args[2];
Lisp_Object spec;
args[0] = QCname;
args[1] = make_unibyte_string (name, strlen (name));
spec = Ffont_spec (2, args);
return font_open_by_spec (f, spec);
}
/* Register font-driver DRIVER. This function is used in two ways. /* Register font-driver DRIVER. This function is used in two ways.
The first is with frame F non-NULL. In this case, make DRIVER The first is with frame F non-NULL. In this case, make DRIVER
......
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