aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann2000-11-07 13:18:15 +0000
committerGerd Moellmann2000-11-07 13:18:15 +0000
commitb5de343d74c4cbc9a2d8d82667aa5caeb53da392 (patch)
treeda014bb91e719e110ec48e66c4e5ecbe08401c53 /src
parentf620908e1cc756cd23a299599d21d478d55c3cd4 (diff)
downloademacs-b5de343d74c4cbc9a2d8d82667aa5caeb53da392.tar.gz
emacs-b5de343d74c4cbc9a2d8d82667aa5caeb53da392.zip
(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.
Diffstat (limited to 'src')
-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 @@
12000-11-07 Gerd Moellmann <gerd@gnu.org>
2
3 * xfaces.c (lookup_named_face): If default face isn't realized,
4 try to realize it. Return -1 if not successful.
5 (Fx_list_fonts): Handle case that face cannot be determined.
6 (Fface_font): Likewise.
7
12000-11-06 Gerd Moellmann <gerd@gnu.org> 82000-11-06 Gerd Moellmann <gerd@gnu.org>
2 9
3 * window.c (displayed_window_lines): Detect partially 10 * 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.")
2726 /* This is of limited utility since it works with character 2726 /* This is of limited utility since it works with character
2727 widths. Keep it for compatibility. --gerd. */ 2727 widths. Keep it for compatibility. --gerd. */
2728 int face_id = lookup_named_face (f, face, 0); 2728 int face_id = lookup_named_face (f, face, 0);
2729 struct face *face = FACE_FROM_ID (f, face_id); 2729 struct face *face = (face_id < 0
2730 ? NULL
2731 : FACE_FROM_ID (f, face_id));
2730 2732
2731 if (face->font) 2733 if (face && face->font)
2732 size = FONT_WIDTH (face->font); 2734 size = FONT_WIDTH (face->font);
2733 else 2735 else
2734 size = FONT_WIDTH (FRAME_FONT (f)); 2736 size = FONT_WIDTH (FRAME_FONT (f));
@@ -4650,7 +4652,7 @@ If FRAME is omitted or nil, use the selected frame.")
4650 struct frame *f = frame_or_selected_frame (frame, 1); 4652 struct frame *f = frame_or_selected_frame (frame, 1);
4651 int face_id = lookup_named_face (f, face, 0); 4653 int face_id = lookup_named_face (f, face, 0);
4652 struct face *face = FACE_FROM_ID (f, face_id); 4654 struct face *face = FACE_FROM_ID (f, face_id);
4653 return build_string (face->font_name); 4655 return face ? build_string (face->font_name) : Qnil;
4654 } 4656 }
4655} 4657}
4656 4658
@@ -5268,7 +5270,9 @@ lookup_face (f, attr, c, base_face)
5268 5270
5269 5271
5270/* Return the face id of the realized face for named face SYMBOL on 5272/* Return the face id of the realized face for named face SYMBOL on
5271 frame F suitable for displaying character C. */ 5273 frame F suitable for displaying character C. Value is -1 if the
5274 face couldn't be determined, which might happen if the default face
5275 isn't realized and cannot be realized. */
5272 5276
5273int 5277int
5274lookup_named_face (f, symbol, c) 5278lookup_named_face (f, symbol, c)
@@ -5280,6 +5284,13 @@ lookup_named_face (f, symbol, c)
5280 Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE]; 5284 Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE];
5281 struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); 5285 struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
5282 5286
5287 if (default_face == NULL)
5288 {
5289 if (!realize_basic_faces (f))
5290 return -1;
5291 default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
5292 }
5293
5283 get_lface_attributes (f, symbol, symbol_attrs, 1); 5294 get_lface_attributes (f, symbol, symbol_attrs, 1);
5284 bcopy (default_face->lface, attrs, sizeof attrs); 5295 bcopy (default_face->lface, attrs, sizeof attrs);
5285 merge_face_vectors (f, symbol_attrs, attrs, Qnil); 5296 merge_face_vectors (f, symbol_attrs, attrs, Qnil);
@@ -5397,6 +5408,7 @@ face_with_height (f, face_id, height)
5397 return face_id; 5408 return face_id;
5398} 5409}
5399 5410
5411
5400/* Return the face id of the realized face for named face SYMBOL on 5412/* Return the face id of the realized face for named face SYMBOL on
5401 frame F suitable for displaying character C, and use attributes of 5413 frame F suitable for displaying character C, and use attributes of
5402 the face FACE_ID for attributes that aren't completely specified by 5414 the face FACE_ID for attributes that aren't completely specified by
@@ -5948,7 +5960,7 @@ realize_basic_faces (f)
5948 realize_named_face (f, Qmouse, MOUSE_FACE_ID); 5960 realize_named_face (f, Qmouse, MOUSE_FACE_ID);
5949 realize_named_face (f, Qmenu, MENU_FACE_ID); 5961 realize_named_face (f, Qmenu, MENU_FACE_ID);
5950 5962
5951 /* Reflext changes in the `menu' face in menu bars. */ 5963 /* Reflect changes in the `menu' face in menu bars. */
5952 if (menu_face_change_count) 5964 if (menu_face_change_count)
5953 { 5965 {
5954 menu_face_change_count = 0; 5966 menu_face_change_count = 0;