summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerd Moellmann <gerd@gnu.org>2000-11-07 13:18:15 +0000
committerGerd Moellmann <gerd@gnu.org>2000-11-07 13:18:15 +0000
commitb5de343d74c4cbc9a2d8d82667aa5caeb53da392 (patch)
treeda014bb91e719e110ec48e66c4e5ecbe08401c53
parentf620908e1cc756cd23a299599d21d478d55c3cd4 (diff)
downloademacs-b5de343d74c4cbc9a2d8d82667aa5caeb53da392.tar.gz
(lookup_named_face): If default face isn't realized,
try to realize it. Return -1 if not successful. (Fx_list_fonts): Handle case that face cannot be determined. (Fface_font): Likewise.
-rw-r--r--src/ChangeLog7
-rw-r--r--src/xfaces.c22
2 files changed, 24 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index e49e7b346ce..bbc015195e7 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
+2000-11-07 Gerd Moellmann <gerd@gnu.org>
+
+ * xfaces.c (lookup_named_face): If default face isn't realized,
+ try to realize it. Return -1 if not successful.
+ (Fx_list_fonts): Handle case that face cannot be determined.
+ (Fface_font): Likewise.
+
2000-11-06 Gerd Moellmann <gerd@gnu.org>
* window.c (displayed_window_lines): Detect partially
diff --git a/src/xfaces.c b/src/xfaces.c
index b88f037209e..a9066a619cc 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -2726,9 +2726,11 @@ the WIDTH times as wide as FACE on FRAME.")
/* 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);
- struct face *face = FACE_FROM_ID (f, face_id);
+ struct face *face = (face_id < 0
+ ? NULL
+ : FACE_FROM_ID (f, face_id));
- if (face->font)
+ if (face && face->font)
size = FONT_WIDTH (face->font);
else
size = FONT_WIDTH (FRAME_FONT (f));
@@ -4650,7 +4652,7 @@ If FRAME is omitted or nil, use the selected frame.")
struct frame *f = frame_or_selected_frame (frame, 1);
int face_id = lookup_named_face (f, face, 0);
struct face *face = FACE_FROM_ID (f, face_id);
- return build_string (face->font_name);
+ return face ? build_string (face->font_name) : Qnil;
}
}
@@ -5268,7 +5270,9 @@ lookup_face (f, attr, c, base_face)
/* Return the face id of the realized face for named face SYMBOL on
- frame F suitable for displaying character C. */
+ frame F suitable for displaying character C. Value is -1 if the
+ face couldn't be determined, which might happen if the default face
+ isn't realized and cannot be realized. */
int
lookup_named_face (f, symbol, c)
@@ -5280,6 +5284,13 @@ lookup_named_face (f, symbol, c)
Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE];
struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
+ if (default_face == NULL)
+ {
+ if (!realize_basic_faces (f))
+ return -1;
+ default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
+ }
+
get_lface_attributes (f, symbol, symbol_attrs, 1);
bcopy (default_face->lface, attrs, sizeof attrs);
merge_face_vectors (f, symbol_attrs, attrs, Qnil);
@@ -5397,6 +5408,7 @@ face_with_height (f, face_id, height)
return face_id;
}
+
/* Return the face id of the realized face for named face SYMBOL on
frame F suitable for displaying character C, and use attributes of
the face FACE_ID for attributes that aren't completely specified by
@@ -5948,7 +5960,7 @@ realize_basic_faces (f)
realize_named_face (f, Qmouse, MOUSE_FACE_ID);
realize_named_face (f, Qmenu, MENU_FACE_ID);
- /* Reflext changes in the `menu' face in menu bars. */
+ /* Reflect changes in the `menu' face in menu bars. */
if (menu_face_change_count)
{
menu_face_change_count = 0;