diff options
| author | Kenichi Handa | 2004-03-03 12:33:33 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2004-03-03 12:33:33 +0000 |
| commit | 2db4bfe529071f0113d4e8660d2872d09e365fba (patch) | |
| tree | effe7aa41c1ec93349513ff59792f2dcd4fdb67c | |
| parent | 3ea7ac3c5a2247a719a2b512a225f1b42afd5ede (diff) | |
| download | emacs-2db4bfe529071f0113d4e8660d2872d09e365fba.tar.gz emacs-2db4bfe529071f0113d4e8660d2872d09e365fba.zip | |
(Fface_font): New optional arg CHARACTER.
| -rw-r--r-- | src/xfaces.c | 23 |
1 files changed, 18 insertions, 5 deletions
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. */) | |||
| 4860 | return fonts with the same size as the font of a face. This is | 4860 | return fonts with the same size as the font of a face. This is |
| 4861 | done in fontset.el. */ | 4861 | done in fontset.el. */ |
| 4862 | 4862 | ||
| 4863 | DEFUN ("face-font", Fface_font, Sface_font, 1, 2, 0, | 4863 | DEFUN ("face-font", Fface_font, Sface_font, 1, 3, 0, |
| 4864 | doc: /* Return the font name of face FACE, or nil if it is unspecified. | 4864 | doc: /* Return the font name of face FACE, or nil if it is unspecified. |
| 4865 | The font name is, by default, for ASCII characters. | ||
| 4865 | If the optional argument FRAME is given, report on face FACE in that frame. | 4866 | If the optional argument FRAME is given, report on face FACE in that frame. |
| 4866 | If FRAME is t, report on the defaults for face FACE (for new frames). | 4867 | If FRAME is t, report on the defaults for face FACE (for new frames). |
| 4867 | The font default for a face is either nil, or a list | 4868 | The font default for a face is either nil, or a list |
| 4868 | of the form (bold), (italic) or (bold italic). | 4869 | of the form (bold), (italic) or (bold italic). |
| 4869 | If FRAME is omitted or nil, use the selected frame. */) | 4870 | If FRAME is omitted or nil, use the selected frame. And, in this case, |
| 4870 | (face, frame) | 4871 | if the optional third argument CHARACTER is given, |
| 4871 | Lisp_Object face, frame; | 4872 | return the font name used for CHARACTER. */) |
| 4873 | (face, frame, character) | ||
| 4874 | Lisp_Object face, frame, character; | ||
| 4872 | { | 4875 | { |
| 4873 | if (EQ (frame, Qt)) | 4876 | if (EQ (frame, Qt)) |
| 4874 | { | 4877 | { |
| @@ -4890,7 +4893,17 @@ If FRAME is omitted or nil, use the selected frame. */) | |||
| 4890 | struct frame *f = frame_or_selected_frame (frame, 1); | 4893 | struct frame *f = frame_or_selected_frame (frame, 1); |
| 4891 | int face_id = lookup_named_face (f, face); | 4894 | int face_id = lookup_named_face (f, face); |
| 4892 | struct face *face = FACE_FROM_ID (f, face_id); | 4895 | struct face *face = FACE_FROM_ID (f, face_id); |
| 4893 | return face ? build_string (face->font_name) : Qnil; | 4896 | |
| 4897 | if (! face) | ||
| 4898 | return Qnil; | ||
| 4899 | if (NILP (character)) | ||
| 4900 | return build_string (face->font_name); | ||
| 4901 | CHECK_CHARACTER (character); | ||
| 4902 | face_id = FACE_FOR_CHAR (f, face, XINT (character), -1, Qnil); | ||
| 4903 | face = FACE_FROM_ID (f, face_id); | ||
| 4904 | return (face->font && face->font_name | ||
| 4905 | ? build_string (face->font_name) | ||
| 4906 | : Qnil); | ||
| 4894 | } | 4907 | } |
| 4895 | } | 4908 | } |
| 4896 | 4909 | ||