]> code.delx.au - gnu-emacs/blobdiff - src/xfaces.c
*** empty log message ***
[gnu-emacs] / src / xfaces.c
index bbe0d954b99fe1b4c6060686dd008bab4acfca9f..173c0b45c585f2d9f762241e7d1a8a08b70db37e 100644 (file)
@@ -410,6 +410,13 @@ static int clear_font_table_count;
 
 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
@@ -499,7 +506,8 @@ static int xlfd_fixed_p P_ ((struct font_name *));
 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));
 
@@ -1008,7 +1016,7 @@ the pixmap.  Bits are stored row by row, each row occupies\n\
        {
          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;
        }
     }
@@ -1824,7 +1832,7 @@ xlfd_symbolic_value (table, dim, font, field_index, dflt)
      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);
@@ -4455,9 +4463,9 @@ lface_hash (v)
   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]));
 }
 
@@ -5585,6 +5593,10 @@ realize_basic_faces (f)
      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))
     {
@@ -5600,6 +5612,7 @@ realize_basic_faces (f)
       success_p = 1;
     }
 
+  UNBLOCK_INPUT;
   return success_p;
 }
 
@@ -5783,7 +5796,7 @@ realize_face (cache, attrs, c, base_face, former_face_id)
   /* 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;
@@ -6148,10 +6161,33 @@ realize_tty_face (cache, attrs, c)
       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
@@ -6664,6 +6700,7 @@ syms_of_xfaces ()
   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\