From: Kenichi Handa Date: Wed, 3 Mar 2004 12:33:33 +0000 (+0000) Subject: (Fface_font): New optional arg CHARACTER. X-Git-Tag: emacs-pretest-23.0.90~8295^2~1513 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2db4bfe529071f0113d4e8660d2872d09e365fba;p=emacs.git (Fface_font): New optional arg CHARACTER. --- diff --git a/src/xfaces.c b/src/xfaces.c index 84a43b59ec6..f0444b1c4e3 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -4860,15 +4860,18 @@ Default face attributes override any local face attributes. */) return fonts with the same size as the font of a face. This is done in fontset.el. */ -DEFUN ("face-font", Fface_font, Sface_font, 1, 2, 0, +DEFUN ("face-font", Fface_font, Sface_font, 1, 3, 0, doc: /* Return the font name of face FACE, or nil if it is unspecified. +The font name is, by default, for ASCII characters. If the optional argument FRAME is given, report on face FACE in that frame. If FRAME is t, report on the defaults for face FACE (for new frames). The font default for a face is either nil, or a list of the form (bold), (italic) or (bold italic). -If FRAME is omitted or nil, use the selected frame. */) - (face, frame) - Lisp_Object face, frame; +If FRAME is omitted or nil, use the selected frame. And, in this case, +if the optional third argument CHARACTER is given, +return the font name used for CHARACTER. */) + (face, frame, character) + Lisp_Object face, frame, character; { if (EQ (frame, Qt)) { @@ -4890,7 +4893,17 @@ If FRAME is omitted or nil, use the selected frame. */) struct frame *f = frame_or_selected_frame (frame, 1); int face_id = lookup_named_face (f, face); struct face *face = FACE_FROM_ID (f, face_id); - return face ? build_string (face->font_name) : Qnil; + + if (! face) + return Qnil; + if (NILP (character)) + return build_string (face->font_name); + CHECK_CHARACTER (character); + face_id = FACE_FOR_CHAR (f, face, XINT (character), -1, Qnil); + face = FACE_FROM_ID (f, face_id); + return (face->font && face->font_name + ? build_string (face->font_name) + : Qnil); } }