color_def->green = 0;
if (*color_name)
- status = tty_lookup_color (f, build_string (color_name), color_def, 0);
+ status = tty_lookup_color (f, build_string (color_name), color_def, NULL);
if (color_def->pixel == FACE_TTY_DEFAULT_COLOR && *color_name)
{
static INLINE int
face_numeric_value (table, dim, symbol)
struct table_entry *table;
- int dim;
+ size_t dim;
Lisp_Object symbol;
{
struct table_entry *p = face_value (table, dim, symbol);
72dpi versions, only.)
Value is the real point size of FONT on frame F, or 0 if it cannot
- be determined. */
+ be determined.
+
+ By side effect, set FONT->numeric[XLFD_PIXEL_SIZE]. */
static INLINE int
xlfd_point_size (f, font)
else
pixel = atoi (pixel_field);
+ font->numeric[XLFD_PIXEL_SIZE] = pixel;
if (pixel == 0)
real_pt = 0;
else
LFACE_SLANT (lface)
= have_xlfd_p ? xlfd_symbolic_slant (&font) : Qnormal;
- if (fontset)
+ if (fontset > 0)
{
LFACE_FONT (lface) = build_string (font_info->full_name);
LFACE_FONTSET (lface) = fontset_name (fontset);
}
else
- LFACE_FONT (lface) = fontname;
+ {
+ LFACE_FONT (lface) = fontname;
+ fontset
+ = new_fontset_from_font_name (build_string (font_info->full_name));
+ LFACE_FONTSET (lface) = fontset_name (fontset);
+ }
return 1;
}
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))
{
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);
}
}
Lisp_Object face1, face2, frame;
{
int equal_p;
- struct frame *f;
Lisp_Object lface1, lface2;
- if (EQ (frame, Qt))
- f = NULL;
- else
- /* Don't use check_x_frame here because this function is called
- before X frames exist. At that time, if FRAME is nil,
- selected_frame will be used which is the frame dumped with
- Emacs. That frame is not an X frame. */
- f = frame_or_selected_frame (frame, 2);
-
lface1 = lface_from_face_name (NULL, face1, 1);
lface2 = lface_from_face_name (NULL, face2, 1);
equal_p = lface_equal_p (XVECTOR (lface1)->contents,
double resy = FRAME_X_DISPLAY_INFO (f)->resy;
double pt;
+ if (font->numeric[XLFD_PIXEL_SIZE] != 0
+ || font->numeric[XLFD_POINT_SIZE] != 0)
+ /* This is a scalable font but is requested for a specific size.
+ We should not change that size. */
+ return build_font_name (font);
+
/* If scalable font is for a specific resolution, compute
the point size we must specify from the resolution of
the display and the specified resolution of the font. */
int nfonts = 0;
if (STRINGP (pattern))
- nfonts = font_list (f, pattern, Qnil, Qnil, fonts);
+ {
+ nfonts = font_list (f, pattern, Qnil, Qnil, fonts);
+ if (nfonts == 0 && ! EQ (Vscalable_fonts_allowed, Qt))
+ {
+ int count = SPECPDL_INDEX ();
+ specbind (Qscalable_fonts_allowed, Qt);
+ nfonts = font_list (f, pattern, Qnil, Qnil, fonts);
+ unbind_to (count, Qnil);
+ }
+ }
else
{
Lisp_Object tail;
if (NILP (prop))
{
struct face *face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
- face_id = FACE_FOR_CHAR (f, face, ch);
+ face_id = FACE_FOR_CHAR (f, face, ch, -1, Qnil);
}
else
{
if (! ASCII_CHAR_P (ch))
{
face = FACE_FROM_ID (f, face_id);
- face_id = FACE_FOR_CHAR (f, face, ch);
+ face_id = FACE_FOR_CHAR (f, face, ch, -1, Qnil);
}
}