comparison src/xfaces.c @ 70795:1d1c6a83c277

(best_matching_font): Fix crash in 2006-05-17 change.
author Kim F. Storm <storm@cua.dk>
date Sat, 20 May 2006 22:01:18 +0000
parents 434948c350d2
children 7ca4cd6f07f2
comparison
equal deleted inserted replaced
70794:6f2bfdfe1af7 70795:1d1c6a83c277
6634 *needs_overstrike = 0; 6634 *needs_overstrike = 0;
6635 6635
6636 best = NULL; 6636 best = NULL;
6637 6637
6638 /* Find the best match among the non-scalable fonts. */ 6638 /* Find the best match among the non-scalable fonts. */
6639 for (i = 1; i < nfonts; ++i) 6639 for (i = 0; i < nfonts; ++i)
6640 if (!font_scalable_p (fonts + i) 6640 if (!font_scalable_p (fonts + i)
6641 && better_font_p (specified, fonts + i, best, 1, avgwidth)) 6641 && better_font_p (specified, fonts + i, best, 1, avgwidth))
6642 { 6642 {
6643 best = fonts + i; 6643 best = fonts + i;
6644 6644
7071 check_lface (lface); 7071 check_lface (lface);
7072 bcopy (XVECTOR (lface)->contents, attrs, sizeof attrs); 7072 bcopy (XVECTOR (lface)->contents, attrs, sizeof attrs);
7073 face = realize_face (c, attrs, 0, NULL, DEFAULT_FACE_ID); 7073 face = realize_face (c, attrs, 0, NULL, DEFAULT_FACE_ID);
7074 7074
7075 #ifdef HAVE_WINDOW_SYSTEM 7075 #ifdef HAVE_WINDOW_SYSTEM
7076 #ifdef HAVE_X_WINDOWS 7076 #ifdef HAVE_X_WINDOWS
7077 if (face->font != FRAME_FONT (f)) 7077 if (face->font != FRAME_FONT (f))
7078 /* As the font specified for the frame was not acceptable as a 7078 /* As the font specified for the frame was not acceptable as a
7079 font for the default face (perhaps because auto-scaled fonts 7079 font for the default face (perhaps because auto-scaled fonts
7080 are rejected), we must adjust the frame font. */ 7080 are rejected), we must adjust the frame font. */
7081 x_set_font (f, build_string (face->font_name), Qnil); 7081 x_set_font (f, build_string (face->font_name), Qnil);