comparison src/xfaces.c @ 30235:5a0d447b7eea

check default_face before dereferencing
author Sam Steingold <sds@gnu.org>
date Fri, 14 Jul 2000 20:29:04 +0000
parents 8d8aa26c6884
children 626d55ea66ef
comparison
equal deleted inserted replaced
30234:1cd3b42b273e 30235:5a0d447b7eea
25 When using Emacs with X, the display style of characters can be 25 When using Emacs with X, the display style of characters can be
26 changed by defining `faces'. Each face can specify the following 26 changed by defining `faces'. Each face can specify the following
27 display attributes: 27 display attributes:
28 28
29 1. Font family name. 29 1. Font family name.
30 30
31 2. Relative proportionate width, aka character set width or set 31 2. Relative proportionate width, aka character set width or set
32 width (swidth), e.g. `semi-compressed'. 32 width (swidth), e.g. `semi-compressed'.
33 33
34 3. Font height in 1/10pt. 34 3. Font height in 1/10pt.
35 35
36 4. Font weight, e.g. `bold'. 36 4. Font weight, e.g. `bold'.
37 37
38 5. Font slant, e.g. `italic'. 38 5. Font slant, e.g. `italic'.
39 39
40 6. Foreground color. 40 6. Foreground color.
41 41
42 7. Background color. 42 7. Background color.
43 43
44 8. Whether or not characters should be underlined, and in what color. 44 8. Whether or not characters should be underlined, and in what color.
45 45
46 9. Whether or not characters should be displayed in inverse video. 46 9. Whether or not characters should be displayed in inverse video.
73 attributes mentioned above. 73 attributes mentioned above.
74 74
75 There is also a global face alist `Vface_new_frame_defaults'. Face 75 There is also a global face alist `Vface_new_frame_defaults'. Face
76 definitions from this list are used to initialize faces of newly 76 definitions from this list are used to initialize faces of newly
77 created frames. 77 created frames.
78 78
79 A face doesn't have to specify all attributes. Those not specified 79 A face doesn't have to specify all attributes. Those not specified
80 have a value of `unspecified'. Faces specifying all attributes but 80 have a value of `unspecified'. Faces specifying all attributes but
81 the 14th are called `fully-specified'. 81 the 14th are called `fully-specified'.
82 82
83 83
90 sure that the default face is always fully-specified, face merging 90 sure that the default face is always fully-specified, face merging
91 always results in a fully-specified face. 91 always results in a fully-specified face.
92 92
93 93
94 Face realization. 94 Face realization.
95 95
96 After all face attributes for a character have been determined by 96 After all face attributes for a character have been determined by
97 merging faces of that character, that face is `realized'. The 97 merging faces of that character, that face is `realized'. The
98 realization process maps face attributes to what is physically 98 realization process maps face attributes to what is physically
99 available on the system where Emacs runs. The result is a 99 available on the system where Emacs runs. The result is a
100 `realized face' in form of a struct face which is stored in the 100 `realized face' in form of a struct face which is stored in the
157 2. Setting face-alternative-font-family-alist allows the user to 157 2. Setting face-alternative-font-family-alist allows the user to
158 specify alternative font families to try if a family specified by a 158 specify alternative font families to try if a family specified by a
159 face doesn't exist. 159 face doesn't exist.
160 160
161 161
162 Character compositition. 162 Character compositition.
163 163
164 Usually, the realization process is already finished when Emacs 164 Usually, the realization process is already finished when Emacs
165 actually reflects the desired glyph matrix on the screen. However, 165 actually reflects the desired glyph matrix on the screen. However,
166 on displaying a composition (sequence of characters to be composed 166 on displaying a composition (sequence of characters to be composed
167 on the screen), a suitable font for the components of the 167 on the screen), a suitable font for the components of the
168 composition is selected and realized while drawing them on the 168 composition is selected and realized while drawing them on the
169 screen, i.e. the realization process is delayed but in principle 169 screen, i.e. the realization process is delayed but in principle
170 the same. 170 the same.
171 171
172 172
173 Initialization of basic faces. 173 Initialization of basic faces.
174 174
175 The faces `default', `modeline' are considered `basic faces'. 175 The faces `default', `modeline' are considered `basic faces'.
176 When redisplay happens the first time for a newly created frame, 176 When redisplay happens the first time for a newly created frame,
177 basic faces are realized for CHARSET_ASCII. Frame parameters are 177 basic faces are realized for CHARSET_ASCII. Frame parameters are
265 265
266 /* Value is the number of elements of VECTOR. */ 266 /* Value is the number of elements of VECTOR. */
267 267
268 #define DIM(VECTOR) (sizeof (VECTOR) / sizeof *(VECTOR)) 268 #define DIM(VECTOR) (sizeof (VECTOR) / sizeof *(VECTOR))
269 269
270 /* Make a copy of string S on the stack using alloca. Value is a pointer 270 /* Make a copy of string S on the stack using alloca. Value is a pointer
271 to the copy. */ 271 to the copy. */
272 272
273 #define STRDUPA(S) strcpy ((char *) alloca (strlen ((S)) + 1), (S)) 273 #define STRDUPA(S) strcpy ((char *) alloca (strlen ((S)) + 1), (S))
274 274
275 /* Make a copy of the contents of Lisp string S on the stack using 275 /* Make a copy of the contents of Lisp string S on the stack using
276 alloca. Value is a pointer to the copy. */ 276 alloca. Value is a pointer to the copy. */
277 277
278 #define LSTRDUPA(S) STRDUPA (XSTRING ((S))->data) 278 #define LSTRDUPA(S) STRDUPA (XSTRING ((S))->data)
279 279
280 /* Size of hash table of realized faces in face caches (should be a 280 /* Size of hash table of realized faces in face caches (should be a
281 prime number). */ 281 prime number). */
282 282
283 #define FACE_CACHE_BUCKETS_SIZE 1001 283 #define FACE_CACHE_BUCKETS_SIZE 1001
284 284
285 /* A definition of XColor for non-X frames. */ 285 /* A definition of XColor for non-X frames. */
594 () 594 ()
595 { 595 {
596 int i, n; 596 int i, n;
597 597
598 fputc ('\n', stderr); 598 fputc ('\n', stderr);
599 599
600 for (i = n = 0; i < sizeof color_count / sizeof color_count[0]; ++i) 600 for (i = n = 0; i < sizeof color_count / sizeof color_count[0]; ++i)
601 if (color_count[i]) 601 if (color_count[i])
602 { 602 {
603 fprintf (stderr, "%3d: %5d", i, color_count[i]); 603 fprintf (stderr, "%3d: %5d", i, color_count[i]);
604 ++n; 604 ++n;
793 Lisp_Object frame; 793 Lisp_Object frame;
794 int nparam; 794 int nparam;
795 { 795 {
796 if (NILP (frame)) 796 if (NILP (frame))
797 frame = selected_frame; 797 frame = selected_frame;
798 798
799 CHECK_LIVE_FRAME (frame, nparam); 799 CHECK_LIVE_FRAME (frame, nparam);
800 return XFRAME (frame); 800 return XFRAME (frame);
801 } 801 }
802 802
803 803
812 struct frame *f; 812 struct frame *f;
813 { 813 {
814 /* Make a face cache, if F doesn't have one. */ 814 /* Make a face cache, if F doesn't have one. */
815 if (FRAME_FACE_CACHE (f) == NULL) 815 if (FRAME_FACE_CACHE (f) == NULL)
816 FRAME_FACE_CACHE (f) = make_face_cache (f); 816 FRAME_FACE_CACHE (f) = make_face_cache (f);
817 817
818 #ifdef HAVE_WINDOW_SYSTEM 818 #ifdef HAVE_WINDOW_SYSTEM
819 /* Make the image cache. */ 819 /* Make the image cache. */
820 if (FRAME_WINDOW_P (f)) 820 if (FRAME_WINDOW_P (f))
821 { 821 {
822 if (FRAME_X_IMAGE_CACHE (f) == NULL) 822 if (FRAME_X_IMAGE_CACHE (f) == NULL)
823 FRAME_X_IMAGE_CACHE (f) = make_image_cache (); 823 FRAME_X_IMAGE_CACHE (f) = make_image_cache ();
824 ++FRAME_X_IMAGE_CACHE (f)->refcount; 824 ++FRAME_X_IMAGE_CACHE (f)->refcount;
825 } 825 }
826 #endif /* HAVE_WINDOW_SYSTEM */ 826 #endif /* HAVE_WINDOW_SYSTEM */
827 827
828 /* Realize basic faces. Must have enough information in frame 828 /* Realize basic faces. Must have enough information in frame
829 parameters to realize basic faces at this point. */ 829 parameters to realize basic faces at this point. */
830 #ifdef HAVE_X_WINDOWS 830 #ifdef HAVE_X_WINDOWS
831 if (!FRAME_X_P (f) || FRAME_X_WINDOW (f)) 831 if (!FRAME_X_P (f) || FRAME_X_WINDOW (f))
832 #endif 832 #endif
833 #ifdef WINDOWSNT 833 #ifdef WINDOWSNT
843 void 843 void
844 free_frame_faces (f) 844 free_frame_faces (f)
845 struct frame *f; 845 struct frame *f;
846 { 846 {
847 struct face_cache *face_cache = FRAME_FACE_CACHE (f); 847 struct face_cache *face_cache = FRAME_FACE_CACHE (f);
848 848
849 if (face_cache) 849 if (face_cache)
850 { 850 {
851 free_face_cache (face_cache); 851 free_face_cache (face_cache);
852 FRAME_FACE_CACHE (f) = NULL; 852 FRAME_FACE_CACHE (f) = NULL;
853 } 853 }
1009 (WIDTH + 7)/8 bytes.") 1009 (WIDTH + 7)/8 bytes.")
1010 (object) 1010 (object)
1011 Lisp_Object object; 1011 Lisp_Object object;
1012 { 1012 {
1013 int pixmap_p = 0; 1013 int pixmap_p = 0;
1014 1014
1015 if (STRINGP (object)) 1015 if (STRINGP (object))
1016 /* If OBJECT is a string, it's a file name. */ 1016 /* If OBJECT is a string, it's a file name. */
1017 pixmap_p = 1; 1017 pixmap_p = 1;
1018 else if (CONSP (object)) 1018 else if (CONSP (object))
1019 { 1019 {
1021 HEIGHT must be integers > 0, and DATA must be string large 1021 HEIGHT must be integers > 0, and DATA must be string large
1022 enough to hold a bitmap of the specified size. */ 1022 enough to hold a bitmap of the specified size. */
1023 Lisp_Object width, height, data; 1023 Lisp_Object width, height, data;
1024 1024
1025 height = width = data = Qnil; 1025 height = width = data = Qnil;
1026 1026
1027 if (CONSP (object)) 1027 if (CONSP (object))
1028 { 1028 {
1029 width = XCAR (object); 1029 width = XCAR (object);
1030 object = XCDR (object); 1030 object = XCDR (object);
1031 if (CONSP (object)) 1031 if (CONSP (object))
1136 int 1136 int
1137 frame_update_line_height (f) 1137 frame_update_line_height (f)
1138 struct frame *f; 1138 struct frame *f;
1139 { 1139 {
1140 int line_height, changed_p; 1140 int line_height, changed_p;
1141 1141
1142 line_height = FONT_HEIGHT (FRAME_FONT (f)); 1142 line_height = FONT_HEIGHT (FRAME_FONT (f));
1143 changed_p = line_height != FRAME_LINE_HEIGHT (f); 1143 changed_p = line_height != FRAME_LINE_HEIGHT (f);
1144 FRAME_LINE_HEIGHT (f) = line_height; 1144 FRAME_LINE_HEIGHT (f) = line_height;
1145 return changed_p; 1145 return changed_p;
1146 } 1146 }
1164 struct face *face; 1164 struct face *face;
1165 int c; 1165 int c;
1166 { 1166 {
1167 struct font_info *font_info = NULL; 1167 struct font_info *font_info = NULL;
1168 char *font_name; 1168 char *font_name;
1169 1169
1170 face->font_info_id = -1; 1170 face->font_info_id = -1;
1171 face->font = NULL; 1171 face->font = NULL;
1172 1172
1173 font_name = choose_face_font (f, face->lface, face->fontset, c); 1173 font_name = choose_face_font (f, face->lface, face->fontset, c);
1174 if (!font_name) 1174 if (!font_name)
1352 < max (color.green, color.blue) / 20) 1352 < max (color.green, color.blue) / 20)
1353 && (abs (color.blue - color.red) 1353 && (abs (color.blue - color.red)
1354 < max (color.blue, color.red) / 20)); 1354 < max (color.blue, color.red) / 20));
1355 else 1355 else
1356 gray_p = 0; 1356 gray_p = 0;
1357 1357
1358 return gray_p; 1358 return gray_p;
1359 } 1359 }
1360 1360
1361 1361
1362 /* Return non-zero if color COLOR_NAME can be displayed on frame F. 1362 /* Return non-zero if color COLOR_NAME can be displayed on frame F.
1436 struct face *face; 1436 struct face *face;
1437 Lisp_Object name; 1437 Lisp_Object name;
1438 enum lface_attribute_index target_index; 1438 enum lface_attribute_index target_index;
1439 { 1439 {
1440 XColor color; 1440 XColor color;
1441 1441
1442 xassert (STRINGP (name)); 1442 xassert (STRINGP (name));
1443 xassert (target_index == LFACE_FOREGROUND_INDEX 1443 xassert (target_index == LFACE_FOREGROUND_INDEX
1444 || target_index == LFACE_BACKGROUND_INDEX 1444 || target_index == LFACE_BACKGROUND_INDEX
1445 || target_index == LFACE_UNDERLINE_INDEX 1445 || target_index == LFACE_UNDERLINE_INDEX
1446 || target_index == LFACE_OVERLINE_INDEX 1446 || target_index == LFACE_OVERLINE_INDEX
1447 || target_index == LFACE_STRIKE_THROUGH_INDEX 1447 || target_index == LFACE_STRIKE_THROUGH_INDEX
1448 || target_index == LFACE_BOX_INDEX); 1448 || target_index == LFACE_BOX_INDEX);
1449 1449
1450 /* if the color map is full, defined_color will return a best match 1450 /* if the color map is full, defined_color will return a best match
1451 to the values in an existing cell. */ 1451 to the values in an existing cell. */
1452 if (!defined_color (f, XSTRING (name)->data, &color, 1)) 1452 if (!defined_color (f, XSTRING (name)->data, &color, 1))
1453 { 1453 {
1454 add_to_log ("Unable to load color \"%s\"", name, Qnil); 1454 add_to_log ("Unable to load color \"%s\"", name, Qnil);
1455 1455
1456 switch (target_index) 1456 switch (target_index)
1457 { 1457 {
1458 case LFACE_FOREGROUND_INDEX: 1458 case LFACE_FOREGROUND_INDEX:
1459 face->foreground_defaulted_p = 1; 1459 face->foreground_defaulted_p = 1;
1460 color.pixel = FRAME_FOREGROUND_PIXEL (f); 1460 color.pixel = FRAME_FOREGROUND_PIXEL (f);
1461 break; 1461 break;
1462 1462
1463 case LFACE_BACKGROUND_INDEX: 1463 case LFACE_BACKGROUND_INDEX:
1464 face->background_defaulted_p = 1; 1464 face->background_defaulted_p = 1;
1465 color.pixel = FRAME_BACKGROUND_PIXEL (f); 1465 color.pixel = FRAME_BACKGROUND_PIXEL (f);
1466 break; 1466 break;
1467 1467
1468 case LFACE_UNDERLINE_INDEX: 1468 case LFACE_UNDERLINE_INDEX:
1469 face->underline_defaulted_p = 1; 1469 face->underline_defaulted_p = 1;
1470 color.pixel = FRAME_FOREGROUND_PIXEL (f); 1470 color.pixel = FRAME_FOREGROUND_PIXEL (f);
1471 break; 1471 break;
1472 1472
1473 case LFACE_OVERLINE_INDEX: 1473 case LFACE_OVERLINE_INDEX:
1474 face->overline_color_defaulted_p = 1; 1474 face->overline_color_defaulted_p = 1;
1475 color.pixel = FRAME_FOREGROUND_PIXEL (f); 1475 color.pixel = FRAME_FOREGROUND_PIXEL (f);
1476 break; 1476 break;
1477 1477
1478 case LFACE_STRIKE_THROUGH_INDEX: 1478 case LFACE_STRIKE_THROUGH_INDEX:
1479 face->strike_through_color_defaulted_p = 1; 1479 face->strike_through_color_defaulted_p = 1;
1480 color.pixel = FRAME_FOREGROUND_PIXEL (f); 1480 color.pixel = FRAME_FOREGROUND_PIXEL (f);
1481 break; 1481 break;
1482 1482
1483 case LFACE_BOX_INDEX: 1483 case LFACE_BOX_INDEX:
1484 face->box_color_defaulted_p = 1; 1484 face->box_color_defaulted_p = 1;
1485 color.pixel = FRAME_FOREGROUND_PIXEL (f); 1485 color.pixel = FRAME_FOREGROUND_PIXEL (f);
1486 break; 1486 break;
1487 1487
1491 } 1491 }
1492 #if GLYPH_DEBUG 1492 #if GLYPH_DEBUG
1493 else 1493 else
1494 ++ncolors_allocated; 1494 ++ncolors_allocated;
1495 #endif 1495 #endif
1496 1496
1497 return color.pixel; 1497 return color.pixel;
1498 } 1498 }
1499 1499
1500 1500
1501 #ifdef HAVE_WINDOW_SYSTEM 1501 #ifdef HAVE_WINDOW_SYSTEM
1564 struct frame *f; 1564 struct frame *f;
1565 struct face *face; 1565 struct face *face;
1566 { 1566 {
1567 #ifdef HAVE_X_WINDOWS 1567 #ifdef HAVE_X_WINDOWS
1568 BLOCK_INPUT; 1568 BLOCK_INPUT;
1569 1569
1570 if (!face->foreground_defaulted_p) 1570 if (!face->foreground_defaulted_p)
1571 { 1571 {
1572 x_free_colors (f, &face->foreground, 1); 1572 x_free_colors (f, &face->foreground, 1);
1573 IF_DEBUG (--ncolors_allocated); 1573 IF_DEBUG (--ncolors_allocated);
1574 } 1574 }
1575 1575
1576 if (!face->background_defaulted_p) 1576 if (!face->background_defaulted_p)
1577 { 1577 {
1578 x_free_colors (f, &face->background, 1); 1578 x_free_colors (f, &face->background, 1);
1579 IF_DEBUG (--ncolors_allocated); 1579 IF_DEBUG (--ncolors_allocated);
1580 } 1580 }
1638 XLFD_REGISTRY, 1638 XLFD_REGISTRY,
1639 XLFD_ENCODING, 1639 XLFD_ENCODING,
1640 XLFD_LAST 1640 XLFD_LAST
1641 }; 1641 };
1642 1642
1643 /* An enumerator for each possible slant value of a font. Taken from 1643 /* An enumerator for each possible slant value of a font. Taken from
1644 the XLFD specification. */ 1644 the XLFD specification. */
1645 1645
1646 enum xlfd_slant 1646 enum xlfd_slant
1647 { 1647 {
1648 XLFD_SLANT_UNKNOWN, 1648 XLFD_SLANT_UNKNOWN,
1808 1808
1809 while (low <= high) 1809 while (low <= high)
1810 { 1810 {
1811 mid = (low + high) / 2; 1811 mid = (low + high) / 2;
1812 cmp = strcmp (table[mid].name, s); 1812 cmp = strcmp (table[mid].name, s);
1813 1813
1814 if (cmp < 0) 1814 if (cmp < 0)
1815 low = mid + 1; 1815 low = mid + 1;
1816 else if (cmp > 0) 1816 else if (cmp > 0)
1817 high = mid - 1; 1817 high = mid - 1;
1818 else 1818 else
1926 struct font_name *font; 1926 struct font_name *font;
1927 { 1927 {
1928 return xlfd_symbolic_value (swidth_table, DIM (swidth_table), 1928 return xlfd_symbolic_value (swidth_table, DIM (swidth_table),
1929 font, XLFD_SWIDTH, Qnormal); 1929 font, XLFD_SWIDTH, Qnormal);
1930 } 1930 }
1931 1931
1932 1932
1933 /* Look up the entry of SYMBOL in the vector TABLE which has DIM 1933 /* Look up the entry of SYMBOL in the vector TABLE which has DIM
1934 entries. Value is a pointer to the matching table entry or null if 1934 entries. Value is a pointer to the matching table entry or null if
1935 no element of TABLE contains SYMBOL. */ 1935 no element of TABLE contains SYMBOL. */
1936 1936
1941 Lisp_Object symbol; 1941 Lisp_Object symbol;
1942 { 1942 {
1943 int i; 1943 int i;
1944 1944
1945 xassert (SYMBOLP (symbol)); 1945 xassert (SYMBOLP (symbol));
1946 1946
1947 for (i = 0; i < dim; ++i) 1947 for (i = 0; i < dim; ++i)
1948 if (EQ (*table[i].symbol, symbol)) 1948 if (EQ (*table[i].symbol, symbol))
1949 break; 1949 break;
1950 1950
1951 return i < dim ? table + i : NULL; 1951 return i < dim ? table + i : NULL;
2091 2091
2092 while (i < XLFD_LAST) 2092 while (i < XLFD_LAST)
2093 { 2093 {
2094 font->fields[i] = p; 2094 font->fields[i] = p;
2095 ++i; 2095 ++i;
2096 2096
2097 while (*p && *p != '-') 2097 while (*p && *p != '-')
2098 ++p; 2098 ++p;
2099 2099
2100 if (*p != '-') 2100 if (*p != '-')
2101 break; 2101 break;
2102 2102
2103 *p++ = 0; 2103 *p++ = 0;
2104 } 2104 }
2105 } 2105 }
2106 2106
2107 success_p = i == XLFD_LAST; 2107 success_p = i == XLFD_LAST;
2121 } 2121 }
2122 2122
2123 2123
2124 /* Build an XLFD font name from font name fields in FONT. Value is a 2124 /* Build an XLFD font name from font name fields in FONT. Value is a
2125 pointer to the font name, which is allocated via xmalloc. */ 2125 pointer to the font name, which is allocated via xmalloc. */
2126 2126
2127 static char * 2127 static char *
2128 build_font_name (font) 2128 build_font_name (font)
2129 struct font_name *font; 2129 struct font_name *font;
2130 { 2130 {
2131 int i; 2131 int i;
2198 scalable fonts. 2198 scalable fonts.
2199 2199
2200 For all fonts found, set FONTS[i].name to the name of the font, 2200 For all fonts found, set FONTS[i].name to the name of the font,
2201 allocated via xmalloc, and split font names into fields. Ignore 2201 allocated via xmalloc, and split font names into fields. Ignore
2202 fonts that we can't parse. Value is the number of fonts found. 2202 fonts that we can't parse. Value is the number of fonts found.
2203 2203
2204 This is similar to x_list_fonts. The differences are: 2204 This is similar to x_list_fonts. The differences are:
2205 2205
2206 1. It avoids consing. 2206 1. It avoids consing.
2207 2. It never calls XLoadQueryFont. */ 2207 2. It never calls XLoadQueryFont. */
2208 2208
2294 BLOCK_INPUT; 2294 BLOCK_INPUT;
2295 XFreeFontNames (names); 2295 XFreeFontNames (names);
2296 UNBLOCK_INPUT; 2296 UNBLOCK_INPUT;
2297 #endif 2297 #endif
2298 } 2298 }
2299 2299
2300 2300
2301 /* If no fonts found, try patterns from Valternate_fontname_alist. */ 2301 /* If no fonts found, try patterns from Valternate_fontname_alist. */
2302 if (n == 0 && try_alternatives_p) 2302 if (n == 0 && try_alternatives_p)
2303 { 2303 {
2304 Lisp_Object list = Valternate_fontname_alist; 2304 Lisp_Object list = Valternate_fontname_alist;
2315 2315
2316 if (CONSP (list)) 2316 if (CONSP (list))
2317 { 2317 {
2318 Lisp_Object patterns = XCAR (list); 2318 Lisp_Object patterns = XCAR (list);
2319 Lisp_Object name; 2319 Lisp_Object name;
2320 2320
2321 while (CONSP (patterns) 2321 while (CONSP (patterns)
2322 /* If list is screwed up, give up. */ 2322 /* If list is screwed up, give up. */
2323 && (name = XCAR (patterns), 2323 && (name = XCAR (patterns),
2324 STRINGP (name)) 2324 STRINGP (name))
2325 /* Ignore patterns equal to PATTERN because we tried that 2325 /* Ignore patterns equal to PATTERN because we tried that
2330 scalable_fonts_p), 2330 scalable_fonts_p),
2331 n == 0))) 2331 n == 0)))
2332 patterns = XCDR (patterns); 2332 patterns = XCDR (patterns);
2333 } 2333 }
2334 } 2334 }
2335 2335
2336 return n; 2336 return n;
2337 } 2337 }
2338 2338
2339 2339
2340 /* Determine the first font matching PATTERN on frame F. Return in 2340 /* Determine the first font matching PATTERN on frame F. Return in
2341 *FONT the matching font name, split into fields. Value is non-zero 2341 *FONT the matching font name, split into fields. Value is non-zero
2342 if a match was found. */ 2342 if a match was found. */
2343 2343
2354 nfonts = x_face_list_fonts (f, pattern, fonts, nfonts, 1, 0); 2354 nfonts = x_face_list_fonts (f, pattern, fonts, nfonts, 1, 0);
2355 2355
2356 if (nfonts > 0) 2356 if (nfonts > 0)
2357 { 2357 {
2358 bcopy (&fonts[0], font, sizeof *font); 2358 bcopy (&fonts[0], font, sizeof *font);
2359 2359
2360 fonts[0].name = NULL; 2360 fonts[0].name = NULL;
2361 free_font_names (fonts, nfonts); 2361 free_font_names (fonts, nfonts);
2362 } 2362 }
2363 2363
2364 return nfonts > 0; 2364 return nfonts > 0;
2379 char *pattern; 2379 char *pattern;
2380 int (*cmpfn) P_ ((const void *, const void *)); 2380 int (*cmpfn) P_ ((const void *, const void *));
2381 struct font_name **fonts; 2381 struct font_name **fonts;
2382 { 2382 {
2383 int nfonts; 2383 int nfonts;
2384 2384
2385 /* Get the list of fonts matching pattern. 100 should suffice. */ 2385 /* Get the list of fonts matching pattern. 100 should suffice. */
2386 nfonts = DEFAULT_FONT_LIST_LIMIT; 2386 nfonts = DEFAULT_FONT_LIST_LIMIT;
2387 if (INTEGERP (Vfont_list_limit) && XINT (Vfont_list_limit) > 0) 2387 if (INTEGERP (Vfont_list_limit) && XINT (Vfont_list_limit) > 0)
2388 nfonts = XFASTINT (Vfont_list_limit); 2388 nfonts = XFASTINT (Vfont_list_limit);
2389 2389
2390 *fonts = (struct font_name *) xmalloc (nfonts * sizeof **fonts); 2390 *fonts = (struct font_name *) xmalloc (nfonts * sizeof **fonts);
2391 #if SCALABLE_FONTS 2391 #if SCALABLE_FONTS
2392 nfonts = x_face_list_fonts (f, pattern, *fonts, nfonts, 1, 1); 2392 nfonts = x_face_list_fonts (f, pattern, *fonts, nfonts, 1, 1);
2393 #else 2393 #else
2394 nfonts = x_face_list_fonts (f, pattern, *fonts, nfonts, 1, 0); 2394 nfonts = x_face_list_fonts (f, pattern, *fonts, nfonts, 1, 0);
2395 #endif 2395 #endif
2396 2396
2397 /* Sort the resulting array and return it in *FONTS. If no 2397 /* Sort the resulting array and return it in *FONTS. If no
2398 fonts were found, make sure to set *FONTS to null. */ 2398 fonts were found, make sure to set *FONTS to null. */
2399 if (nfonts) 2399 if (nfonts)
2400 sort_fonts (f, *fonts, nfonts, cmpfn); 2400 sort_fonts (f, *fonts, nfonts, cmpfn);
2401 else 2401 else
2402 { 2402 {
2427 so we can use strcmp here. */ 2427 so we can use strcmp here. */
2428 cmp = strcmp (x->fields[XLFD_FAMILY], y->fields[XLFD_FAMILY]); 2428 cmp = strcmp (x->fields[XLFD_FAMILY], y->fields[XLFD_FAMILY]);
2429 if (cmp == 0) 2429 if (cmp == 0)
2430 { 2430 {
2431 int i; 2431 int i;
2432 2432
2433 for (i = 0; i < DIM (font_sort_order) && cmp == 0; ++i) 2433 for (i = 0; i < DIM (font_sort_order) && cmp == 0; ++i)
2434 { 2434 {
2435 int j = font_sort_order[i]; 2435 int j = font_sort_order[i];
2436 cmp = x->numeric[j] - y->numeric[j]; 2436 cmp = x->numeric[j] - y->numeric[j];
2437 } 2437 }
2468 2468
2469 if (NILP (pattern)) 2469 if (NILP (pattern))
2470 { 2470 {
2471 family_str = (NILP (family) ? "*" : (char *) XSTRING (family)->data); 2471 family_str = (NILP (family) ? "*" : (char *) XSTRING (family)->data);
2472 registry_str = (NILP (registry) ? "*" : (char *) XSTRING (registry)->data); 2472 registry_str = (NILP (registry) ? "*" : (char *) XSTRING (registry)->data);
2473 2473
2474 pattern_str = (char *) alloca (strlen (family_str) 2474 pattern_str = (char *) alloca (strlen (family_str)
2475 + strlen (registry_str) 2475 + strlen (registry_str)
2476 + 10); 2476 + 10);
2477 strcpy (pattern_str, index (family_str, '-') ? "-" : "-*-"); 2477 strcpy (pattern_str, index (family_str, '-') ? "-" : "-*-");
2478 strcat (pattern_str, family_str); 2478 strcat (pattern_str, family_str);
2486 strcat (pattern_str, "*-*"); 2486 strcat (pattern_str, "*-*");
2487 } 2487 }
2488 } 2488 }
2489 else 2489 else
2490 pattern_str = (char *) XSTRING (pattern)->data; 2490 pattern_str = (char *) XSTRING (pattern)->data;
2491 2491
2492 return sorted_font_list (f, pattern_str, cmp_font_names, fonts); 2492 return sorted_font_list (f, pattern_str, cmp_font_names, fonts);
2493 } 2493 }
2494 2494
2495 2495
2496 /* Remove elements from LIST whose cars are `equal'. Called from 2496 /* Remove elements from LIST whose cars are `equal'. Called from
2500 static void 2500 static void
2501 remove_duplicates (list) 2501 remove_duplicates (list)
2502 Lisp_Object list; 2502 Lisp_Object list;
2503 { 2503 {
2504 Lisp_Object tail = list; 2504 Lisp_Object tail = list;
2505 2505
2506 while (!NILP (tail) && !NILP (XCDR (tail))) 2506 while (!NILP (tail) && !NILP (XCDR (tail)))
2507 { 2507 {
2508 Lisp_Object next = XCDR (tail); 2508 Lisp_Object next = XCDR (tail);
2509 if (!NILP (Fequal (XCAR (next), XCAR (tail)))) 2509 if (!NILP (Fequal (XCAR (next), XCAR (tail))))
2510 XCDR (tail) = XCDR (next); 2510 XCDR (tail) = XCDR (next);
2539 Lisp_Object result; 2539 Lisp_Object result;
2540 struct gcpro gcpro1; 2540 struct gcpro gcpro1;
2541 2541
2542 if (!NILP (family)) 2542 if (!NILP (family))
2543 CHECK_STRING (family, 1); 2543 CHECK_STRING (family, 1);
2544 2544
2545 result = Qnil; 2545 result = Qnil;
2546 GCPRO1 (result); 2546 GCPRO1 (result);
2547 nfonts = font_list (f, Qnil, family, Qnil, &fonts); 2547 nfonts = font_list (f, Qnil, family, Qnil, &fonts);
2548 for (i = nfonts - 1; i >= 0; --i) 2548 for (i = nfonts - 1; i >= 0; --i)
2549 { 2549 {
2560 ASET (v, 6, build_string (tem)); 2560 ASET (v, 6, build_string (tem));
2561 sprintf (tem, "%s-%s", fonts[i].fields[XLFD_REGISTRY], 2561 sprintf (tem, "%s-%s", fonts[i].fields[XLFD_REGISTRY],
2562 fonts[i].fields[XLFD_ENCODING]); 2562 fonts[i].fields[XLFD_ENCODING]);
2563 ASET (v, 7, build_string (tem)); 2563 ASET (v, 7, build_string (tem));
2564 xfree (tem); 2564 xfree (tem);
2565 2565
2566 result = Fcons (v, result); 2566 result = Fcons (v, result);
2567 } 2567 }
2568 2568
2569 remove_duplicates (result); 2569 remove_duplicates (result);
2570 free_font_names (fonts, nfonts); 2570 free_font_names (fonts, nfonts);
2595 fonts until we have them all. */ 2595 fonts until we have them all. */
2596 for (limit = 500;;) 2596 for (limit = 500;;)
2597 { 2597 {
2598 specbind (intern ("font-list-limit"), make_number (limit)); 2598 specbind (intern ("font-list-limit"), make_number (limit));
2599 nfonts = font_list (f, Qnil, Qnil, Qnil, &fonts); 2599 nfonts = font_list (f, Qnil, Qnil, Qnil, &fonts);
2600 2600
2601 if (nfonts == limit) 2601 if (nfonts == limit)
2602 { 2602 {
2603 free_font_names (fonts, nfonts); 2603 free_font_names (fonts, nfonts);
2604 limit *= 2; 2604 limit *= 2;
2605 } 2605 }
2606 else 2606 else
2607 break; 2607 break;
2608 } 2608 }
2609 2609
2610 result = Qnil; 2610 result = Qnil;
2611 GCPRO1 (result); 2611 GCPRO1 (result);
2612 for (i = nfonts - 1; i >= 0; --i) 2612 for (i = nfonts - 1; i >= 0; --i)
2613 result = Fcons (Fcons (build_string (fonts[i].fields[XLFD_FAMILY]), 2613 result = Fcons (Fcons (build_string (fonts[i].fields[XLFD_FAMILY]),
2614 xlfd_fixed_p (fonts + i) ? Qt : Qnil), 2614 xlfd_fixed_p (fonts + i) ? Qt : Qnil),
2648 int size; 2648 int size;
2649 int maxnames; 2649 int maxnames;
2650 2650
2651 check_x (); 2651 check_x ();
2652 CHECK_STRING (pattern, 0); 2652 CHECK_STRING (pattern, 0);
2653 2653
2654 if (NILP (maximum)) 2654 if (NILP (maximum))
2655 maxnames = 2000; 2655 maxnames = 2000;
2656 else 2656 else
2657 { 2657 {
2658 CHECK_NATNUM (maximum, 0); 2658 CHECK_NATNUM (maximum, 0);
2749 #define LFACEP(LFACE) \ 2749 #define LFACEP(LFACE) \
2750 (VECTORP (LFACE) \ 2750 (VECTORP (LFACE) \
2751 && XVECTOR (LFACE)->size == LFACE_VECTOR_SIZE \ 2751 && XVECTOR (LFACE)->size == LFACE_VECTOR_SIZE \
2752 && EQ (XVECTOR (LFACE)->contents[0], Qface)) 2752 && EQ (XVECTOR (LFACE)->contents[0], Qface))
2753 2753
2754 2754
2755 #if GLYPH_DEBUG 2755 #if GLYPH_DEBUG
2756 2756
2757 /* Check consistency of Lisp face attribute vector ATTRS. */ 2757 /* Check consistency of Lisp face attribute vector ATTRS. */
2758 2758
2759 static void 2759 static void
2829 static Lisp_Object 2829 static Lisp_Object
2830 resolve_face_name (face_name) 2830 resolve_face_name (face_name)
2831 Lisp_Object face_name; 2831 Lisp_Object face_name;
2832 { 2832 {
2833 Lisp_Object aliased; 2833 Lisp_Object aliased;
2834 2834
2835 if (STRINGP (face_name)) 2835 if (STRINGP (face_name))
2836 face_name = intern (XSTRING (face_name)->data); 2836 face_name = intern (XSTRING (face_name)->data);
2837 2837
2838 for (;;) 2838 for (;;)
2839 { 2839 {
2939 return 0 if MAY_FAIL_P is non-zero, otherwise abort. 2939 return 0 if MAY_FAIL_P is non-zero, otherwise abort.
2940 If the fullname is not in a valid XLFD format, 2940 If the fullname is not in a valid XLFD format,
2941 return 0 if MAY_FAIL_P is non-zero, otherwise set normal values 2941 return 0 if MAY_FAIL_P is non-zero, otherwise set normal values
2942 in LFACE and return 1. 2942 in LFACE and return 1.
2943 Otherwise, return 1. */ 2943 Otherwise, return 1. */
2944 2944
2945 static int 2945 static int
2946 set_lface_from_font_name (f, lface, fontname, force_p, may_fail_p) 2946 set_lface_from_font_name (f, lface, fontname, force_p, may_fail_p)
2947 struct frame *f; 2947 struct frame *f;
2948 Lisp_Object lface; 2948 Lisp_Object lface;
2949 Lisp_Object fontname; 2949 Lisp_Object fontname;
2982 have_xlfd_p = split_font_name (f, &font, 1); 2982 have_xlfd_p = split_font_name (f, &font, 1);
2983 2983
2984 /* Set attributes only if unspecified, otherwise face defaults for 2984 /* Set attributes only if unspecified, otherwise face defaults for
2985 new frames would never take effect. If we couldn't get a font 2985 new frames would never take effect. If we couldn't get a font
2986 name conforming to XLFD, set normal values. */ 2986 name conforming to XLFD, set normal values. */
2987 2987
2988 if (force_p || UNSPECIFIEDP (LFACE_FAMILY (lface))) 2988 if (force_p || UNSPECIFIEDP (LFACE_FAMILY (lface)))
2989 { 2989 {
2990 Lisp_Object val; 2990 Lisp_Object val;
2991 if (have_xlfd_p) 2991 if (have_xlfd_p)
2992 { 2992 {
3023 if (force_p || UNSPECIFIEDP (LFACE_SLANT (lface))) 3023 if (force_p || UNSPECIFIEDP (LFACE_SLANT (lface)))
3024 LFACE_SLANT (lface) 3024 LFACE_SLANT (lface)
3025 = have_xlfd_p ? xlfd_symbolic_slant (&font) : Qnormal; 3025 = have_xlfd_p ? xlfd_symbolic_slant (&font) : Qnormal;
3026 3026
3027 LFACE_FONT (lface) = fontname; 3027 LFACE_FONT (lface) = fontname;
3028 3028
3029 return 1; 3029 return 1;
3030 } 3030 }
3031 #endif /* HAVE_WINDOW_SYSTEM */ 3031 #endif /* HAVE_WINDOW_SYSTEM */
3032 3032
3033 3033
3062 (BACKGROUND-COLOR . COLOR) where COLOR is a color name. This is 3062 (BACKGROUND-COLOR . COLOR) where COLOR is a color name. This is
3063 for compatibility with 20.2. 3063 for compatibility with 20.2.
3064 3064
3065 Face specifications earlier in lists take precedence over later 3065 Face specifications earlier in lists take precedence over later
3066 specifications. */ 3066 specifications. */
3067 3067
3068 static void 3068 static void
3069 merge_face_vector_with_property (f, to, prop) 3069 merge_face_vector_with_property (f, to, prop)
3070 struct frame *f; 3070 struct frame *f;
3071 Lisp_Object *to; 3071 Lisp_Object *to;
3072 Lisp_Object prop; 3072 Lisp_Object prop;
3073 { 3073 {
3074 if (CONSP (prop)) 3074 if (CONSP (prop))
3075 { 3075 {
3076 Lisp_Object first = XCAR (prop); 3076 Lisp_Object first = XCAR (prop);
3077 3077
3078 if (EQ (first, Qforeground_color) 3078 if (EQ (first, Qforeground_color)
3079 || EQ (first, Qbackground_color)) 3079 || EQ (first, Qbackground_color))
3080 { 3080 {
3081 /* One of (FOREGROUND-COLOR . COLOR) or (BACKGROUND-COLOR 3081 /* One of (FOREGROUND-COLOR . COLOR) or (BACKGROUND-COLOR
3082 . COLOR). COLOR must be a string. */ 3082 . COLOR). COLOR must be a string. */
3256 struct frame *f; 3256 struct frame *f;
3257 int i; 3257 int i;
3258 3258
3259 CHECK_SYMBOL (face, 0); 3259 CHECK_SYMBOL (face, 0);
3260 global_lface = lface_from_face_name (NULL, face, 0); 3260 global_lface = lface_from_face_name (NULL, face, 0);
3261 3261
3262 if (!NILP (frame)) 3262 if (!NILP (frame))
3263 { 3263 {
3264 CHECK_LIVE_FRAME (frame, 1); 3264 CHECK_LIVE_FRAME (frame, 1);
3265 f = XFRAME (frame); 3265 f = XFRAME (frame);
3266 lface = lface_from_face_name (f, face, 0); 3266 lface = lface_from_face_name (f, face, 0);
3272 if (NILP (global_lface)) 3272 if (NILP (global_lface))
3273 { 3273 {
3274 global_lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE), 3274 global_lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE),
3275 Qunspecified); 3275 Qunspecified);
3276 XVECTOR (global_lface)->contents[0] = Qface; 3276 XVECTOR (global_lface)->contents[0] = Qface;
3277 Vface_new_frame_defaults = Fcons (Fcons (face, global_lface), 3277 Vface_new_frame_defaults = Fcons (Fcons (face, global_lface),
3278 Vface_new_frame_defaults); 3278 Vface_new_frame_defaults);
3279 3279
3280 /* Assign the new Lisp face a unique ID. The mapping from Lisp 3280 /* Assign the new Lisp face a unique ID. The mapping from Lisp
3281 face id to Lisp face is given by the vector lface_id_to_name. 3281 face id to Lisp face is given by the vector lface_id_to_name.
3282 The mapping from Lisp face to Lisp face id is given by the 3282 The mapping from Lisp face to Lisp face id is given by the
3283 property `face' of the Lisp face name. */ 3283 property `face' of the Lisp face name. */
3284 if (next_lface_id == lface_id_to_name_size) 3284 if (next_lface_id == lface_id_to_name_size)
3286 int new_size = max (50, 2 * lface_id_to_name_size); 3286 int new_size = max (50, 2 * lface_id_to_name_size);
3287 int sz = new_size * sizeof *lface_id_to_name; 3287 int sz = new_size * sizeof *lface_id_to_name;
3288 lface_id_to_name = (Lisp_Object *) xrealloc (lface_id_to_name, sz); 3288 lface_id_to_name = (Lisp_Object *) xrealloc (lface_id_to_name, sz);
3289 lface_id_to_name_size = new_size; 3289 lface_id_to_name_size = new_size;
3290 } 3290 }
3291 3291
3292 lface_id_to_name[next_lface_id] = face; 3292 lface_id_to_name[next_lface_id] = face;
3293 Fput (face, Qface, make_number (next_lface_id)); 3293 Fput (face, Qface, make_number (next_lface_id));
3294 ++next_lface_id; 3294 ++next_lface_id;
3295 } 3295 }
3296 else if (f == NULL) 3296 else if (f == NULL)
3297 for (i = 1; i < LFACE_VECTOR_SIZE; ++i) 3297 for (i = 1; i < LFACE_VECTOR_SIZE; ++i)
3298 XVECTOR (global_lface)->contents[i] = Qunspecified; 3298 XVECTOR (global_lface)->contents[i] = Qunspecified;
3299 3299
3300 /* Add a frame-local definition. */ 3300 /* Add a frame-local definition. */
3301 if (f) 3301 if (f)
3302 { 3302 {
3303 if (NILP (lface)) 3303 if (NILP (lface))
3304 { 3304 {
3328 Otherwise check for the existence of a global face.") 3328 Otherwise check for the existence of a global face.")
3329 (face, frame) 3329 (face, frame)
3330 Lisp_Object face, frame; 3330 Lisp_Object face, frame;
3331 { 3331 {
3332 Lisp_Object lface; 3332 Lisp_Object lface;
3333 3333
3334 if (!NILP (frame)) 3334 if (!NILP (frame))
3335 { 3335 {
3336 CHECK_LIVE_FRAME (frame, 1); 3336 CHECK_LIVE_FRAME (frame, 1);
3337 lface = lface_from_face_name (XFRAME (frame), face, 0); 3337 lface = lface_from_face_name (XFRAME (frame), face, 0);
3338 } 3338 }
3354 Value is TO.") 3354 Value is TO.")
3355 (from, to, frame, new_frame) 3355 (from, to, frame, new_frame)
3356 Lisp_Object from, to, frame, new_frame; 3356 Lisp_Object from, to, frame, new_frame;
3357 { 3357 {
3358 Lisp_Object lface, copy; 3358 Lisp_Object lface, copy;
3359 3359
3360 CHECK_SYMBOL (from, 0); 3360 CHECK_SYMBOL (from, 0);
3361 CHECK_SYMBOL (to, 1); 3361 CHECK_SYMBOL (to, 1);
3362 if (NILP (new_frame)) 3362 if (NILP (new_frame))
3363 new_frame = frame; 3363 new_frame = frame;
3364 3364
3375 CHECK_LIVE_FRAME (frame, 2); 3375 CHECK_LIVE_FRAME (frame, 2);
3376 CHECK_LIVE_FRAME (new_frame, 3); 3376 CHECK_LIVE_FRAME (new_frame, 3);
3377 lface = lface_from_face_name (XFRAME (frame), from, 1); 3377 lface = lface_from_face_name (XFRAME (frame), from, 1);
3378 copy = Finternal_make_lisp_face (to, new_frame); 3378 copy = Finternal_make_lisp_face (to, new_frame);
3379 } 3379 }
3380 3380
3381 bcopy (XVECTOR (lface)->contents, XVECTOR (copy)->contents, 3381 bcopy (XVECTOR (lface)->contents, XVECTOR (copy)->contents,
3382 LFACE_VECTOR_SIZE * sizeof (Lisp_Object)); 3382 LFACE_VECTOR_SIZE * sizeof (Lisp_Object));
3383 3383
3384 return to; 3384 return to;
3385 } 3385 }
3386 3386
3387 3387
3388 DEFUN ("internal-set-lisp-face-attribute", Finternal_set_lisp_face_attribute, 3388 DEFUN ("internal-set-lisp-face-attribute", Finternal_set_lisp_face_attribute,
3399 Lisp_Object old_value = Qnil; 3399 Lisp_Object old_value = Qnil;
3400 /* Set 1 if ATTR is QCfont. */ 3400 /* Set 1 if ATTR is QCfont. */
3401 int font_attr_p = 0; 3401 int font_attr_p = 0;
3402 /* Set 1 if ATTR is one of font-related attributes other than QCfont. */ 3402 /* Set 1 if ATTR is one of font-related attributes other than QCfont. */
3403 int font_related_attr_p = 0; 3403 int font_related_attr_p = 0;
3404 3404
3405 CHECK_SYMBOL (face, 0); 3405 CHECK_SYMBOL (face, 0);
3406 CHECK_SYMBOL (attr, 1); 3406 CHECK_SYMBOL (attr, 1);
3407 3407
3408 face = resolve_face_name (face); 3408 face = resolve_face_name (face);
3409 3409
3412 lface = lface_from_face_name (NULL, face, 1); 3412 lface = lface_from_face_name (NULL, face, 1);
3413 else 3413 else
3414 { 3414 {
3415 if (NILP (frame)) 3415 if (NILP (frame))
3416 frame = selected_frame; 3416 frame = selected_frame;
3417 3417
3418 CHECK_LIVE_FRAME (frame, 3); 3418 CHECK_LIVE_FRAME (frame, 3);
3419 lface = lface_from_face_name (XFRAME (frame), face, 0); 3419 lface = lface_from_face_name (XFRAME (frame), face, 0);
3420 3420
3421 /* If a frame-local face doesn't exist yet, create one. */ 3421 /* If a frame-local face doesn't exist yet, create one. */
3422 if (NILP (lface)) 3422 if (NILP (lface))
3423 lface = Finternal_make_lisp_face (face, frame); 3423 lface = Finternal_make_lisp_face (face, frame);
3424 } 3424 }
3425 3425
3479 && !EQ (value, Qnil)) 3479 && !EQ (value, Qnil))
3480 /* Underline color. */ 3480 /* Underline color. */
3481 || (STRINGP (value) 3481 || (STRINGP (value)
3482 && XSTRING (value)->size == 0)) 3482 && XSTRING (value)->size == 0))
3483 signal_error ("Invalid face underline", value); 3483 signal_error ("Invalid face underline", value);
3484 3484
3485 old_value = LFACE_UNDERLINE (lface); 3485 old_value = LFACE_UNDERLINE (lface);
3486 LFACE_UNDERLINE (lface) = value; 3486 LFACE_UNDERLINE (lface) = value;
3487 } 3487 }
3488 else if (EQ (attr, QCoverline)) 3488 else if (EQ (attr, QCoverline))
3489 { 3489 {
3493 && !EQ (value, Qnil)) 3493 && !EQ (value, Qnil))
3494 /* Overline color. */ 3494 /* Overline color. */
3495 || (STRINGP (value) 3495 || (STRINGP (value)
3496 && XSTRING (value)->size == 0)) 3496 && XSTRING (value)->size == 0))
3497 signal_error ("Invalid face overline", value); 3497 signal_error ("Invalid face overline", value);
3498 3498
3499 old_value = LFACE_OVERLINE (lface); 3499 old_value = LFACE_OVERLINE (lface);
3500 LFACE_OVERLINE (lface) = value; 3500 LFACE_OVERLINE (lface) = value;
3501 } 3501 }
3502 else if (EQ (attr, QCstrike_through)) 3502 else if (EQ (attr, QCstrike_through))
3503 { 3503 {
3507 && !EQ (value, Qnil)) 3507 && !EQ (value, Qnil))
3508 /* Strike-through color. */ 3508 /* Strike-through color. */
3509 || (STRINGP (value) 3509 || (STRINGP (value)
3510 && XSTRING (value)->size == 0)) 3510 && XSTRING (value)->size == 0))
3511 signal_error ("Invalid face strike-through", value); 3511 signal_error ("Invalid face strike-through", value);
3512 3512
3513 old_value = LFACE_STRIKE_THROUGH (lface); 3513 old_value = LFACE_STRIKE_THROUGH (lface);
3514 LFACE_STRIKE_THROUGH (lface) = value; 3514 LFACE_STRIKE_THROUGH (lface) = value;
3515 } 3515 }
3516 else if (EQ (attr, QCbox)) 3516 else if (EQ (attr, QCbox))
3517 { 3517 {
3518 int valid_p; 3518 int valid_p;
3519 3519
3520 /* Allow t meaning a simple box of width 1 in foreground color 3520 /* Allow t meaning a simple box of width 1 in foreground color
3521 of the face. */ 3521 of the face. */
3522 if (EQ (value, Qt)) 3522 if (EQ (value, Qt))
3523 value = make_number (1); 3523 value = make_number (1);
3524 3524
3531 else if (STRINGP (value)) 3531 else if (STRINGP (value))
3532 valid_p = XSTRING (value)->size > 0; 3532 valid_p = XSTRING (value)->size > 0;
3533 else if (CONSP (value)) 3533 else if (CONSP (value))
3534 { 3534 {
3535 Lisp_Object tem; 3535 Lisp_Object tem;
3536 3536
3537 tem = value; 3537 tem = value;
3538 while (CONSP (tem)) 3538 while (CONSP (tem))
3539 { 3539 {
3540 Lisp_Object k, v; 3540 Lisp_Object k, v;
3541 3541
3543 tem = XCDR (tem); 3543 tem = XCDR (tem);
3544 if (!CONSP (tem)) 3544 if (!CONSP (tem))
3545 break; 3545 break;
3546 v = XCAR (tem); 3546 v = XCAR (tem);
3547 tem = XCDR (tem); 3547 tem = XCDR (tem);
3548 3548
3549 if (EQ (k, QCline_width)) 3549 if (EQ (k, QCline_width))
3550 { 3550 {
3551 if (!INTEGERP (v) || XINT (v) <= 0) 3551 if (!INTEGERP (v) || XINT (v) <= 0)
3552 break; 3552 break;
3553 } 3553 }
3570 else 3570 else
3571 valid_p = 0; 3571 valid_p = 0;
3572 3572
3573 if (!valid_p) 3573 if (!valid_p)
3574 signal_error ("Invalid face box", value); 3574 signal_error ("Invalid face box", value);
3575 3575
3576 old_value = LFACE_BOX (lface); 3576 old_value = LFACE_BOX (lface);
3577 LFACE_BOX (lface) = value; 3577 LFACE_BOX (lface) = value;
3578 } 3578 }
3579 else if (EQ (attr, QCinverse_video) 3579 else if (EQ (attr, QCinverse_video)
3580 || EQ (attr, QCreverse_video)) 3580 || EQ (attr, QCreverse_video))
3650 CHECK_STRING (value, 3); 3650 CHECK_STRING (value, 3);
3651 if (EQ (frame, Qt)) 3651 if (EQ (frame, Qt))
3652 f = SELECTED_FRAME (); 3652 f = SELECTED_FRAME ();
3653 else 3653 else
3654 f = check_x_frame (frame); 3654 f = check_x_frame (frame);
3655 3655
3656 /* VALUE may be a fontset name or an alias of fontset. In such 3656 /* VALUE may be a fontset name or an alias of fontset. In such
3657 a case, use the base fontset name. */ 3657 a case, use the base fontset name. */
3658 tmp = Fquery_fontset (value, Qnil); 3658 tmp = Fquery_fontset (value, Qnil);
3659 if (!NILP (tmp)) 3659 if (!NILP (tmp))
3660 value = tmp; 3660 value = tmp;
3708 && NILP (Fequal (old_value, value))) 3708 && NILP (Fequal (old_value, value)))
3709 { 3709 {
3710 Lisp_Object param; 3710 Lisp_Object param;
3711 3711
3712 param = Qnil; 3712 param = Qnil;
3713 3713
3714 if (EQ (face, Qdefault)) 3714 if (EQ (face, Qdefault))
3715 { 3715 {
3716 /* Changed font-related attributes of the `default' face are 3716 /* Changed font-related attributes of the `default' face are
3717 reflected in changed `font' frame parameters. */ 3717 reflected in changed `font' frame parameters. */
3718 if ((font_related_attr_p || font_attr_p) 3718 if ((font_related_attr_p || font_attr_p)
3759 if (!NILP (param)) 3759 if (!NILP (param))
3760 Fmodify_frame_parameters (frame, Fcons (Fcons (param, value), Qnil)); 3760 Fmodify_frame_parameters (frame, Fcons (Fcons (param, value), Qnil));
3761 } 3761 }
3762 3762
3763 #endif /* HAVE_WINDOW_SYSTEM */ 3763 #endif /* HAVE_WINDOW_SYSTEM */
3764 3764
3765 return face; 3765 return face;
3766 } 3766 }
3767 3767
3768 3768
3769 #ifdef HAVE_WINDOW_SYSTEM 3769 #ifdef HAVE_WINDOW_SYSTEM
3812 /* If there are no faces yet, give up. This is the case when called 3812 /* If there are no faces yet, give up. This is the case when called
3813 from Fx_create_frame, and we do the necessary things later in 3813 from Fx_create_frame, and we do the necessary things later in
3814 face-set-after-frame-defaults. */ 3814 face-set-after-frame-defaults. */
3815 if (NILP (f->face_alist)) 3815 if (NILP (f->face_alist))
3816 return; 3816 return;
3817 3817
3818 if (EQ (param, Qforeground_color)) 3818 if (EQ (param, Qforeground_color))
3819 { 3819 {
3820 lface = lface_from_face_name (f, Qdefault, 1); 3820 lface = lface_from_face_name (f, Qdefault, 1);
3821 LFACE_FOREGROUND (lface) = (STRINGP (new_value) 3821 LFACE_FOREGROUND (lface) = (STRINGP (new_value)
3822 ? new_value : Qunspecified); 3822 ? new_value : Qunspecified);
3829 /* Changing the background color might change the background 3829 /* Changing the background color might change the background
3830 mode, so that we have to load new defface specs. Call 3830 mode, so that we have to load new defface specs. Call
3831 frame-update-face-colors to do that. */ 3831 frame-update-face-colors to do that. */
3832 XSETFRAME (frame, f); 3832 XSETFRAME (frame, f);
3833 call1 (Qframe_update_face_colors, frame); 3833 call1 (Qframe_update_face_colors, frame);
3834 3834
3835 lface = lface_from_face_name (f, Qdefault, 1); 3835 lface = lface_from_face_name (f, Qdefault, 1);
3836 LFACE_BACKGROUND (lface) = (STRINGP (new_value) 3836 LFACE_BACKGROUND (lface) = (STRINGP (new_value)
3837 ? new_value : Qunspecified); 3837 ? new_value : Qunspecified);
3838 realize_basic_faces (f); 3838 realize_basic_faces (f);
3839 } 3839 }
3883 3883
3884 /* Return resource string VALUE as a boolean value, i.e. nil, or t. 3884 /* Return resource string VALUE as a boolean value, i.e. nil, or t.
3885 If VALUE is "on" or "true", return t. If VALUE is "off" or 3885 If VALUE is "on" or "true", return t. If VALUE is "off" or
3886 "false", return nil. Otherwise, if SIGNAL_P is non-zero, signal an 3886 "false", return nil. Otherwise, if SIGNAL_P is non-zero, signal an
3887 error; if SIGNAL_P is zero, return 0. */ 3887 error; if SIGNAL_P is zero, return 0. */
3888 3888
3889 static Lisp_Object 3889 static Lisp_Object
3890 face_boolean_x_resource_value (value, signal_p) 3890 face_boolean_x_resource_value (value, signal_p)
3891 Lisp_Object value; 3891 Lisp_Object value;
3892 int signal_p; 3892 int signal_p;
3893 { 3893 {
3894 Lisp_Object result = make_number (0); 3894 Lisp_Object result = make_number (0);
3895 3895
3896 xassert (STRINGP (value)); 3896 xassert (STRINGP (value));
3897 3897
3898 if (xstricmp (XSTRING (value)->data, "on") == 0 3898 if (xstricmp (XSTRING (value)->data, "on") == 0
3899 || xstricmp (XSTRING (value)->data, "true") == 0) 3899 || xstricmp (XSTRING (value)->data, "true") == 0)
3900 result = Qt; 3900 result = Qt;
3901 else if (xstricmp (XSTRING (value)->data, "off") == 0 3901 else if (xstricmp (XSTRING (value)->data, "off") == 0
3902 || xstricmp (XSTRING (value)->data, "false") == 0) 3902 || xstricmp (XSTRING (value)->data, "false") == 0)
3989 Widget w; 3989 Widget w;
3990 XtPointer p; 3990 XtPointer p;
3991 { 3991 {
3992 Widget submenu = 0; 3992 Widget submenu = 0;
3993 struct x_resources *res = (struct x_resources *) p; 3993 struct x_resources *res = (struct x_resources *) p;
3994 3994
3995 XtSetValues (w, res->av, res->ac); 3995 XtSetValues (w, res->av, res->ac);
3996 XtVaGetValues (w, XmNsubMenuId, &submenu, NULL); 3996 XtVaGetValues (w, XmNsubMenuId, &submenu, NULL);
3997 if (submenu) 3997 if (submenu)
3998 { 3998 {
3999 XtSetValues (submenu, res->av, res->ac); 3999 XtSetValues (submenu, res->av, res->ac);
4052 ++ac; 4052 ++ac;
4053 #endif 4053 #endif
4054 } 4054 }
4055 4055
4056 xassert (ac <= sizeof av / sizeof *av); 4056 xassert (ac <= sizeof av / sizeof *av);
4057 4057
4058 if (ac) 4058 if (ac)
4059 { 4059 {
4060 struct x_resources res; 4060 struct x_resources res;
4061 4061
4062 XtSetValues (widget, av, ac); 4062 XtSetValues (widget, av, ac);
4063 res.av = av, res.ac = ac; 4063 res.av = av, res.ac = ac;
4064 XtApplyToWidgets (widget, xm_apply_resources, &res); 4064 XtApplyToWidgets (widget, xm_apply_resources, &res);
4065 if (fl) 4065 if (fl)
4066 XmFontListFree (fl); 4066 XmFontListFree (fl);
4129 } 4129 }
4130 4130
4131 if (ac) 4131 if (ac)
4132 { 4132 {
4133 struct x_resources res; 4133 struct x_resources res;
4134 4134
4135 XtSetValues (widget, av, ac); 4135 XtSetValues (widget, av, ac);
4136 4136
4137 /* We must do children here in case we're handling a pop-up menu 4137 /* We must do children here in case we're handling a pop-up menu
4138 in which case WIDGET is a popup shell. XtApplyToWidgets 4138 in which case WIDGET is a popup shell. XtApplyToWidgets
4139 is a function from lwlib. */ 4139 is a function from lwlib. */
4155 /* Realized faces may have been removed on frame F, e.g. because of 4155 /* Realized faces may have been removed on frame F, e.g. because of
4156 face attribute changes. Recompute them, if necessary, since we 4156 face attribute changes. Recompute them, if necessary, since we
4157 will need the `menu' face. */ 4157 will need the `menu' face. */
4158 if (f->face_cache->used == 0) 4158 if (f->face_cache->used == 0)
4159 recompute_basic_faces (f); 4159 recompute_basic_faces (f);
4160 4160
4161 #ifdef USE_LUCID 4161 #ifdef USE_LUCID
4162 xl_set_menu_resources_from_menu_face (f, widget); 4162 xl_set_menu_resources_from_menu_face (f, widget);
4163 #endif 4163 #endif
4164 #ifdef USE_MOTIF 4164 #ifdef USE_MOTIF
4165 xm_set_menu_resources_from_menu_face (f, widget); 4165 xm_set_menu_resources_from_menu_face (f, widget);
4183 frames). If FRAME is omitted or nil, use the selected frame.") 4183 frames). If FRAME is omitted or nil, use the selected frame.")
4184 (symbol, keyword, frame) 4184 (symbol, keyword, frame)
4185 Lisp_Object symbol, keyword, frame; 4185 Lisp_Object symbol, keyword, frame;
4186 { 4186 {
4187 Lisp_Object lface, value = Qnil; 4187 Lisp_Object lface, value = Qnil;
4188 4188
4189 CHECK_SYMBOL (symbol, 0); 4189 CHECK_SYMBOL (symbol, 0);
4190 CHECK_SYMBOL (keyword, 1); 4190 CHECK_SYMBOL (keyword, 1);
4191 4191
4192 if (EQ (frame, Qt)) 4192 if (EQ (frame, Qt))
4193 lface = lface_from_face_name (NULL, symbol, 1); 4193 lface = lface_from_face_name (NULL, symbol, 1);
4242 Value is nil if ATTR doesn't have a discrete set of valid values.") 4242 Value is nil if ATTR doesn't have a discrete set of valid values.")
4243 (attr) 4243 (attr)
4244 Lisp_Object attr; 4244 Lisp_Object attr;
4245 { 4245 {
4246 Lisp_Object result = Qnil; 4246 Lisp_Object result = Qnil;
4247 4247
4248 CHECK_SYMBOL (attr, 0); 4248 CHECK_SYMBOL (attr, 0);
4249 4249
4250 if (EQ (attr, QCweight) 4250 if (EQ (attr, QCweight)
4251 || EQ (attr, QCslant) 4251 || EQ (attr, QCslant)
4252 || EQ (attr, QCwidth)) 4252 || EQ (attr, QCwidth))
4253 { 4253 {
4254 /* Extract permissible symbols from tables. */ 4254 /* Extract permissible symbols from tables. */
4255 struct table_entry *table; 4255 struct table_entry *table;
4256 int i, dim; 4256 int i, dim;
4257 4257
4258 if (EQ (attr, QCweight)) 4258 if (EQ (attr, QCweight))
4259 table = weight_table, dim = DIM (weight_table); 4259 table = weight_table, dim = DIM (weight_table);
4260 else if (EQ (attr, QCslant)) 4260 else if (EQ (attr, QCslant))
4261 table = slant_table, dim = DIM (slant_table); 4261 table = slant_table, dim = DIM (slant_table);
4262 else 4262 else
4284 else if (EQ (attr, QCinverse_video) || EQ (attr, QCreverse_video)) 4284 else if (EQ (attr, QCinverse_video) || EQ (attr, QCreverse_video))
4285 result = Fcons (Qt, Fcons (Qnil, Qnil)); 4285 result = Fcons (Qt, Fcons (Qnil, Qnil));
4286 4286
4287 return result; 4287 return result;
4288 } 4288 }
4289 4289
4290 4290
4291 DEFUN ("internal-merge-in-global-face", Finternal_merge_in_global_face, 4291 DEFUN ("internal-merge-in-global-face", Finternal_merge_in_global_face,
4292 Sinternal_merge_in_global_face, 2, 2, 0, 4292 Sinternal_merge_in_global_face, 2, 2, 0,
4293 "Add attributes from frame-default definition of FACE to FACE on FRAME.") 4293 "Add attributes from frame-default definition of FACE to FACE on FRAME.")
4294 (face, frame) 4294 (face, frame)
4295 Lisp_Object face, frame; 4295 Lisp_Object face, frame;
4296 { 4296 {
4297 Lisp_Object global_lface, local_lface; 4297 Lisp_Object global_lface, local_lface;
4309 /* The following function is implemented for compatibility with 20.2. 4309 /* The following function is implemented for compatibility with 20.2.
4310 The function is used in x-resolve-fonts when it is asked to 4310 The function is used in x-resolve-fonts when it is asked to
4311 return fonts with the same size as the font of a face. This is 4311 return fonts with the same size as the font of a face. This is
4312 done in fontset.el. */ 4312 done in fontset.el. */
4313 4313
4314 DEFUN ("face-font", Fface_font, Sface_font, 1, 2, 0, 4314 DEFUN ("face-font", Fface_font, Sface_font, 1, 2, 0,
4315 "Return the font name of face FACE, or nil if it is unspecified.\n\ 4315 "Return the font name of face FACE, or nil if it is unspecified.\n\
4316 If the optional argument FRAME is given, report on face FACE in that frame.\n\ 4316 If the optional argument FRAME is given, report on face FACE in that frame.\n\
4317 If FRAME is t, report on the defaults for face FACE (for new frames).\n\ 4317 If FRAME is t, report on the defaults for face FACE (for new frames).\n\
4318 The font default for a face is either nil, or a list\n\ 4318 The font default for a face is either nil, or a list\n\
4319 of the form (bold), (italic) or (bold italic).\n\ 4319 of the form (bold), (italic) or (bold italic).\n\
4327 Lisp_Object lface = lface_from_face_name (NULL, face, 1); 4327 Lisp_Object lface = lface_from_face_name (NULL, face, 1);
4328 4328
4329 if (!UNSPECIFIEDP (LFACE_WEIGHT (lface)) 4329 if (!UNSPECIFIEDP (LFACE_WEIGHT (lface))
4330 && !EQ (LFACE_WEIGHT (lface), Qnormal)) 4330 && !EQ (LFACE_WEIGHT (lface), Qnormal))
4331 result = Fcons (Qbold, result); 4331 result = Fcons (Qbold, result);
4332 4332
4333 if (!NILP (LFACE_SLANT (lface)) 4333 if (!NILP (LFACE_SLANT (lface))
4334 && !EQ (LFACE_SLANT (lface), Qnormal)) 4334 && !EQ (LFACE_SLANT (lface), Qnormal))
4335 result = Fcons (Qitalic, result); 4335 result = Fcons (Qitalic, result);
4336 4336
4337 return result; 4337 return result;
4338 } 4338 }
4339 else 4339 else
4340 { 4340 {
4341 struct frame *f = frame_or_selected_frame (frame, 1); 4341 struct frame *f = frame_or_selected_frame (frame, 1);
4374 case Lisp_String: 4374 case Lisp_String:
4375 equal_p = (XSTRING (a)->size == XSTRING (b)->size 4375 equal_p = (XSTRING (a)->size == XSTRING (b)->size
4376 && bcmp (XSTRING (a)->data, XSTRING (b)->data, 4376 && bcmp (XSTRING (a)->data, XSTRING (b)->data,
4377 XSTRING (a)->size) == 0); 4377 XSTRING (a)->size) == 0);
4378 break; 4378 break;
4379 4379
4380 case Lisp_Int: 4380 case Lisp_Int:
4381 case Lisp_Symbol: 4381 case Lisp_Symbol:
4382 equal_p = 0; 4382 equal_p = 0;
4383 break; 4383 break;
4384 4384
4385 default: 4385 default:
4386 equal_p = !NILP (Fequal (a, b)); 4386 equal_p = !NILP (Fequal (a, b));
4387 break; 4387 break;
4388 } 4388 }
4389 } 4389 }
4390 } 4390 }
4391 4391
4392 return equal_p; 4392 return equal_p;
4393 } 4393 }
4394 4394
4395 4395
4396 DEFUN ("internal-lisp-face-equal-p", Finternal_lisp_face_equal_p, 4396 DEFUN ("internal-lisp-face-equal-p", Finternal_lisp_face_equal_p,
4403 Lisp_Object face1, face2, frame; 4403 Lisp_Object face1, face2, frame;
4404 { 4404 {
4405 int equal_p; 4405 int equal_p;
4406 struct frame *f; 4406 struct frame *f;
4407 Lisp_Object lface1, lface2; 4407 Lisp_Object lface1, lface2;
4408 4408
4409 if (EQ (frame, Qt)) 4409 if (EQ (frame, Qt))
4410 f = NULL; 4410 f = NULL;
4411 else 4411 else
4412 /* Don't use check_x_frame here because this function is called 4412 /* Don't use check_x_frame here because this function is called
4413 before X frames exist. At that time, if FRAME is nil, 4413 before X frames exist. At that time, if FRAME is nil,
4420 equal_p = lface_equal_p (XVECTOR (lface1)->contents, 4420 equal_p = lface_equal_p (XVECTOR (lface1)->contents,
4421 XVECTOR (lface2)->contents); 4421 XVECTOR (lface2)->contents);
4422 return equal_p ? Qt : Qnil; 4422 return equal_p ? Qt : Qnil;
4423 } 4423 }
4424 4424
4425 4425
4426 DEFUN ("internal-lisp-face-empty-p", Finternal_lisp_face_empty_p, 4426 DEFUN ("internal-lisp-face-empty-p", Finternal_lisp_face_empty_p,
4427 Sinternal_lisp_face_empty_p, 1, 2, 0, 4427 Sinternal_lisp_face_empty_p, 1, 2, 0,
4428 "True if FACE has no attribute specified.\n\ 4428 "True if FACE has no attribute specified.\n\
4429 If the optional argument FRAME is given, report on face FACE in that frame.\n\ 4429 If the optional argument FRAME is given, report on face FACE in that frame.\n\
4430 If FRAME is t, report on the defaults for face FACE (for new frames).\n\ 4430 If FRAME is t, report on the defaults for face FACE (for new frames).\n\
4438 4438
4439 if (NILP (frame)) 4439 if (NILP (frame))
4440 frame = selected_frame; 4440 frame = selected_frame;
4441 CHECK_LIVE_FRAME (frame, 0); 4441 CHECK_LIVE_FRAME (frame, 0);
4442 f = XFRAME (frame); 4442 f = XFRAME (frame);
4443 4443
4444 if (EQ (frame, Qt)) 4444 if (EQ (frame, Qt))
4445 lface = lface_from_face_name (NULL, face, 1); 4445 lface = lface_from_face_name (NULL, face, 1);
4446 else 4446 else
4447 lface = lface_from_face_name (f, face, 1); 4447 lface = lface_from_face_name (f, face, 1);
4448 4448
4449 for (i = 1; i < LFACE_VECTOR_SIZE; ++i) 4449 for (i = 1; i < LFACE_VECTOR_SIZE; ++i)
4450 if (!UNSPECIFIEDP (XVECTOR (lface)->contents[i])) 4450 if (!UNSPECIFIEDP (XVECTOR (lface)->contents[i]))
4451 break; 4451 break;
4452 4452
4453 return i == LFACE_VECTOR_SIZE ? Qt : Qnil; 4453 return i == LFACE_VECTOR_SIZE ? Qt : Qnil;
4454 } 4454 }
4455 4455
4456 4456
4457 DEFUN ("frame-face-alist", Fframe_face_alist, Sframe_face_alist, 4457 DEFUN ("frame-face-alist", Fframe_face_alist, Sframe_face_alist,
4458 0, 1, 0, 4458 0, 1, 0,
4459 "Return an alist of frame-local faces defined on FRAME.\n\ 4459 "Return an alist of frame-local faces defined on FRAME.\n\
4460 For internal use only.") 4460 For internal use only.")
4461 (frame) 4461 (frame)
4462 Lisp_Object frame; 4462 Lisp_Object frame;
4463 { 4463 {
4563 if (face->gc) 4563 if (face->gc)
4564 { 4564 {
4565 x_free_gc (f, face->gc); 4565 x_free_gc (f, face->gc);
4566 face->gc = 0; 4566 face->gc = 0;
4567 } 4567 }
4568 4568
4569 free_face_colors (f, face); 4569 free_face_colors (f, face);
4570 x_destroy_bitmap (f, face->stipple); 4570 x_destroy_bitmap (f, face->stipple);
4571 } 4571 }
4572 #endif /* HAVE_WINDOW_SYSTEM */ 4572 #endif /* HAVE_WINDOW_SYSTEM */
4573 4573
4585 struct frame *f; 4585 struct frame *f;
4586 struct face *face; 4586 struct face *face;
4587 { 4587 {
4588 #ifdef HAVE_WINDOW_SYSTEM 4588 #ifdef HAVE_WINDOW_SYSTEM
4589 xassert (FRAME_WINDOW_P (f)); 4589 xassert (FRAME_WINDOW_P (f));
4590 4590
4591 if (face->gc == 0) 4591 if (face->gc == 0)
4592 { 4592 {
4593 XGCValues xgcv; 4593 XGCValues xgcv;
4594 unsigned long mask = GCForeground | GCBackground | GCGraphicsExposures; 4594 unsigned long mask = GCForeground | GCBackground | GCGraphicsExposures;
4595 4595
4699 for (i = 0; i < c->used; ++i) 4699 for (i = 0; i < c->used; ++i)
4700 { 4700 {
4701 free_realized_face (f, c->faces_by_id[i]); 4701 free_realized_face (f, c->faces_by_id[i]);
4702 c->faces_by_id[i] = NULL; 4702 c->faces_by_id[i] = NULL;
4703 } 4703 }
4704 4704
4705 c->used = 0; 4705 c->used = 0;
4706 size = FACE_CACHE_BUCKETS_SIZE * sizeof *c->buckets; 4706 size = FACE_CACHE_BUCKETS_SIZE * sizeof *c->buckets;
4707 bzero (c->buckets, size); 4707 bzero (c->buckets, size);
4708 4708
4709 /* Must do a thorough redisplay the next time. Mark current 4709 /* Must do a thorough redisplay the next time. Mark current
4735 4735
4736 /* We must block input here because we can't process X events safely 4736 /* We must block input here because we can't process X events safely
4737 while only some faces are freed, or when the frame's current 4737 while only some faces are freed, or when the frame's current
4738 matrix still references freed faces. */ 4738 matrix still references freed faces. */
4739 BLOCK_INPUT; 4739 BLOCK_INPUT;
4740 4740
4741 for (i = 0; i < cache->used; i++) 4741 for (i = 0; i < cache->used; i++)
4742 { 4742 {
4743 face = cache->faces_by_id[i]; 4743 face = cache->faces_by_id[i];
4744 if (face 4744 if (face
4745 && face != face->ascii_face 4745 && face != face->ascii_face
4747 { 4747 {
4748 uncache_face (cache, face); 4748 uncache_face (cache, face);
4749 free_realized_face (f, face); 4749 free_realized_face (f, face);
4750 } 4750 }
4751 } 4751 }
4752 4752
4753 /* Must do a thorough redisplay the next time. Mark current 4753 /* Must do a thorough redisplay the next time. Mark current
4754 matrices as invalid because they will reference faces freed 4754 matrices as invalid because they will reference faces freed
4755 above. This function is also called when a frame is destroyed. 4755 above. This function is also called when a frame is destroyed.
4756 In this case, the root window of F is nil. */ 4756 In this case, the root window of F is nil. */
4757 if (WINDOWP (f->root_window)) 4757 if (WINDOWP (f->root_window))
4758 { 4758 {
4759 clear_current_matrices (f); 4759 clear_current_matrices (f);
4760 ++windows_or_buffers_changed; 4760 ++windows_or_buffers_changed;
4761 } 4761 }
4762 4762
4763 UNBLOCK_INPUT; 4763 UNBLOCK_INPUT;
4764 } 4764 }
4765 4765
4766 4766
4767 /* Free all realized faces on FRAME or on all frames if FRAME is nil. 4767 /* Free all realized faces on FRAME or on all frames if FRAME is nil.
4845 slot as FACE->id. */ 4845 slot as FACE->id. */
4846 for (i = 0; i < c->used; ++i) 4846 for (i = 0; i < c->used; ++i)
4847 if (c->faces_by_id[i] == NULL) 4847 if (c->faces_by_id[i] == NULL)
4848 break; 4848 break;
4849 face->id = i; 4849 face->id = i;
4850 4850
4851 /* Maybe enlarge C->faces_by_id. */ 4851 /* Maybe enlarge C->faces_by_id. */
4852 if (i == c->used && c->used == c->size) 4852 if (i == c->used && c->used == c->size)
4853 { 4853 {
4854 int new_size = 2 * c->size; 4854 int new_size = 2 * c->size;
4855 int sz = new_size * sizeof *c->faces_by_id; 4855 int sz = new_size * sizeof *c->faces_by_id;
4869 ++n; 4869 ++n;
4870 4870
4871 xassert (n == 1); 4871 xassert (n == 1);
4872 } 4872 }
4873 #endif /* GLYPH_DEBUG */ 4873 #endif /* GLYPH_DEBUG */
4874 4874
4875 c->faces_by_id[i] = face; 4875 c->faces_by_id[i] = face;
4876 if (i == c->used) 4876 if (i == c->used)
4877 ++c->used; 4877 ++c->used;
4878 } 4878 }
4879 4879
4884 uncache_face (c, face) 4884 uncache_face (c, face)
4885 struct face_cache *c; 4885 struct face_cache *c;
4886 struct face *face; 4886 struct face *face;
4887 { 4887 {
4888 int i = face->hash % FACE_CACHE_BUCKETS_SIZE; 4888 int i = face->hash % FACE_CACHE_BUCKETS_SIZE;
4889 4889
4890 if (face->prev) 4890 if (face->prev)
4891 face->prev->next = face->next; 4891 face->prev->next = face->next;
4892 else 4892 else
4893 c->buckets[i] = face->next; 4893 c->buckets[i] = face->next;
4894 4894
4895 if (face->next) 4895 if (face->next)
4896 face->next->prev = face->prev; 4896 face->next->prev = face->prev;
4897 4897
4898 c->faces_by_id[face->id] = NULL; 4898 c->faces_by_id[face->id] = NULL;
4899 if (face->id == c->used) 4899 if (face->id == c->used)
4900 --c->used; 4900 --c->used;
4901 } 4901 }
4902 4902
4923 check_lface_attrs (attr); 4923 check_lface_attrs (attr);
4924 4924
4925 /* Look up ATTR in the face cache. */ 4925 /* Look up ATTR in the face cache. */
4926 hash = lface_hash (attr); 4926 hash = lface_hash (attr);
4927 i = hash % FACE_CACHE_BUCKETS_SIZE; 4927 i = hash % FACE_CACHE_BUCKETS_SIZE;
4928 4928
4929 for (face = cache->buckets[i]; face; face = face->next) 4929 for (face = cache->buckets[i]; face; face = face->next)
4930 if (face->hash == hash 4930 if (face->hash == hash
4931 && (!FRAME_WINDOW_P (f) 4931 && (!FRAME_WINDOW_P (f)
4932 || FACE_SUITABLE_FOR_CHAR_P (face, c)) 4932 || FACE_SUITABLE_FOR_CHAR_P (face, c))
4933 && lface_equal_p (face->lface, attr)) 4933 && lface_equal_p (face->lface, attr))
4948 #if 0 4948 #if 0
4949 if (FRAME_WINDOW_P (f)) 4949 if (FRAME_WINDOW_P (f))
4950 xassert (FACE_SUITABLE_FOR_CHAR_P (face, c)); 4950 xassert (FACE_SUITABLE_FOR_CHAR_P (face, c));
4951 #endif 4951 #endif
4952 #endif /* GLYPH_DEBUG */ 4952 #endif /* GLYPH_DEBUG */
4953 4953
4954 return face->id; 4954 return face->id;
4955 } 4955 }
4956 4956
4957 4957
4958 /* Return the face id of the realized face for named face SYMBOL on 4958 /* Return the face id of the realized face for named face SYMBOL on
4982 ascii_face_of_lisp_face (f, lface_id) 4982 ascii_face_of_lisp_face (f, lface_id)
4983 struct frame *f; 4983 struct frame *f;
4984 int lface_id; 4984 int lface_id;
4985 { 4985 {
4986 int face_id; 4986 int face_id;
4987 4987
4988 if (lface_id >= 0 && lface_id < lface_id_to_name_size) 4988 if (lface_id >= 0 && lface_id < lface_id_to_name_size)
4989 { 4989 {
4990 Lisp_Object face_name = lface_id_to_name[lface_id]; 4990 Lisp_Object face_name = lface_id_to_name[lface_id];
4991 face_id = lookup_named_face (f, face_name, 0); 4991 face_id = lookup_named_face (f, face_name, 0);
4992 } 4992 }
5019 return face_id; 5019 return face_id;
5020 5020
5021 /* Try in increments of 1/2 pt. */ 5021 /* Try in increments of 1/2 pt. */
5022 delta = steps < 0 ? 5 : -5; 5022 delta = steps < 0 ? 5 : -5;
5023 steps = abs (steps); 5023 steps = abs (steps);
5024 5024
5025 face = FACE_FROM_ID (f, face_id); 5025 face = FACE_FROM_ID (f, face_id);
5026 bcopy (face->lface, attrs, sizeof attrs); 5026 bcopy (face->lface, attrs, sizeof attrs);
5027 pt = last_pt = XFASTINT (attrs[LFACE_HEIGHT_INDEX]); 5027 pt = last_pt = XFASTINT (attrs[LFACE_HEIGHT_INDEX]);
5028 new_face_id = face_id; 5028 new_face_id = face_id;
5029 last_height = FONT_HEIGHT (face->font); 5029 last_height = FONT_HEIGHT (face->font);
5051 return new_face_id; 5051 return new_face_id;
5052 5052
5053 #else /* not HAVE_WINDOW_SYSTEM */ 5053 #else /* not HAVE_WINDOW_SYSTEM */
5054 5054
5055 return face_id; 5055 return face_id;
5056 5056
5057 #endif /* not HAVE_WINDOW_SYSTEM */ 5057 #endif /* not HAVE_WINDOW_SYSTEM */
5058 } 5058 }
5059 5059
5060 5060
5061 /* Return a face for charset ASCII that is like the face with id 5061 /* Return a face for charset ASCII that is like the face with id
5078 face = FACE_FROM_ID (f, face_id); 5078 face = FACE_FROM_ID (f, face_id);
5079 bcopy (face->lface, attrs, sizeof attrs); 5079 bcopy (face->lface, attrs, sizeof attrs);
5080 attrs[LFACE_HEIGHT_INDEX] = make_number (height); 5080 attrs[LFACE_HEIGHT_INDEX] = make_number (height);
5081 face_id = lookup_face (f, attrs, 0, NULL); 5081 face_id = lookup_face (f, attrs, 0, NULL);
5082 #endif /* HAVE_WINDOW_SYSTEM */ 5082 #endif /* HAVE_WINDOW_SYSTEM */
5083 5083
5084 return face_id; 5084 return face_id;
5085 } 5085 }
5086 5086
5087 /* Return the face id of the realized face for named face SYMBOL on 5087 /* Return the face id of the realized face for named face SYMBOL on
5088 frame F suitable for displaying character C, and use attributes of 5088 frame F suitable for displaying character C, and use attributes of
5131 Lisp_Object order; 5131 Lisp_Object order;
5132 { 5132 {
5133 Lisp_Object list; 5133 Lisp_Object list;
5134 int i; 5134 int i;
5135 int indices[4]; 5135 int indices[4];
5136 5136
5137 CHECK_LIST (order, 0); 5137 CHECK_LIST (order, 0);
5138 bzero (indices, sizeof indices); 5138 bzero (indices, sizeof indices);
5139 i = 0; 5139 i = 0;
5140 5140
5141 for (list = order; 5141 for (list = order;
5172 if (bcmp (indices, font_sort_order, sizeof indices) != 0) 5172 if (bcmp (indices, font_sort_order, sizeof indices) != 0)
5173 { 5173 {
5174 bcopy (indices, font_sort_order, sizeof font_sort_order); 5174 bcopy (indices, font_sort_order, sizeof font_sort_order);
5175 free_all_realized_faces (Qnil); 5175 free_all_realized_faces (Qnil);
5176 } 5176 }
5177 5177
5178 return Qnil; 5178 return Qnil;
5179 } 5179 }
5180 5180
5181 5181
5182 DEFUN ("internal-set-alternative-font-family-alist", 5182 DEFUN ("internal-set-alternative-font-family-alist",
5230 int *values; 5230 int *values;
5231 struct font_name *font1, *font2; 5231 struct font_name *font1, *font2;
5232 int compare_pt_p; 5232 int compare_pt_p;
5233 { 5233 {
5234 int i; 5234 int i;
5235 5235
5236 for (i = 0; i < 4; ++i) 5236 for (i = 0; i < 4; ++i)
5237 { 5237 {
5238 int xlfd_idx = font_sort_order[i]; 5238 int xlfd_idx = font_sort_order[i];
5239 5239
5240 if (compare_pt_p || xlfd_idx != XLFD_POINT_SIZE) 5240 if (compare_pt_p || xlfd_idx != XLFD_POINT_SIZE)
5241 { 5241 {
5242 int delta1 = abs (values[i] - font1->numeric[xlfd_idx]); 5242 int delta1 = abs (values[i] - font1->numeric[xlfd_idx]);
5243 int delta2 = abs (values[i] - font2->numeric[xlfd_idx]); 5243 int delta2 = abs (values[i] - font2->numeric[xlfd_idx]);
5244 5244
5245 if (delta1 > delta2) 5245 if (delta1 > delta2)
5246 return 0; 5246 return 0;
5247 else if (delta1 < delta2) 5247 else if (delta1 < delta2)
5248 return 1; 5248 return 1;
5249 else 5249 else
5256 && font2->numeric[xlfd_idx] < values[i]) 5256 && font2->numeric[xlfd_idx] < values[i])
5257 return 1; 5257 return 1;
5258 } 5258 }
5259 } 5259 }
5260 } 5260 }
5261 5261
5262 return 0; 5262 return 0;
5263 } 5263 }
5264 5264
5265 5265
5266 #if SCALABLE_FONTS 5266 #if SCALABLE_FONTS
5273 exact_face_match_p (specified, font) 5273 exact_face_match_p (specified, font)
5274 int *specified; 5274 int *specified;
5275 struct font_name *font; 5275 struct font_name *font;
5276 { 5276 {
5277 int i; 5277 int i;
5278 5278
5279 for (i = 0; i < 4; ++i) 5279 for (i = 0; i < 4; ++i)
5280 if (specified[i] != font->numeric[font_sort_order[i]]) 5280 if (specified[i] != font->numeric[font_sort_order[i]])
5281 break; 5281 break;
5282 5282
5283 return i == 4; 5283 return i == 4;
5310 else 5310 else
5311 { 5311 {
5312 pt = specified_pt; 5312 pt = specified_pt;
5313 pixel_value = resy / 720.0 * pt; 5313 pixel_value = resy / 720.0 * pt;
5314 } 5314 }
5315 5315
5316 /* Set point size of the font. */ 5316 /* Set point size of the font. */
5317 sprintf (point_size, "%d", (int) pt); 5317 sprintf (point_size, "%d", (int) pt);
5318 font->fields[XLFD_POINT_SIZE] = point_size; 5318 font->fields[XLFD_POINT_SIZE] = point_size;
5319 font->numeric[XLFD_POINT_SIZE] = pt; 5319 font->numeric[XLFD_POINT_SIZE] = pt;
5320 5320
5321 /* Set pixel size. */ 5321 /* Set pixel size. */
5322 sprintf (pixel_size, "%d", pixel_value); 5322 sprintf (pixel_size, "%d", pixel_value);
5323 font->fields[XLFD_PIXEL_SIZE] = pixel_size; 5323 font->fields[XLFD_PIXEL_SIZE] = pixel_size;
5324 font->numeric[XLFD_PIXEL_SIZE] = pixel_value; 5324 font->numeric[XLFD_PIXEL_SIZE] = pixel_value;
5325 5325
5326 /* If font doesn't specify its resolution, use the 5326 /* If font doesn't specify its resolution, use the
5327 resolution of the display. */ 5327 resolution of the display. */
5328 if (font->numeric[XLFD_RESY] == 0) 5328 if (font->numeric[XLFD_RESY] == 0)
5329 { 5329 {
5330 char buffer[20]; 5330 char buffer[20];
5331 sprintf (buffer, "%d", (int) resy); 5331 sprintf (buffer, "%d", (int) resy);
5332 font->fields[XLFD_RESY] = buffer; 5332 font->fields[XLFD_RESY] = buffer;
5333 font->numeric[XLFD_RESY] = resy; 5333 font->numeric[XLFD_RESY] = resy;
5334 } 5334 }
5335 5335
5336 if (strcmp (font->fields[XLFD_RESX], "0") == 0) 5336 if (strcmp (font->fields[XLFD_RESX], "0") == 0)
5337 { 5337 {
5338 char buffer[20]; 5338 char buffer[20];
5339 int resx = FRAME_X_DISPLAY_INFO (f)->resx; 5339 int resx = FRAME_X_DISPLAY_INFO (f)->resx;
5340 sprintf (buffer, "%d", resx); 5340 sprintf (buffer, "%d", resx);
5358 if (EQ (Vscalable_fonts_allowed, Qt)) 5358 if (EQ (Vscalable_fonts_allowed, Qt))
5359 return 1; 5359 return 1;
5360 else if (CONSP (Vscalable_fonts_allowed)) 5360 else if (CONSP (Vscalable_fonts_allowed))
5361 { 5361 {
5362 Lisp_Object tail, regexp; 5362 Lisp_Object tail, regexp;
5363 5363
5364 for (tail = Vscalable_fonts_allowed; CONSP (tail); tail = XCDR (tail)) 5364 for (tail = Vscalable_fonts_allowed; CONSP (tail); tail = XCDR (tail))
5365 { 5365 {
5366 regexp = XCAR (tail); 5366 regexp = XCAR (tail);
5367 if (STRINGP (regexp) 5367 if (STRINGP (regexp)
5368 && fast_c_string_match_ignore_case (regexp, name) >= 0) 5368 && fast_c_string_match_ignore_case (regexp, name) >= 0)
5369 return 1; 5369 return 1;
5370 } 5370 }
5371 } 5371 }
5372 5372
5373 return 0; 5373 return 0;
5374 } 5374 }
5375 5375
5376 #endif /* SCALABLE_FONTS != 0 */ 5376 #endif /* SCALABLE_FONTS != 0 */
5377 5377
5400 /* Make specified font attributes available in `specified', 5400 /* Make specified font attributes available in `specified',
5401 indexed by sort order. */ 5401 indexed by sort order. */
5402 for (i = 0; i < DIM (font_sort_order); ++i) 5402 for (i = 0; i < DIM (font_sort_order); ++i)
5403 { 5403 {
5404 int xlfd_idx = font_sort_order[i]; 5404 int xlfd_idx = font_sort_order[i];
5405 5405
5406 if (xlfd_idx == XLFD_SWIDTH) 5406 if (xlfd_idx == XLFD_SWIDTH)
5407 specified[i] = face_numeric_swidth (attrs[LFACE_SWIDTH_INDEX]); 5407 specified[i] = face_numeric_swidth (attrs[LFACE_SWIDTH_INDEX]);
5408 else if (xlfd_idx == XLFD_POINT_SIZE) 5408 else if (xlfd_idx == XLFD_POINT_SIZE)
5409 specified[i] = pt = XFASTINT (attrs[LFACE_HEIGHT_INDEX]); 5409 specified[i] = pt = XFASTINT (attrs[LFACE_HEIGHT_INDEX]);
5410 else if (xlfd_idx == XLFD_WEIGHT) 5410 else if (xlfd_idx == XLFD_WEIGHT)
5417 5417
5418 #if SCALABLE_FONTS 5418 #if SCALABLE_FONTS
5419 5419
5420 /* Set to 1 */ 5420 /* Set to 1 */
5421 exact_p = 0; 5421 exact_p = 0;
5422 5422
5423 /* Start with the first non-scalable font in the list. */ 5423 /* Start with the first non-scalable font in the list. */
5424 for (i = 0; i < nfonts; ++i) 5424 for (i = 0; i < nfonts; ++i)
5425 if (!font_scalable_p (fonts + i)) 5425 if (!font_scalable_p (fonts + i))
5426 break; 5426 break;
5427 5427
5428 /* Find the best match among the non-scalable fonts. */ 5428 /* Find the best match among the non-scalable fonts. */
5429 if (i < nfonts) 5429 if (i < nfonts)
5430 { 5430 {
5431 best = fonts + i; 5431 best = fonts + i;
5432 5432
5433 for (i = 1; i < nfonts; ++i) 5433 for (i = 1; i < nfonts; ++i)
5434 if (!font_scalable_p (fonts + i) 5434 if (!font_scalable_p (fonts + i)
5435 && better_font_p (specified, fonts + i, best, 1)) 5435 && better_font_p (specified, fonts + i, best, 1))
5436 { 5436 {
5437 best = fonts + i; 5437 best = fonts + i;
5438 5438
5439 exact_p = exact_face_match_p (specified, best); 5439 exact_p = exact_face_match_p (specified, best);
5440 if (exact_p) 5440 if (exact_p)
5441 break; 5441 break;
5442 } 5442 }
5443 5443
5444 } 5444 }
5445 else 5445 else
5446 best = NULL; 5446 best = NULL;
5447 5447
5448 /* Unless we found an exact match among non-scalable fonts, see if 5448 /* Unless we found an exact match among non-scalable fonts, see if
5450 if (!exact_p) 5450 if (!exact_p)
5451 { 5451 {
5452 /* A scalable font is better if 5452 /* A scalable font is better if
5453 5453
5454 1. its weight, slant, swidth attributes are better, or. 5454 1. its weight, slant, swidth attributes are better, or.
5455 5455
5456 2. the best non-scalable font doesn't have the required 5456 2. the best non-scalable font doesn't have the required
5457 point size, and the scalable fonts weight, slant, swidth 5457 point size, and the scalable fonts weight, slant, swidth
5458 isn't worse. */ 5458 isn't worse. */
5459 5459
5460 int non_scalable_has_exact_height_p; 5460 int non_scalable_has_exact_height_p;
5461 5461
5462 if (best && best->numeric[XLFD_POINT_SIZE] == pt) 5462 if (best && best->numeric[XLFD_POINT_SIZE] == pt)
5463 non_scalable_has_exact_height_p = 1; 5463 non_scalable_has_exact_height_p = 1;
5464 else 5464 else
5465 non_scalable_has_exact_height_p = 0; 5465 non_scalable_has_exact_height_p = 0;
5466 5466
5467 for (i = 0; i < nfonts; ++i) 5467 for (i = 0; i < nfonts; ++i)
5468 if (font_scalable_p (fonts + i)) 5468 if (font_scalable_p (fonts + i))
5469 { 5469 {
5470 if (best == NULL 5470 if (best == NULL
5471 || better_font_p (specified, fonts + i, best, 0) 5471 || better_font_p (specified, fonts + i, best, 0)
5477 5477
5478 if (font_scalable_p (best)) 5478 if (font_scalable_p (best))
5479 font_name = build_scalable_font_name (f, best, pt); 5479 font_name = build_scalable_font_name (f, best, pt);
5480 else 5480 else
5481 font_name = build_font_name (best); 5481 font_name = build_font_name (best);
5482 5482
5483 #else /* !SCALABLE_FONTS */ 5483 #else /* !SCALABLE_FONTS */
5484 5484
5485 /* Find the best non-scalable font. */ 5485 /* Find the best non-scalable font. */
5486 best = fonts; 5486 best = fonts;
5487 5487
5488 for (i = 1; i < nfonts; ++i) 5488 for (i = 1; i < nfonts; ++i)
5489 { 5489 {
5490 xassert (!font_scalable_p (fonts + i)); 5490 xassert (!font_scalable_p (fonts + i));
5491 if (better_font_p (specified, fonts + i, best, 1)) 5491 if (better_font_p (specified, fonts + i, best, 1))
5492 best = fonts + i; 5492 best = fonts + i;
5493 } 5493 }
5494 5494
5495 font_name = build_font_name (best); 5495 font_name = build_font_name (best);
5496 5496
5497 #endif /* !SCALABLE_FONTS */ 5497 #endif /* !SCALABLE_FONTS */
5498 5498
5499 /* Free font_name structures. */ 5499 /* Free font_name structures. */
5500 free_font_names (fonts, nfonts); 5500 free_font_names (fonts, nfonts);
5501 5501
5502 return font_name; 5502 return font_name;
5503 } 5503 }
5504 5504
5505 5505
5506 /* Try to get a list of fonts on frame F with font family FAMILY and 5506 /* Try to get a list of fonts on frame F with font family FAMILY and
5517 { 5517 {
5518 int nfonts; 5518 int nfonts;
5519 5519
5520 if (NILP (family) && STRINGP (attrs[LFACE_FAMILY_INDEX])) 5520 if (NILP (family) && STRINGP (attrs[LFACE_FAMILY_INDEX]))
5521 family = attrs[LFACE_FAMILY_INDEX]; 5521 family = attrs[LFACE_FAMILY_INDEX];
5522 5522
5523 nfonts = font_list (f, pattern, family, registry, fonts); 5523 nfonts = font_list (f, pattern, family, registry, fonts);
5524 5524
5525 if (nfonts == 0 && !NILP (family)) 5525 if (nfonts == 0 && !NILP (family))
5526 { 5526 {
5527 Lisp_Object alter; 5527 Lisp_Object alter;
5528 5528
5529 /* Try alternative font families from 5529 /* Try alternative font families from
5530 Vface_alternative_font_family_alist. */ 5530 Vface_alternative_font_family_alist. */
5531 alter = Fassoc (family, Vface_alternative_font_family_alist); 5531 alter = Fassoc (family, Vface_alternative_font_family_alist);
5532 if (CONSP (alter)) 5532 if (CONSP (alter))
5533 for (alter = XCDR (alter); 5533 for (alter = XCDR (alter);
5535 alter = XCDR (alter)) 5535 alter = XCDR (alter))
5536 { 5536 {
5537 if (STRINGP (XCAR (alter))) 5537 if (STRINGP (XCAR (alter)))
5538 nfonts = font_list (f, Qnil, XCAR (alter), registry, fonts); 5538 nfonts = font_list (f, Qnil, XCAR (alter), registry, fonts);
5539 } 5539 }
5540 5540
5541 /* Try font family of the default face or "fixed". */ 5541 /* Try font family of the default face or "fixed". */
5542 if (nfonts == 0) 5542 if (nfonts == 0)
5543 { 5543 {
5544 struct face *dflt = FACE_FROM_ID (f, DEFAULT_FACE_ID); 5544 struct face *dflt = FACE_FROM_ID (f, DEFAULT_FACE_ID);
5545 if (dflt) 5545 if (dflt)
5546 family = dflt->lface[LFACE_FAMILY_INDEX]; 5546 family = dflt->lface[LFACE_FAMILY_INDEX];
5547 else 5547 else
5548 family = build_string ("fixed"); 5548 family = build_string ("fixed");
5549 nfonts = font_list (f, Qnil, family, registry, fonts); 5549 nfonts = font_list (f, Qnil, family, registry, fonts);
5550 } 5550 }
5551 5551
5552 /* Try any family with the given registry. */ 5552 /* Try any family with the given registry. */
5553 if (nfonts == 0) 5553 if (nfonts == 0)
5554 nfonts = font_list (f, Qnil, Qnil, registry, fonts); 5554 nfonts = font_list (f, Qnil, Qnil, registry, fonts);
5555 } 5555 }
5556 5556
5566 face_fontset (attrs) 5566 face_fontset (attrs)
5567 Lisp_Object *attrs; 5567 Lisp_Object *attrs;
5568 { 5568 {
5569 Lisp_Object name; 5569 Lisp_Object name;
5570 int fontset; 5570 int fontset;
5571 5571
5572 name = attrs[LFACE_FONT_INDEX]; 5572 name = attrs[LFACE_FONT_INDEX];
5573 if (!STRINGP (name)) 5573 if (!STRINGP (name))
5574 return -1; 5574 return -1;
5575 return fs_query_fontset (name, 0); 5575 return fs_query_fontset (name, 0);
5576 } 5576 }
5593 { 5593 {
5594 Lisp_Object pattern; 5594 Lisp_Object pattern;
5595 char *font_name = NULL; 5595 char *font_name = NULL;
5596 struct font_name *fonts; 5596 struct font_name *fonts;
5597 int nfonts; 5597 int nfonts;
5598 5598
5599 /* Get (foundry and) family name and registry (and encoding) name of 5599 /* Get (foundry and) family name and registry (and encoding) name of
5600 a font for C. */ 5600 a font for C. */
5601 pattern = fontset_font_pattern (f, fontset, c); 5601 pattern = fontset_font_pattern (f, fontset, c);
5602 if (NILP (pattern)) 5602 if (NILP (pattern))
5603 { 5603 {
5613 character. */ 5613 character. */
5614 if (STRINGP (attrs[LFACE_FAMILY_INDEX]) 5614 if (STRINGP (attrs[LFACE_FAMILY_INDEX])
5615 && SINGLE_BYTE_CHAR_P (c)) 5615 && SINGLE_BYTE_CHAR_P (c))
5616 XCAR (pattern) = Qnil; 5616 XCAR (pattern) = Qnil;
5617 5617
5618 /* Get a list of fonts matching that pattern and choose the 5618 /* Get a list of fonts matching that pattern and choose the
5619 best match for the specified face attributes from it. */ 5619 best match for the specified face attributes from it. */
5620 nfonts = try_font_list (f, attrs, Qnil, XCAR (pattern), XCDR (pattern), 5620 nfonts = try_font_list (f, attrs, Qnil, XCAR (pattern), XCDR (pattern),
5621 &fonts); 5621 &fonts);
5622 font_name = best_matching_font (f, attrs, fonts, nfonts); 5622 font_name = best_matching_font (f, attrs, fonts, nfonts);
5623 return font_name; 5623 return font_name;
5642 int success_p = 0; 5642 int success_p = 0;
5643 5643
5644 /* Block input there so that we won't be surprised by an X expose 5644 /* Block input there so that we won't be surprised by an X expose
5645 event, for instance without having the faces set up. */ 5645 event, for instance without having the faces set up. */
5646 BLOCK_INPUT; 5646 BLOCK_INPUT;
5647 5647
5648 if (realize_default_face (f)) 5648 if (realize_default_face (f))
5649 { 5649 {
5650 realize_named_face (f, Qmode_line, MODE_LINE_FACE_ID); 5650 realize_named_face (f, Qmode_line, MODE_LINE_FACE_ID);
5651 realize_named_face (f, Qtool_bar, TOOL_BAR_FACE_ID); 5651 realize_named_face (f, Qtool_bar, TOOL_BAR_FACE_ID);
5652 realize_named_face (f, Qfringe, BITMAP_AREA_FACE_ID); 5652 realize_named_face (f, Qfringe, BITMAP_AREA_FACE_ID);
5705 LFACE_SWIDTH (lface) = Qnormal; 5705 LFACE_SWIDTH (lface) = Qnormal;
5706 LFACE_HEIGHT (lface) = make_number (1); 5706 LFACE_HEIGHT (lface) = make_number (1);
5707 LFACE_WEIGHT (lface) = Qnormal; 5707 LFACE_WEIGHT (lface) = Qnormal;
5708 LFACE_SLANT (lface) = Qnormal; 5708 LFACE_SLANT (lface) = Qnormal;
5709 } 5709 }
5710 5710
5711 if (UNSPECIFIEDP (LFACE_UNDERLINE (lface))) 5711 if (UNSPECIFIEDP (LFACE_UNDERLINE (lface)))
5712 LFACE_UNDERLINE (lface) = Qnil; 5712 LFACE_UNDERLINE (lface) = Qnil;
5713 5713
5714 if (UNSPECIFIEDP (LFACE_OVERLINE (lface))) 5714 if (UNSPECIFIEDP (LFACE_OVERLINE (lface)))
5715 LFACE_OVERLINE (lface) = Qnil; 5715 LFACE_OVERLINE (lface) = Qnil;
5716 5716
5717 if (UNSPECIFIEDP (LFACE_STRIKE_THROUGH (lface))) 5717 if (UNSPECIFIEDP (LFACE_STRIKE_THROUGH (lface)))
5718 LFACE_STRIKE_THROUGH (lface) = Qnil; 5718 LFACE_STRIKE_THROUGH (lface) = Qnil;
5719 5719
5720 if (UNSPECIFIEDP (LFACE_BOX (lface))) 5720 if (UNSPECIFIEDP (LFACE_BOX (lface)))
5721 LFACE_BOX (lface) = Qnil; 5721 LFACE_BOX (lface) = Qnil;
5722 5722
5723 if (UNSPECIFIEDP (LFACE_INVERSE (lface))) 5723 if (UNSPECIFIEDP (LFACE_INVERSE (lface)))
5724 LFACE_INVERSE (lface) = Qnil; 5724 LFACE_INVERSE (lface) = Qnil;
5725 5725
5726 if (UNSPECIFIEDP (LFACE_FOREGROUND (lface))) 5726 if (UNSPECIFIEDP (LFACE_FOREGROUND (lface)))
5727 { 5727 {
5728 /* This function is called so early that colors are not yet 5728 /* This function is called so early that colors are not yet
5729 set in the frame parameter list. */ 5729 set in the frame parameter list. */
5730 Lisp_Object color = Fassq (Qforeground_color, f->param_alist); 5730 Lisp_Object color = Fassq (Qforeground_color, f->param_alist);
5731 5731
5732 if (CONSP (color) && STRINGP (XCDR (color))) 5732 if (CONSP (color) && STRINGP (XCDR (color)))
5733 LFACE_FOREGROUND (lface) = XCDR (color); 5733 LFACE_FOREGROUND (lface) = XCDR (color);
5734 else if (FRAME_WINDOW_P (f)) 5734 else if (FRAME_WINDOW_P (f))
5735 return 0; 5735 return 0;
5736 else if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)) 5736 else if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))
5737 LFACE_FOREGROUND (lface) = build_string (unspecified_fg); 5737 LFACE_FOREGROUND (lface) = build_string (unspecified_fg);
5738 else 5738 else
5739 abort (); 5739 abort ();
5740 } 5740 }
5741 5741
5742 if (UNSPECIFIEDP (LFACE_BACKGROUND (lface))) 5742 if (UNSPECIFIEDP (LFACE_BACKGROUND (lface)))
5743 { 5743 {
5744 /* This function is called so early that colors are not yet 5744 /* This function is called so early that colors are not yet
5745 set in the frame parameter list. */ 5745 set in the frame parameter list. */
5746 Lisp_Object color = Fassq (Qbackground_color, f->param_alist); 5746 Lisp_Object color = Fassq (Qbackground_color, f->param_alist);
5751 else if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)) 5751 else if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))
5752 LFACE_BACKGROUND (lface) = build_string (unspecified_bg); 5752 LFACE_BACKGROUND (lface) = build_string (unspecified_bg);
5753 else 5753 else
5754 abort (); 5754 abort ();
5755 } 5755 }
5756 5756
5757 if (UNSPECIFIEDP (LFACE_STIPPLE (lface))) 5757 if (UNSPECIFIEDP (LFACE_STIPPLE (lface)))
5758 LFACE_STIPPLE (lface) = Qnil; 5758 LFACE_STIPPLE (lface) = Qnil;
5759 5759
5760 /* Realize the face; it must be fully-specified now. */ 5760 /* Realize the face; it must be fully-specified now. */
5761 xassert (lface_fully_specified_p (XVECTOR (lface)->contents)); 5761 xassert (lface_fully_specified_p (XVECTOR (lface)->contents));
5818 int c; 5818 int c;
5819 struct face *base_face; 5819 struct face *base_face;
5820 int former_face_id; 5820 int former_face_id;
5821 { 5821 {
5822 struct face *face; 5822 struct face *face;
5823 5823
5824 /* LFACE must be fully specified. */ 5824 /* LFACE must be fully specified. */
5825 xassert (cache != NULL); 5825 xassert (cache != NULL);
5826 check_lface_attrs (attrs); 5826 check_lface_attrs (attrs);
5827 5827
5828 if (former_face_id >= 0 && cache->used > former_face_id) 5828 if (former_face_id >= 0 && cache->used > former_face_id)
5889 face->gc = 0; 5889 face->gc = 0;
5890 5890
5891 /* Don't try to free the colors copied bitwise from BASE_FACE. */ 5891 /* Don't try to free the colors copied bitwise from BASE_FACE. */
5892 face->foreground_defaulted_p = 1; 5892 face->foreground_defaulted_p = 1;
5893 face->background_defaulted_p = 1; 5893 face->background_defaulted_p = 1;
5894 face->underline_defaulted_p = 1; 5894 face->underline_defaulted_p = 1;
5895 face->overline_color_defaulted_p = 1; 5895 face->overline_color_defaulted_p = 1;
5896 face->strike_through_color_defaulted_p = 1; 5896 face->strike_through_color_defaulted_p = 1;
5897 face->box_color_defaulted_p = 1; 5897 face->box_color_defaulted_p = 1;
5898 5898
5899 /* to force realize_face to load font */ 5899 /* to force realize_face to load font */
5900 face->font = NULL; 5900 face->font = NULL;
5901 return face; 5901 return face;
5902 } 5902 }
5903 5903
5930 registry and encoding of a font. It may also determine 5930 registry and encoding of a font. It may also determine
5931 foundry and family. The other fields of font name pattern 5931 foundry and family. The other fields of font name pattern
5932 are constructed from ATTRS. */ 5932 are constructed from ATTRS. */
5933 int fontset = face_fontset (attrs); 5933 int fontset = face_fontset (attrs);
5934 5934
5935 if (fontset == -1) 5935 if ((fontset == -1) && default_face)
5936 fontset = default_face->fontset; 5936 fontset = default_face->fontset;
5937 face->fontset = make_fontset_for_ascii_face (f, fontset); 5937 face->fontset = make_fontset_for_ascii_face (f, fontset);
5938 face->font = NULL; /* to force realize_face to load font */ 5938 face->font = NULL; /* to force realize_face to load font */
5939 } 5939 }
5940 5940
5941 /* Load colors, and set remaining attributes. */ 5941 /* Load colors, and set remaining attributes. */
5942 5942
5943 load_face_colors (f, face, attrs); 5943 load_face_colors (f, face, attrs);
5944 5944
5945 /* Set up box. */ 5945 /* Set up box. */
5946 box = attrs[LFACE_BOX_INDEX]; 5946 box = attrs[LFACE_BOX_INDEX];
5947 if (STRINGP (box)) 5947 if (STRINGP (box))
6007 } 6007 }
6008 } 6008 }
6009 } 6009 }
6010 6010
6011 /* Text underline, overline, strike-through. */ 6011 /* Text underline, overline, strike-through. */
6012 6012
6013 if (EQ (attrs[LFACE_UNDERLINE_INDEX], Qt)) 6013 if (EQ (attrs[LFACE_UNDERLINE_INDEX], Qt))
6014 { 6014 {
6015 /* Use default color (same as foreground color). */ 6015 /* Use default color (same as foreground color). */
6016 face->underline_p = 1; 6016 face->underline_p = 1;
6017 face->underline_defaulted_p = 1; 6017 face->underline_defaulted_p = 1;
6018 face->underline_color = 0; 6018 face->underline_color = 0;
6019 } 6019 }
6092 Lisp_Object frame; 6092 Lisp_Object frame;
6093 int face_colors_defaulted = 0; 6093 int face_colors_defaulted = 0;
6094 6094
6095 /* Frame must be a termcap frame. */ 6095 /* Frame must be a termcap frame. */
6096 xassert (FRAME_TERMCAP_P (cache->f) || FRAME_MSDOS_P (cache->f)); 6096 xassert (FRAME_TERMCAP_P (cache->f) || FRAME_MSDOS_P (cache->f));
6097 6097
6098 /* Allocate a new realized face. */ 6098 /* Allocate a new realized face. */
6099 face = make_realized_face (attrs); 6099 face = make_realized_face (attrs);
6100 face->font_name = FRAME_MSDOS_P (cache->f) ? "ms-dos" : "tty"; 6100 face->font_name = FRAME_MSDOS_P (cache->f) ? "ms-dos" : "tty";
6101 6101
6102 /* Map face attributes to TTY appearances. We map slant to 6102 /* Map face attributes to TTY appearances. We map slant to
6103 dimmed text because we want italic text to appear differently 6103 dimmed text because we want italic text to appear differently
6104 and because dimmed text is probably used infrequently. */ 6104 and because dimmed text is probably used infrequently. */
6105 weight = face_numeric_weight (attrs[LFACE_WEIGHT_INDEX]); 6105 weight = face_numeric_weight (attrs[LFACE_WEIGHT_INDEX]);
6106 slant = face_numeric_slant (attrs[LFACE_SLANT_INDEX]); 6106 slant = face_numeric_slant (attrs[LFACE_SLANT_INDEX]);
6107 6107
6264 { 6264 {
6265 int face_id; 6265 int face_id;
6266 6266
6267 if (NILP (current_buffer->enable_multibyte_characters)) 6267 if (NILP (current_buffer->enable_multibyte_characters))
6268 ch = -1; 6268 ch = -1;
6269 6269
6270 if (NILP (prop)) 6270 if (NILP (prop))
6271 { 6271 {
6272 struct face *face = FACE_FROM_ID (f, DEFAULT_FACE_ID); 6272 struct face *face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
6273 face_id = FACE_FOR_CHAR (f, face, ch); 6273 face_id = FACE_FOR_CHAR (f, face, ch);
6274 } 6274 }
6367 } 6367 }
6368 6368
6369 *endptr = endpos; 6369 *endptr = endpos;
6370 6370
6371 default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); 6371 default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
6372 6372
6373 /* Optimize common cases where we can use the default face. */ 6373 /* Optimize common cases where we can use the default face. */
6374 if (noverlays == 0 6374 if (noverlays == 0
6375 && NILP (prop) 6375 && NILP (prop)
6376 && !(pos >= region_beg && pos < region_end)) 6376 && !(pos >= region_beg && pos < region_end))
6377 return DEFAULT_FACE_ID; 6377 return DEFAULT_FACE_ID;
6403 /* If in the region, merge in the region face. */ 6403 /* If in the region, merge in the region face. */
6404 if (pos >= region_beg && pos < region_end) 6404 if (pos >= region_beg && pos < region_end)
6405 { 6405 {
6406 Lisp_Object region_face = lface_from_face_name (f, Qregion, 0); 6406 Lisp_Object region_face = lface_from_face_name (f, Qregion, 0);
6407 merge_face_vectors (XVECTOR (region_face)->contents, attrs); 6407 merge_face_vectors (XVECTOR (region_face)->contents, attrs);
6408 6408
6409 if (region_end < endpos) 6409 if (region_end < endpos)
6410 endpos = region_end; 6410 endpos = region_end;
6411 } 6411 }
6412 6412
6413 *endptr = endpos; 6413 *endptr = endpos;
6427 REGION_BEG and REGION_END give the start and end positions of the 6427 REGION_BEG and REGION_END give the start and end positions of the
6428 region; both are -1 if no region is visible. BASE_FACE_ID is the 6428 region; both are -1 if no region is visible. BASE_FACE_ID is the
6429 id of the basic face to merge with. It is usually equal to 6429 id of the basic face to merge with. It is usually equal to
6430 DEFAULT_FACE_ID but can be MODE_LINE_FACE_ID or HEADER_LINE_FACE_ID 6430 DEFAULT_FACE_ID but can be MODE_LINE_FACE_ID or HEADER_LINE_FACE_ID
6431 for strings displayed in the mode or top line. 6431 for strings displayed in the mode or top line.
6432 6432
6433 Set *ENDPTR to the next position where to check for faces in 6433 Set *ENDPTR to the next position where to check for faces in
6434 STRING; -1 if the face is constant from POS to the end of the 6434 STRING; -1 if the face is constant from POS to the end of the
6435 string. 6435 string.
6436 6436
6437 Value is the id of the face to use. The face returned is suitable 6437 Value is the id of the face to use. The face returned is suitable
6557 Lisp_Object n; 6557 Lisp_Object n;
6558 { 6558 {
6559 if (NILP (n)) 6559 if (NILP (n))
6560 { 6560 {
6561 int i; 6561 int i;
6562 6562
6563 fprintf (stderr, "font selection order: "); 6563 fprintf (stderr, "font selection order: ");
6564 for (i = 0; i < DIM (font_sort_order); ++i) 6564 for (i = 0; i < DIM (font_sort_order); ++i)
6565 fprintf (stderr, "%d ", font_sort_order[i]); 6565 fprintf (stderr, "%d ", font_sort_order[i]);
6566 fprintf (stderr, "\n"); 6566 fprintf (stderr, "\n");
6567 6567
6568 fprintf (stderr, "alternative fonts: "); 6568 fprintf (stderr, "alternative fonts: ");
6569 debug_print (Vface_alternative_font_family_alist); 6569 debug_print (Vface_alternative_font_family_alist);
6570 fprintf (stderr, "\n"); 6570 fprintf (stderr, "\n");
6571 6571
6572 for (i = 0; i < FRAME_FACE_CACHE (SELECTED_FRAME ())->used; ++i) 6572 for (i = 0; i < FRAME_FACE_CACHE (SELECTED_FRAME ())->used; ++i)
6573 Fdump_face (make_number (i)); 6573 Fdump_face (make_number (i));
6574 } 6574 }
6575 else 6575 else
6576 { 6576 {
6579 face = FACE_FROM_ID (SELECTED_FRAME (), XINT (n)); 6579 face = FACE_FROM_ID (SELECTED_FRAME (), XINT (n));
6580 if (face == NULL) 6580 if (face == NULL)
6581 error ("Not a valid face"); 6581 error ("Not a valid face");
6582 dump_realized_face (face); 6582 dump_realized_face (face);
6583 } 6583 }
6584 6584
6585 return Qnil; 6585 return Qnil;
6586 } 6586 }
6587 6587
6588 6588
6589 DEFUN ("show-face-resources", Fshow_face_resources, Sshow_face_resources, 6589 DEFUN ("show-face-resources", Fshow_face_resources, Sshow_face_resources,
6611 staticpro (&Qface); 6611 staticpro (&Qface);
6612 Qbitmap_spec_p = intern ("bitmap-spec-p"); 6612 Qbitmap_spec_p = intern ("bitmap-spec-p");
6613 staticpro (&Qbitmap_spec_p); 6613 staticpro (&Qbitmap_spec_p);
6614 Qframe_update_face_colors = intern ("frame-update-face-colors"); 6614 Qframe_update_face_colors = intern ("frame-update-face-colors");
6615 staticpro (&Qframe_update_face_colors); 6615 staticpro (&Qframe_update_face_colors);
6616 6616
6617 /* Lisp face attribute keywords. */ 6617 /* Lisp face attribute keywords. */
6618 QCfamily = intern (":family"); 6618 QCfamily = intern (":family");
6619 staticpro (&QCfamily); 6619 staticpro (&QCfamily);
6620 QCheight = intern (":height"); 6620 QCheight = intern (":height");
6621 staticpro (&QCheight); 6621 staticpro (&QCheight);
6624 QCslant = intern (":slant"); 6624 QCslant = intern (":slant");
6625 staticpro (&QCslant); 6625 staticpro (&QCslant);
6626 QCunderline = intern (":underline"); 6626 QCunderline = intern (":underline");
6627 staticpro (&QCunderline); 6627 staticpro (&QCunderline);
6628 QCinverse_video = intern (":inverse-video"); 6628 QCinverse_video = intern (":inverse-video");
6629 staticpro (&QCinverse_video); 6629 staticpro (&QCinverse_video);
6630 QCreverse_video = intern (":reverse-video"); 6630 QCreverse_video = intern (":reverse-video");
6631 staticpro (&QCreverse_video); 6631 staticpro (&QCreverse_video);
6632 QCforeground = intern (":foreground"); 6632 QCforeground = intern (":foreground");
6633 staticpro (&QCforeground); 6633 staticpro (&QCforeground);
6634 QCbackground = intern (":background"); 6634 QCbackground = intern (":background");
6773 Vfont_list_limit = make_number (DEFAULT_FONT_LIST_LIMIT); 6773 Vfont_list_limit = make_number (DEFAULT_FONT_LIST_LIMIT);
6774 6774
6775 DEFVAR_LISP ("face-new-frame-defaults", &Vface_new_frame_defaults, 6775 DEFVAR_LISP ("face-new-frame-defaults", &Vface_new_frame_defaults,
6776 "List of global face definitions (for internal use only.)"); 6776 "List of global face definitions (for internal use only.)");
6777 Vface_new_frame_defaults = Qnil; 6777 Vface_new_frame_defaults = Qnil;
6778 6778
6779 DEFVAR_LISP ("face-default-stipple", &Vface_default_stipple, 6779 DEFVAR_LISP ("face-default-stipple", &Vface_default_stipple,
6780 "*Default stipple pattern used on monochrome displays.\n\ 6780 "*Default stipple pattern used on monochrome displays.\n\
6781 This stipple pattern is used on monochrome displays\n\ 6781 This stipple pattern is used on monochrome displays\n\
6782 instead of shades of gray for a face background color.\n\ 6782 instead of shades of gray for a face background color.\n\
6783 See `set-face-stipple' for possible values for this variable."); 6783 See `set-face-stipple' for possible values for this variable.");
6786 DEFVAR_LISP ("face-alternative-font-family-alist", 6786 DEFVAR_LISP ("face-alternative-font-family-alist",
6787 &Vface_alternative_font_family_alist, ""); 6787 &Vface_alternative_font_family_alist, "");
6788 Vface_alternative_font_family_alist = Qnil; 6788 Vface_alternative_font_family_alist = Qnil;
6789 6789
6790 #if SCALABLE_FONTS 6790 #if SCALABLE_FONTS
6791 6791
6792 DEFVAR_LISP ("scalable-fonts-allowed", &Vscalable_fonts_allowed, 6792 DEFVAR_LISP ("scalable-fonts-allowed", &Vscalable_fonts_allowed,
6793 "Allowed scalable fonts.\n\ 6793 "Allowed scalable fonts.\n\
6794 A value of nil means don't allow any scalable fonts.\n\ 6794 A value of nil means don't allow any scalable fonts.\n\
6795 A value of t means allow any scalable font.\n\ 6795 A value of t means allow any scalable font.\n\
6796 Otherwise, value must be a list of regular expressions. A font may be\n\ 6796 Otherwise, value must be a list of regular expressions. A font may be\n\