int face_change_count;
+/* Non-zero means don't display bold text if a face's foreground
+ and background colors are the inverse of the default colors of the
+ display. This is a kluge to suppress `bold black' foreground text
+ which is hard to read on an LCD monitor. */
+
+int tty_suppress_bold_inverse_default_colors_p;
+
/* The total number of colors currently allocated. */
#if GLYPH_DEBUG
static int font_scalable_p P_ ((struct font_name *));
static int get_lface_attributes P_ ((struct frame *, Lisp_Object, Lisp_Object *, int));
static int load_pixmap P_ ((struct frame *, Lisp_Object, unsigned *, unsigned *));
-static char *xstrdup P_ ((char *));
static unsigned char *xstrlwr P_ ((unsigned char *));
static void signal_error P_ ((char *, Lisp_Object));
static struct frame *frame_or_selected_frame P_ ((Lisp_Object, int));
static int xlfd_numeric_value P_ ((struct table_entry *, int, struct font_name *,
int, int));
static Lisp_Object xlfd_symbolic_value P_ ((struct table_entry *, int,
- struct font_name *, int, int));
+ struct font_name *, int,
+ Lisp_Object));
static struct table_entry *xlfd_lookup_field_contents P_ ((struct table_entry *, int,
struct font_name *, int));
#endif /* WINDOWSNT */
-/* Like strdup, but uses xmalloc. */
-
-static char *
-xstrdup (s)
- char *s;
-{
- int len = strlen (s) + 1;
- char *p = (char *) xmalloc (len);
- bcopy (s, p, len);
- return p;
-}
-
-
/* Like stricmp. Used to compare parts of font names which are in
ISO8859-1. */
{
int bytes_per_row = ((XFASTINT (width) + BITS_PER_CHAR - 1)
/ BITS_PER_CHAR);
- if (STRING_BYTES (XSTRING (data)) >= bytes_per_row * height)
+ if (STRING_BYTES (XSTRING (data)) >= bytes_per_row * XINT (height))
pixmap_p = 1;
}
}
int dim;
struct font_name *font;
int field_index;
- int dflt;
+ Lisp_Object dflt;
{
struct table_entry *p;
p = xlfd_lookup_field_contents (table, dim, font, field_index);
return (hash_string_case_insensitive (v[LFACE_FAMILY_INDEX])
^ hash_string_case_insensitive (v[LFACE_FOREGROUND_INDEX])
^ hash_string_case_insensitive (v[LFACE_BACKGROUND_INDEX])
- ^ (unsigned) v[LFACE_WEIGHT_INDEX]
- ^ (unsigned) v[LFACE_SLANT_INDEX]
- ^ (unsigned) v[LFACE_SWIDTH_INDEX]
+ ^ XFASTINT (v[LFACE_WEIGHT_INDEX])
+ ^ XFASTINT (v[LFACE_SLANT_INDEX])
+ ^ XFASTINT (v[LFACE_SWIDTH_INDEX])
^ XFASTINT (v[LFACE_HEIGHT_INDEX]));
}
of frame F. The face will be used to display character C. Value
is the ID of the face found. If no suitable face is found, realize
a new one. In that case, if C is a multibyte character, BASE_FACE
- is a face for ASCII characters that has the same attributes.
-
- When this function is called from face_for_char (in this case, C is
- a multibyte character), a fontset of a face returned by
- realize_face is not yet set, i.e. FACE_SUITABLE_FOR_CHAR_P (FACE,
- C) is not sutisfied. The fontset is set for this face by
- face_for_char later. */
+ is a face for ASCII characters that has the same attributes. */
INLINE int
lookup_face (f, attr, c, base_face)
#if GLYPH_DEBUG
xassert (face == FACE_FROM_ID (f, face->id));
+
+/* When this function is called from face_for_char (in this case, C is
+ a multibyte character), a fontset of a face returned by
+ realize_face is not yet set, i.e. FACE_SUITABLE_FOR_CHAR_P (FACE,
+ C) is not sutisfied. The fontset is set for this face by
+ face_for_char later. */
#if 0
if (FRAME_WINDOW_P (f))
xassert (FACE_SUITABLE_FOR_CHAR_P (face, c));
struct frame *f;
{
int success_p = 0;
+
+ /* Block input there so that we won't be surprised by an X expose
+ event, for instance without having the faces set up. */
+ BLOCK_INPUT;
if (realize_default_face (f))
{
success_p = 1;
}
+ UNBLOCK_INPUT;
return success_p;
}
/* Insert the new face. */
cache_face (cache, face, lface_hash (attrs));
#ifdef HAVE_WINDOW_SYSTEM
- if (FRAME_X_P (cache->f) && face->font == NULL)
+ if (FRAME_WINDOW_P (cache->f) && face->font == NULL)
load_face_font (cache->f, face, c);
#endif /* HAVE_WINDOW_SYSTEM */
return face;
struct face *face;
int weight, slant;
Lisp_Object color;
- Lisp_Object tty_defined_color_alist =
- Fsymbol_value (intern ("tty-defined-color-alist"));
+ Lisp_Object tty_defined_color_alist
+ = find_symbol_value (intern ("tty-defined-color-alist"));
Lisp_Object tty_color_alist = intern ("tty-color-alist");
Lisp_Object frame;
int face_colors_defaulted = 0;
color = attrs[LFACE_FOREGROUND_INDEX];
if (STRINGP (color)
&& XSTRING (color)->size
- && !NILP (tty_defined_color_alist)
+ && CONSP (tty_defined_color_alist)
&& (color = Fassoc (color, call1 (tty_color_alist, frame)),
CONSP (color)))
/* Associations in tty-defined-color-alist are of the form
color = attrs[LFACE_BACKGROUND_INDEX];
if (STRINGP (color)
&& XSTRING (color)->size
- && !NILP (tty_defined_color_alist)
+ && CONSP (tty_defined_color_alist)
&& (color = Fassoc (color, call1 (tty_color_alist, frame)),
CONSP (color)))
/* Associations in tty-defined-color-alist are of the form
face->background = tem;
}
+ if (tty_suppress_bold_inverse_default_colors_p
+ && face->tty_bold_p
+ && face->background == FACE_TTY_DEFAULT_FG_COLOR
+ && face->foreground == FACE_TTY_DEFAULT_BG_COLOR)
+ face->tty_bold_p = 0;
+
return face;
}
+DEFUN ("tty-suppress-bold-inverse-default-colors",
+ Ftty_suppress_bold_inverse_default_colors,
+ Stty_suppress_bold_inverse_default_colors, 1, 1, 0,
+ "Suppress/allow boldness of faces with inverse default colors.\n\
+SUPPRESS non-nil means suppress it.\n\
+This affects bold faces on TTYs whose foreground is the default background\n\
+color of the display and whose background is the default foreground color.\n\
+For such faces, no bold text will be displayed.")
+ (suppress)
+ Lisp_Object suppress;
+{
+ tty_suppress_bold_inverse_default_colors_p = !NILP (suppress);
+ ++face_change_count;
+ return suppress;
+}
+
+
\f
/***********************************************************************
Computing Faces
defsubr (&Sshow_face_resources);
#endif /* GLYPH_DEBUG */
defsubr (&Sclear_face_cache);
+ defsubr (&Stty_suppress_bold_inverse_default_colors);
DEFVAR_LISP ("font-list-limit", &Vfont_list_limit,
"*Limit for font matching.\n\