changeset 58439:b1e7465ce5fc

(lookup_named_face): Add signal_p arg. Return -1 if signal_p is zero and face name is unknown. (Fx_list_fonts): Don't signal error in lookup_named_face. (Fface_font): Signal error in lookup_named_face. (ascii_face_of_lisp_face): Likewise.
author Kim F. Storm <storm@cua.dk>
date Mon, 22 Nov 2004 23:25:49 +0000
parents ae63c87be5eb
children 9c19dd9a3b68
files src/xfaces.c
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/xfaces.c	Mon Nov 22 23:25:11 2004 +0000
+++ b/src/xfaces.c	Mon Nov 22 23:25:49 2004 +0000
@@ -3009,7 +3009,7 @@
     {
       /* This is of limited utility since it works with character
 	 widths.  Keep it for compatibility.  --gerd.  */
-      int face_id = lookup_named_face (f, face, 0);
+      int face_id = lookup_named_face (f, face, 0, 0);
       struct face *face = (face_id < 0
 			   ? NULL
 			   : FACE_FROM_ID (f, face_id));
@@ -4923,7 +4923,7 @@
   else
     {
       struct frame *f = frame_or_selected_frame (frame, 1);
-      int face_id = lookup_named_face (f, face, 0);
+      int face_id = lookup_named_face (f, face, 0, 1);
       struct face *face = FACE_FROM_ID (f, face_id);
       return face ? build_string (face->font_name) : Qnil;
     }
@@ -5615,10 +5615,11 @@
    isn't realized and cannot be realized.  */
 
 int
-lookup_named_face (f, symbol, c)
+lookup_named_face (f, symbol, c, signal_p)
      struct frame *f;
      Lisp_Object symbol;
      int c;
+     int signal_p;
 {
   Lisp_Object attrs[LFACE_VECTOR_SIZE];
   Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE];
@@ -5631,7 +5632,9 @@
       default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
     }
 
-  get_lface_attributes (f, symbol, symbol_attrs, 1);
+  if (!get_lface_attributes (f, symbol, symbol_attrs, signal_p))
+    return -1;
+
   bcopy (default_face->lface, attrs, sizeof attrs);
   merge_face_vectors (f, symbol_attrs, attrs, 0);
 
@@ -5652,7 +5655,7 @@
   if (lface_id >= 0 && lface_id < lface_id_to_name_size)
     {
       Lisp_Object face_name = lface_id_to_name[lface_id];
-      face_id = lookup_named_face (f, face_name, 0);
+      face_id = lookup_named_face (f, face_name, 0, 1);
     }
   else
     face_id = -1;