Function: face-font
face-font is a function defined in xfaces.c.
Signature
(face-font FACE &optional FRAME CHARACTER)
Documentation
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.
If FRAME is anything but t, and the optional third argument CHARACTER
is given, return the font name used by FACE for CHARACTER on FRAME.
Source Code
// Defined in /usr/src/emacs/src/xfaces.c
{
if (EQ (frame, Qt))
{
Lisp_Object result = Qnil;
Lisp_Object lface = lface_from_face_name (NULL, face, true);
if (!UNSPECIFIEDP (LFACE_WEIGHT (lface))
&& !EQ (LFACE_WEIGHT (lface), Qnormal))
result = Fcons (Qbold, result);
if (!UNSPECIFIEDP (LFACE_SLANT (lface))
&& !EQ (LFACE_SLANT (lface), Qnormal))
result = Fcons (Qitalic, result);
return result;
}
else
{
struct frame *f = decode_live_frame (frame);
int face_id = lookup_named_face (NULL, f, face, true);
struct face *fface = FACE_FROM_ID_OR_NULL (f, face_id);
if (! fface)
return Qnil;
#ifdef HAVE_WINDOW_SYSTEM
if (FRAME_WINDOW_P (f) && !NILP (character))
{
CHECK_CHARACTER (character);
face_id = FACE_FOR_CHAR (f, fface, XFIXNUM (character), -1, Qnil);
fface = FACE_FROM_ID_OR_NULL (f, face_id);
}
return ((fface && fface->font)
? fface->font->props[FONT_NAME_INDEX]
: Qnil);
#else /* !HAVE_WINDOW_SYSTEM */
return build_string (FRAME_MSDOS_P (f)
? "ms-dos"
: FRAME_W32_P (f) ? "w32term"
:"tty");
#endif
}
}