Mercurial > hg > xemacs-beta
comparison src/faces.c @ 5125:b5df3737028a ben-lisp-object
merge
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Wed, 24 Feb 2010 01:58:04 -0600 |
parents | 623d57b7fbe8 d95c102a96d3 |
children | 2a462149bd6a |
comparison
equal
deleted
inserted
replaced
5124:623d57b7fbe8 | 5125:b5df3737028a |
---|---|
1 /* "Face" primitives | 1 /* "Face" primitives |
2 Copyright (C) 1994 Free Software Foundation, Inc. | 2 Copyright (C) 1994 Free Software Foundation, Inc. |
3 Copyright (C) 1995 Board of Trustees, University of Illinois. | 3 Copyright (C) 1995 Board of Trustees, University of Illinois. |
4 Copyright (C) 1995, 1996, 2001, 2002 Ben Wing. | 4 Copyright (C) 1995, 1996, 2001, 2002, 2005, 2010 Ben Wing. |
5 Copyright (C) 1995 Sun Microsystems, Inc. | 5 Copyright (C) 1995 Sun Microsystems, Inc. |
6 | 6 |
7 This file is part of XEmacs. | 7 This file is part of XEmacs. |
8 | 8 |
9 XEmacs is free software; you can redistribute it and/or modify it | 9 XEmacs is free software; you can redistribute it and/or modify it |
135 else | 135 else |
136 { | 136 { |
137 write_fmt_string_lisp (printcharfun, "#<face %S", 1, face->name); | 137 write_fmt_string_lisp (printcharfun, "#<face %S", 1, face->name); |
138 if (!NILP (face->doc_string)) | 138 if (!NILP (face->doc_string)) |
139 write_fmt_string_lisp (printcharfun, " %S", 1, face->doc_string); | 139 write_fmt_string_lisp (printcharfun, " %S", 1, face->doc_string); |
140 write_c_string (printcharfun, ">"); | 140 write_ascstring (printcharfun, ">"); |
141 } | 141 } |
142 } | 142 } |
143 | 143 |
144 /* Faces are equal if all of their display attributes are equal. We | 144 /* Faces are equal if all of their display attributes are equal. We |
145 don't compare names or doc-strings, because that would make equal | 145 don't compare names or doc-strings, because that would make equal |
146 be eq. | 146 be eq. |
147 | 147 |
148 This isn't concerned with "unspecified" attributes, that's what | 148 This isn't concerned with "unspecified" attributes, that's what |
149 #'face-differs-from-default-p is for. */ | 149 #'face-differs-from-default-p is for. */ |
150 static int | 150 static int |
151 face_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) | 151 face_equal (Lisp_Object obj1, Lisp_Object obj2, int depth, |
152 int UNUSED (foldcase)) | |
152 { | 153 { |
153 Lisp_Face *f1 = XFACE (obj1); | 154 Lisp_Face *f1 = XFACE (obj1); |
154 Lisp_Face *f2 = XFACE (obj2); | 155 Lisp_Face *f2 = XFACE (obj2); |
155 | 156 |
156 depth++; | 157 depth++; |
166 internal_equal (f1->highlight, f2->highlight, depth) && | 167 internal_equal (f1->highlight, f2->highlight, depth) && |
167 internal_equal (f1->dim, f2->dim, depth) && | 168 internal_equal (f1->dim, f2->dim, depth) && |
168 internal_equal (f1->blinking, f2->blinking, depth) && | 169 internal_equal (f1->blinking, f2->blinking, depth) && |
169 internal_equal (f1->reverse, f2->reverse, depth) && | 170 internal_equal (f1->reverse, f2->reverse, depth) && |
170 | 171 |
171 ! plists_differ (f1->plist, f2->plist, 0, 0, depth + 1)); | 172 ! plists_differ (f1->plist, f2->plist, 0, 0, depth + 1, 0)); |
172 } | 173 } |
173 | 174 |
174 static Hashcode | 175 static Hashcode |
175 face_hash (Lisp_Object obj, int depth) | 176 face_hash (Lisp_Object obj, int depth) |
176 { | 177 { |
525 { | 526 { |
526 Lisp_Object key, contents; | 527 Lisp_Object key, contents; |
527 struct face_inheritance_closure *fcl = | 528 struct face_inheritance_closure *fcl = |
528 (struct face_inheritance_closure *) face_inheritance_closure; | 529 (struct face_inheritance_closure *) face_inheritance_closure; |
529 | 530 |
530 key = VOID_TO_LISP (hash_key); | 531 key = GET_LISP_FROM_VOID (hash_key); |
531 contents = VOID_TO_LISP (hash_contents); | 532 contents = GET_LISP_FROM_VOID (hash_contents); |
532 | 533 |
533 if (EQ (fcl->property, Qfont)) | 534 if (EQ (fcl->property, Qfont)) |
534 { | 535 { |
535 update_inheritance_mapper_internal (contents, fcl->face, Qfont); | 536 update_inheritance_mapper_internal (contents, fcl->face, Qfont); |
536 } | 537 } |
587 Lisp_Object matchspec = Qunbound; | 588 Lisp_Object matchspec = Qunbound; |
588 struct gcpro gcpro1; | 589 struct gcpro gcpro1; |
589 | 590 |
590 if (!NILP (charset)) | 591 if (!NILP (charset)) |
591 matchspec = noseeum_cons (charset, | 592 matchspec = noseeum_cons (charset, |
592 stage == initial ? Qinitial : Qfinal); | 593 stage == STAGE_INITIAL ? Qinitial : Qfinal); |
593 | 594 |
594 GCPRO1 (matchspec); | 595 GCPRO1 (matchspec); |
596 /* This call to specifier_instance_no_quit(), will end up calling | |
597 font_instantiate() if the property in a question is a font (currently, | |
598 this means EQ (property, Qfont), because only the face property named | |
599 `font' contains a font object). See the comments there. */ | |
595 retval = specifier_instance_no_quit (Fget (face, property, Qnil), matchspec, | 600 retval = specifier_instance_no_quit (Fget (face, property, Qnil), matchspec, |
596 domain, errb, no_fallback, depth); | 601 domain, errb, no_fallback, depth); |
597 UNGCPRO; | 602 UNGCPRO; |
598 if (CONSP (matchspec)) | 603 if (CONSP (matchspec)) |
599 free_cons (matchspec); | 604 free_cons (matchspec); |
600 | 605 |
601 if (UNBOUNDP (retval) && !no_fallback && final == stage) | 606 if (UNBOUNDP (retval) && !no_fallback && STAGE_FINAL == stage) |
602 { | 607 { |
603 if (EQ (property, Qfont)) | 608 if (EQ (property, Qfont)) |
604 { | 609 { |
605 if (NILP (memq_no_quit (charset, | 610 if (NILP (memq_no_quit (charset, |
606 XFACE (face)->charsets_warned_about))) | 611 XFACE (face)->charsets_warned_about))) |
1157 shouldn't happen. */ | 1162 shouldn't happen. */ |
1158 new_val = face_property_matching_instance (face, Qfont, charset, domain, | 1163 new_val = face_property_matching_instance (face, Qfont, charset, domain, |
1159 /* ERROR_ME_DEBUG_WARN is | 1164 /* ERROR_ME_DEBUG_WARN is |
1160 fine here. */ | 1165 fine here. */ |
1161 ERROR_ME_DEBUG_WARN, 1, Qzero, | 1166 ERROR_ME_DEBUG_WARN, 1, Qzero, |
1162 initial); | 1167 STAGE_INITIAL); |
1163 DEBUG_FACES("just called f_p_m_i on face %s, charset %s, initial, " | 1168 DEBUG_FACES("just called f_p_m_i on face %s, charset %s, initial, " |
1164 "result was something %s\n", | 1169 "result was something %s\n", |
1165 XSTRING_DATA(XSYMBOL_NAME(XFACE(cachel->face)->name)), | 1170 XSTRING_DATA(XSYMBOL_NAME(XFACE(cachel->face)->name)), |
1166 XSTRING_DATA(XSYMBOL_NAME(XCHARSET_NAME(charset))), | 1171 XSTRING_DATA(XSYMBOL_NAME(XCHARSET_NAME(charset))), |
1167 UNBOUNDP(new_val) ? "not bound" : "bound"); | 1172 UNBOUNDP(new_val) ? "not bound" : "bound"); |
1179 unlikely to have specified them herself, a common complaint. */ | 1184 unlikely to have specified them herself, a common complaint. */ |
1180 new_val = face_property_matching_instance (face, Qfont, | 1185 new_val = face_property_matching_instance (face, Qfont, |
1181 charset, domain, | 1186 charset, domain, |
1182 ERROR_ME_DEBUG_WARN, 0, | 1187 ERROR_ME_DEBUG_WARN, 0, |
1183 Qzero, | 1188 Qzero, |
1184 initial); | 1189 STAGE_INITIAL); |
1185 | 1190 |
1186 DEBUG_FACES("just called f_p_m_i on face %s, charset %s, initial, " | 1191 DEBUG_FACES ("just called f_p_m_i on face %s, charset %s, initial, " |
1187 "allow fallback, result was something %s\n", | 1192 "allow fallback, result was something %s\n", |
1188 XSTRING_DATA(XSYMBOL_NAME(XFACE(cachel->face)->name)), | 1193 XSTRING_DATA (XSYMBOL_NAME (XFACE (cachel->face)->name)), |
1189 XSTRING_DATA(XSYMBOL_NAME(XCHARSET_NAME(charset))), | 1194 XSTRING_DATA (XSYMBOL_NAME (XCHARSET_NAME (charset))), |
1190 UNBOUNDP(new_val) ? "not bound" : "bound"); | 1195 UNBOUNDP (new_val) ? "not bound" : "bound"); |
1191 | 1196 |
1192 if (!UNBOUNDP(new_val)) | 1197 if (!UNBOUNDP (new_val)) |
1193 { | 1198 { |
1194 break; | 1199 break; |
1195 } | 1200 } |
1196 | 1201 |
1197 bound = 1; | 1202 bound = 1; |
1198 /* Try the face itself with the final-stage specifiers. */ | 1203 /* Try the face itself with the final-stage specifiers. */ |
1199 new_val = face_property_matching_instance (face, Qfont, | 1204 new_val = face_property_matching_instance (face, Qfont, |
1200 charset, domain, | 1205 charset, domain, |
1201 ERROR_ME_DEBUG_WARN, 1, | 1206 ERROR_ME_DEBUG_WARN, 1, |
1202 Qzero, | 1207 Qzero, |
1203 final); | 1208 STAGE_FINAL); |
1204 | 1209 |
1205 DEBUG_FACES("just called f_p_m_i on face %s, charset %s, final, " | 1210 DEBUG_FACES("just called f_p_m_i on face %s, charset %s, final, " |
1206 "result was something %s\n", | 1211 "result was something %s\n", |
1207 XSTRING_DATA(XSYMBOL_NAME(XFACE(cachel->face)->name)), | 1212 XSTRING_DATA(XSYMBOL_NAME(XFACE(cachel->face)->name)), |
1208 XSTRING_DATA(XSYMBOL_NAME(XCHARSET_NAME(charset))), | 1213 XSTRING_DATA(XSYMBOL_NAME(XCHARSET_NAME(charset))), |
1209 UNBOUNDP(new_val) ? "not bound" : "bound"); | 1214 UNBOUNDP(new_val) ? "not bound" : "bound"); |
1210 /* Tell X11 redisplay that it should translate to iso10646-1. */ | 1215 /* Tell X11 redisplay that it should translate to iso10646-1. */ |
1211 if (!UNBOUNDP(new_val)) | 1216 if (!UNBOUNDP (new_val)) |
1212 { | 1217 { |
1213 final_stage = 1; | 1218 final_stage = 1; |
1214 break; | 1219 break; |
1215 } | 1220 } |
1216 | 1221 |
1220 allowing its final stage to be used. */ | 1225 allowing its final stage to be used. */ |
1221 new_val = face_property_matching_instance (face, Qfont, | 1226 new_val = face_property_matching_instance (face, Qfont, |
1222 charset, domain, | 1227 charset, domain, |
1223 ERROR_ME_DEBUG_WARN, 0, | 1228 ERROR_ME_DEBUG_WARN, 0, |
1224 Qzero, | 1229 Qzero, |
1225 final); | 1230 STAGE_FINAL); |
1226 | 1231 |
1227 DEBUG_FACES("just called f_p_m_i on face %s, charset %s, initial, " | 1232 DEBUG_FACES ("just called f_p_m_i on face %s, charset %s, initial, " |
1228 "allow fallback, result was something %s\n", | 1233 "allow fallback, result was something %s\n", |
1229 XSTRING_DATA(XSYMBOL_NAME(XFACE(cachel->face)->name)), | 1234 XSTRING_DATA (XSYMBOL_NAME (XFACE (cachel->face)->name)), |
1230 XSTRING_DATA(XSYMBOL_NAME(XCHARSET_NAME(charset))), | 1235 XSTRING_DATA (XSYMBOL_NAME (XCHARSET_NAME (charset))), |
1231 UNBOUNDP(new_val) ? "not bound" : "bound"); | 1236 UNBOUNDP (new_val) ? "not bound" : "bound"); |
1232 if (!UNBOUNDP(new_val)) | 1237 if (!UNBOUNDP(new_val)) |
1233 { | 1238 { |
1234 /* Tell X11 redisplay that it should translate to iso10646-1. */ | 1239 /* Tell X11 redisplay that it should translate to iso10646-1. */ |
1235 final_stage = 1; | 1240 final_stage = 1; |
1236 break; | 1241 break; |
1360 /* The face's background pixmap have not yet been frobbed (see comment | 1365 /* The face's background pixmap have not yet been frobbed (see comment |
1361 in update_face_cachel_data), so we have to do it now */ | 1366 in update_face_cachel_data), so we have to do it now */ |
1362 if (must_finish_frobbing) | 1367 if (must_finish_frobbing) |
1363 { | 1368 { |
1364 int default_face = EQ (face, Vdefault_face); | 1369 int default_face = EQ (face, Vdefault_face); |
1365 struct face_cachel *cachel | 1370 struct face_cachel *cachel = Dynarr_lastp (w->face_cachels); |
1366 = Dynarr_atp (w->face_cachels, Dynarr_length (w->face_cachels) - 1); | |
1367 | 1371 |
1368 FROB (background_pixmap); | 1372 FROB (background_pixmap); |
1369 MAYBE_UNFROB_BACKGROUND_PIXMAP; | 1373 MAYBE_UNFROB_BACKGROUND_PIXMAP; |
1370 } | 1374 } |
1371 } | 1375 } |
2028 | 2032 |
2029 Lisp_Object Qone_dimensional, Qtwo_dimensional, Qx_coverage_instantiator; | 2033 Lisp_Object Qone_dimensional, Qtwo_dimensional, Qx_coverage_instantiator; |
2030 | 2034 |
2031 DEFUN ("specifier-tag-one-dimensional-p", | 2035 DEFUN ("specifier-tag-one-dimensional-p", |
2032 Fspecifier_tag_one_dimensional_p, | 2036 Fspecifier_tag_one_dimensional_p, |
2033 2, 2, 0, /* | 2037 1, 1, 0, /* |
2034 Return non-nil if (charset-dimension CHARSET) is 1. | 2038 Return non-nil if (charset-dimension CHARSET) is 1. |
2035 | 2039 |
2036 Used by the X11 platform font code; see `define-specifier-tag'. You | 2040 Used by the X11 platform font code; see `define-specifier-tag'. You |
2037 shouldn't ever need to call this yourself. | 2041 shouldn't ever need to call this yourself. |
2038 */ | 2042 */ |
2039 (charset, UNUSED(stage))) | 2043 (charset)) |
2040 { | 2044 { |
2041 CHECK_CHARSET(charset); | 2045 CHECK_CHARSET (charset); |
2042 return (1 == XCHARSET_DIMENSION(charset)) ? Qt : Qnil; | 2046 return (1 == XCHARSET_DIMENSION (charset)) ? Qt : Qnil; |
2043 } | 2047 } |
2044 | 2048 |
2045 DEFUN ("specifier-tag-two-dimensional-p", | 2049 DEFUN ("specifier-tag-two-dimensional-p", |
2046 Fspecifier_tag_two_dimensional_p, | 2050 Fspecifier_tag_two_dimensional_p, |
2047 2, 2, 0, /* | 2051 1, 1, 0, /* |
2048 Return non-nil if (charset-dimension CHARSET) is 2. | 2052 Return non-nil if (charset-dimension CHARSET) is 2. |
2049 | 2053 |
2050 Used by the X11 platform font code; see `define-specifier-tag'. You | 2054 Used by the X11 platform font code; see `define-specifier-tag'. You |
2051 shouldn't ever need to call this yourself. | 2055 shouldn't ever need to call this yourself. |
2052 */ | 2056 */ |
2053 (charset, UNUSED(stage))) | 2057 (charset)) |
2054 { | 2058 { |
2055 CHECK_CHARSET(charset); | 2059 CHECK_CHARSET (charset); |
2056 return (2 == XCHARSET_DIMENSION(charset)) ? Qt : Qnil; | 2060 return (2 == XCHARSET_DIMENSION (charset)) ? Qt : Qnil; |
2057 } | 2061 } |
2058 | 2062 |
2059 DEFUN ("specifier-tag-final-stage-p", | 2063 DEFUN ("specifier-tag-final-stage-p", |
2060 Fspecifier_tag_final_stage_p, | 2064 Fspecifier_tag_final_stage_p, |
2061 2, 2, 0, /* | 2065 2, 2, 0, /* |
2062 Return non-nil if STAGE is 'final. | 2066 Return non-nil if STAGE is 'final. |
2063 | 2067 |
2064 Used by the X11 platform font code for giving fallbacks; see | 2068 Used by the X11 platform font code for giving fallbacks; see |
2065 `define-specifier-tag'. You shouldn't ever need to call this. | 2069 `define-specifier-tag'. You shouldn't ever need to call this. |
2066 */ | 2070 */ |
2067 (UNUSED(charset), stage)) | 2071 (UNUSED (charset), stage)) |
2068 { | 2072 { |
2069 return EQ(stage, Qfinal) ? Qt : Qnil; | 2073 return EQ (stage, Qfinal) ? Qt : Qnil; |
2070 } | 2074 } |
2071 | 2075 |
2072 DEFUN ("specifier-tag-initial-stage-p", | 2076 DEFUN ("specifier-tag-initial-stage-p", |
2073 Fspecifier_tag_initial_stage_p, | 2077 Fspecifier_tag_initial_stage_p, |
2074 2, 2, 0, /* | 2078 2, 2, 0, /* |
2229 { | 2233 { |
2230 /* Create the default face now so we know what it is immediately. */ | 2234 /* Create the default face now so we know what it is immediately. */ |
2231 | 2235 |
2232 Vdefault_face = Qnil; /* so that Fmake_face() doesn't set up a bogus | 2236 Vdefault_face = Qnil; /* so that Fmake_face() doesn't set up a bogus |
2233 default value */ | 2237 default value */ |
2234 Vdefault_face = Fmake_face (Qdefault, build_msg_string ("default face"), | 2238 Vdefault_face = Fmake_face (Qdefault, build_defer_string ("default face"), |
2235 Qnil); | 2239 Qnil); |
2236 | 2240 |
2237 /* Provide some last-resort fallbacks to avoid utter fuckage if | 2241 /* Provide some last-resort fallbacks to avoid utter fuckage if |
2238 someone provides invalid values for the global specifications. */ | 2242 someone provides invalid values for the global specifications. */ |
2239 | 2243 |
2240 { | 2244 { |
2241 Lisp_Object fg_fb = Qnil, bg_fb = Qnil; | 2245 Lisp_Object fg_fb = Qnil, bg_fb = Qnil; |
2242 | 2246 |
2243 #ifdef HAVE_GTK | 2247 #ifdef HAVE_GTK |
2244 fg_fb = acons (list1 (Qgtk), build_string ("black"), fg_fb); | 2248 fg_fb = acons (list1 (Qgtk), build_ascstring ("black"), fg_fb); |
2245 bg_fb = acons (list1 (Qgtk), build_string ("white"), bg_fb); | 2249 bg_fb = acons (list1 (Qgtk), build_ascstring ("white"), bg_fb); |
2246 #endif | 2250 #endif |
2247 #ifdef HAVE_X_WINDOWS | 2251 #ifdef HAVE_X_WINDOWS |
2248 fg_fb = acons (list1 (Qx), build_string ("black"), fg_fb); | 2252 fg_fb = acons (list1 (Qx), build_ascstring ("black"), fg_fb); |
2249 bg_fb = acons (list1 (Qx), build_string ("white"), bg_fb); | 2253 bg_fb = acons (list1 (Qx), build_ascstring ("gray80"), bg_fb); |
2250 #endif | 2254 #endif |
2251 #ifdef HAVE_TTY | 2255 #ifdef HAVE_TTY |
2252 fg_fb = acons (list1 (Qtty), Fvector (0, 0), fg_fb); | 2256 fg_fb = acons (list1 (Qtty), Fvector (0, 0), fg_fb); |
2253 bg_fb = acons (list1 (Qtty), Fvector (0, 0), bg_fb); | 2257 bg_fb = acons (list1 (Qtty), Fvector (0, 0), bg_fb); |
2254 #endif | 2258 #endif |
2255 #ifdef HAVE_MS_WINDOWS | 2259 #ifdef HAVE_MS_WINDOWS |
2256 fg_fb = acons (list1 (Qmsprinter), build_string ("black"), fg_fb); | 2260 fg_fb = acons (list1 (Qmsprinter), build_ascstring ("black"), fg_fb); |
2257 bg_fb = acons (list1 (Qmsprinter), build_string ("white"), bg_fb); | 2261 bg_fb = acons (list1 (Qmsprinter), build_ascstring ("white"), bg_fb); |
2258 fg_fb = acons (list1 (Qmswindows), build_string ("black"), fg_fb); | 2262 fg_fb = acons (list1 (Qmswindows), build_ascstring ("black"), fg_fb); |
2259 bg_fb = acons (list1 (Qmswindows), build_string ("white"), bg_fb); | 2263 bg_fb = acons (list1 (Qmswindows), build_ascstring ("white"), bg_fb); |
2260 #endif | 2264 #endif |
2261 set_specifier_fallback (Fget (Vdefault_face, Qforeground, Qnil), fg_fb); | 2265 set_specifier_fallback (Fget (Vdefault_face, Qforeground, Qnil), fg_fb); |
2262 set_specifier_fallback (Fget (Vdefault_face, Qbackground, Qnil), bg_fb); | 2266 set_specifier_fallback (Fget (Vdefault_face, Qbackground, Qnil), bg_fb); |
2263 } | 2267 } |
2264 | 2268 |
2271 Lisp_Object device_symbol = Qgtk; | 2275 Lisp_Object device_symbol = Qgtk; |
2272 #else | 2276 #else |
2273 Lisp_Object device_symbol = Qx; | 2277 Lisp_Object device_symbol = Qx; |
2274 #endif | 2278 #endif |
2275 | 2279 |
2276 #if defined (USE_XFT) || defined (MULE) | 2280 #if defined (HAVE_XFT) || defined (MULE) |
2277 const Ascbyte **fontptr; | 2281 const Ascbyte **fontptr; |
2278 | 2282 |
2279 const Ascbyte *fonts[] = | 2283 const Ascbyte *fonts[] = |
2280 { | 2284 { |
2281 #ifdef USE_XFT | 2285 #ifdef HAVE_XFT |
2282 /************** Xft fonts *************/ | 2286 /************** Xft fonts *************/ |
2283 | 2287 |
2284 /* Note that fontconfig can search for several font families in one | 2288 /* Note that fontconfig can search for several font families in one |
2285 call. We should use this facility. */ | 2289 call. We should use this facility. */ |
2286 "Monospace-12", | 2290 "Monospace-12", |
2301 corresponding to one of them fails!) */ | 2305 corresponding to one of them fails!) */ |
2302 "-*-*-medium-r-*-*-*-160-*-*-c-*-*-*", | 2306 "-*-*-medium-r-*-*-*-160-*-*-c-*-*-*", |
2303 "-*-*-medium-r-*-*-*-170-*-*-c-*-*-*", | 2307 "-*-*-medium-r-*-*-*-170-*-*-c-*-*-*", |
2304 #endif | 2308 #endif |
2305 }; | 2309 }; |
2306 #endif /* defined (USE_XFT) || defined (MULE) */ | 2310 #endif /* defined (HAVE_XFT) || defined (MULE) */ |
2307 | 2311 |
2308 #ifdef MULE | 2312 #ifdef MULE |
2309 | 2313 |
2310 /* Define some specifier tags for classes of character sets. Combining | 2314 /* Define some specifier tags for classes of character sets. Combining |
2311 these allows for distinct fallback fonts for distinct dimensions of | 2315 these allows for distinct fallback fonts for distinct dimensions of |
2332 when the default face is determined from X resources at startup. */ | 2336 when the default face is determined from X resources at startup. */ |
2333 define_specifier_tag (Qx_coverage_instantiator, Qnil, Qnil); | 2337 define_specifier_tag (Qx_coverage_instantiator, Qnil, Qnil); |
2334 | 2338 |
2335 #endif /* MULE */ | 2339 #endif /* MULE */ |
2336 | 2340 |
2337 #ifdef USE_XFT | 2341 #ifdef HAVE_XFT |
2338 for (fontptr = fonts + countof(fonts) - 1; fontptr >= fonts; fontptr--) | 2342 for (fontptr = fonts + countof(fonts) - 1; fontptr >= fonts; fontptr--) |
2339 inst_list = Fcons (Fcons (list1 (device_symbol), | 2343 inst_list = Fcons (Fcons (list1 (device_symbol), |
2340 build_string (*fontptr)), | 2344 build_cistring (*fontptr)), |
2341 inst_list); | 2345 inst_list); |
2342 | 2346 |
2343 #else /* !USE_XFT */ | 2347 #else /* !HAVE_XFT */ |
2344 inst_list = | 2348 inst_list = |
2345 Fcons | 2349 Fcons |
2346 (Fcons | 2350 (Fcons |
2347 (list1 (device_symbol), | 2351 (list1 (device_symbol), |
2348 /* grrr. This really does need to be "*", not an XLFD. | 2352 /* grrr. This really does need to be "*", not an XLFD. |
2349 An unspecified XLFD won't pick up stuff like 10x20. */ | 2353 An unspecified XLFD won't pick up stuff like 10x20. */ |
2350 build_string ("*")), | 2354 build_ascstring ("*")), |
2351 inst_list); | 2355 inst_list); |
2352 #ifdef MULE | 2356 #ifdef MULE |
2353 | 2357 |
2354 /* For Han characters and Ethiopic, we want the misc-fixed font used to | 2358 /* For Han characters and Ethiopic, we want the misc-fixed font used to |
2355 be distinct from that for alphabetic scripts, because the font | 2359 be distinct from that for alphabetic scripts, because the font |
2359 have charset-specific fallbacks for the East Asian charsets.) */ | 2363 have charset-specific fallbacks for the East Asian charsets.) */ |
2360 inst_list = | 2364 inst_list = |
2361 Fcons | 2365 Fcons |
2362 (Fcons | 2366 (Fcons |
2363 (list4(device_symbol, Qtwo_dimensional, Qfinal, Qx_coverage_instantiator), | 2367 (list4(device_symbol, Qtwo_dimensional, Qfinal, Qx_coverage_instantiator), |
2364 build_string | 2368 build_ascstring |
2365 ("-misc-fixed-medium-r-normal--15-140-75-75-c-90-iso10646-1")), | 2369 ("-misc-fixed-medium-r-normal--15-140-75-75-c-90-iso10646-1")), |
2366 inst_list); | 2370 inst_list); |
2367 | 2371 |
2368 /* Use Markus Kuhn's version of misc-fixed as the font for the font for | 2372 /* Use Markus Kuhn's version of misc-fixed as the font for the font for |
2369 when a given charset's registries can't be found and redisplay for | 2373 when a given charset's registries can't be found and redisplay for |
2371 | 2375 |
2372 inst_list = | 2376 inst_list = |
2373 Fcons | 2377 Fcons |
2374 (Fcons | 2378 (Fcons |
2375 (list4(device_symbol, Qone_dimensional, Qfinal, Qx_coverage_instantiator), | 2379 (list4(device_symbol, Qone_dimensional, Qfinal, Qx_coverage_instantiator), |
2376 build_string | 2380 build_ascstring |
2377 ("-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1")), | 2381 ("-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1")), |
2378 inst_list); | 2382 inst_list); |
2379 | 2383 |
2380 for (fontptr = fonts + countof(fonts) - 1; fontptr >= fonts; fontptr--) | 2384 for (fontptr = fonts + countof(fonts) - 1; fontptr >= fonts; fontptr--) |
2381 inst_list = Fcons (Fcons (list3 (device_symbol, | 2385 inst_list = Fcons (Fcons (list3 (device_symbol, |
2382 Qtwo_dimensional, Qinitial), | 2386 Qtwo_dimensional, Qinitial), |
2383 build_string (*fontptr)), | 2387 build_cistring (*fontptr)), |
2384 inst_list); | 2388 inst_list); |
2385 | 2389 |
2386 /* We need to set the font for the JIT-ucs-charsets separately from the | 2390 /* We need to set the font for the JIT-ucs-charsets separately from the |
2387 final stage, since otherwise it picks up the two-dimensional | 2391 final stage, since otherwise it picks up the two-dimensional |
2388 specification (see specifier-tag-two-dimensional-initial-stage-p | 2392 specification (see specifier-tag-two-dimensional-initial-stage-p |
2391 | 2395 |
2392 inst_list = | 2396 inst_list = |
2393 Fcons | 2397 Fcons |
2394 (Fcons | 2398 (Fcons |
2395 (list4(device_symbol, Qencode_as_utf_8, Qinitial, Qx_coverage_instantiator), | 2399 (list4(device_symbol, Qencode_as_utf_8, Qinitial, Qx_coverage_instantiator), |
2396 build_string | 2400 build_ascstring |
2397 ("-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1")), | 2401 ("-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1")), |
2398 inst_list); | 2402 inst_list); |
2399 | 2403 |
2400 #endif /* MULE */ | 2404 #endif /* MULE */ |
2401 | 2405 |
2403 use bold and oblique first if medium and regular are available. */ | 2407 use bold and oblique first if medium and regular are available. */ |
2404 inst_list = | 2408 inst_list = |
2405 Fcons | 2409 Fcons |
2406 (Fcons | 2410 (Fcons |
2407 (list1 (device_symbol), | 2411 (list1 (device_symbol), |
2408 build_string ("-*-*-medium-r-*-*-*-120-*-*-c-*-*-*")), | 2412 build_ascstring ("-*-*-medium-r-*-*-*-120-*-*-c-*-*-*")), |
2409 inst_list); | 2413 inst_list); |
2410 | 2414 |
2411 /* With a Cygwin XFree86 install, this returns the best (clearest, | 2415 /* With a Cygwin XFree86 install, this returns the best (clearest, |
2412 most readable) font I can find when scaling of bitmap fonts is | 2416 most readable) font I can find when scaling of bitmap fonts is |
2413 turned on, as it is by default. (WHO IN THE NAME OF CHRIST THOUGHT | 2417 turned on, as it is by default. (WHO IN THE NAME OF CHRIST THOUGHT |
2416 | 2420 |
2417 inst_list = | 2421 inst_list = |
2418 Fcons | 2422 Fcons |
2419 (Fcons | 2423 (Fcons |
2420 (list1 (device_symbol), | 2424 (list1 (device_symbol), |
2421 build_string ("-*-lucidatypewriter-medium-r-*-*-*-120-*-*-*-*-*-*")), | 2425 build_ascstring ("-*-lucidatypewriter-medium-r-*-*-*-120-*-*-*-*-*-*")), |
2422 inst_list); | 2426 inst_list); |
2423 | 2427 |
2424 #endif /* !USE_XFT */ | 2428 #endif /* !HAVE_XFT */ |
2425 | 2429 |
2426 #endif /* HAVE_X_WINDOWS || HAVE_GTK */ | 2430 #endif /* HAVE_X_WINDOWS || HAVE_GTK */ |
2427 | 2431 |
2428 #ifdef HAVE_TTY | 2432 #ifdef HAVE_TTY |
2429 inst_list = Fcons (Fcons (list1 (Qtty), build_string ("normal")), | 2433 inst_list = Fcons (Fcons (list1 (Qtty), build_ascstring ("normal")), |
2430 inst_list); | 2434 inst_list); |
2431 #endif /* HAVE_TTY */ | 2435 #endif /* HAVE_TTY */ |
2432 | 2436 |
2433 #ifdef HAVE_MS_WINDOWS | 2437 #ifdef HAVE_MS_WINDOWS |
2434 { | 2438 { |
2443 for (mswfontptr = mswfonts + countof (mswfonts) - 1; | 2447 for (mswfontptr = mswfonts + countof (mswfonts) - 1; |
2444 mswfontptr >= mswfonts; mswfontptr--) | 2448 mswfontptr >= mswfonts; mswfontptr--) |
2445 { | 2449 { |
2446 /* display device */ | 2450 /* display device */ |
2447 inst_list = Fcons (Fcons (list1 (Qmswindows), | 2451 inst_list = Fcons (Fcons (list1 (Qmswindows), |
2448 build_string (*mswfontptr)), | 2452 build_ascstring (*mswfontptr)), |
2449 inst_list); | 2453 inst_list); |
2450 /* printer device */ | 2454 /* printer device */ |
2451 inst_list = Fcons (Fcons (list1 (Qmsprinter), | 2455 inst_list = Fcons (Fcons (list1 (Qmsprinter), |
2452 build_string (*mswfontptr)), | 2456 build_ascstring (*mswfontptr)), |
2453 inst_list); | 2457 inst_list); |
2454 } | 2458 } |
2455 /* Use Lucida Console rather than Courier New if it exists -- the | 2459 /* Use Lucida Console rather than Courier New if it exists -- the |
2456 line spacing is much less, so many more lines fit with the same | 2460 line spacing is much less, so many more lines fit with the same |
2457 size font. (And it's specifically designed for screens.) */ | 2461 size font. (And it's specifically designed for screens.) */ |
2458 inst_list = Fcons (Fcons (list1 (Qmswindows), | 2462 inst_list = Fcons (Fcons (list1 (Qmswindows), |
2459 build_string ("Lucida Console:Regular:10::")), | 2463 build_ascstring ("Lucida Console:Regular:10::")), |
2460 inst_list); | 2464 inst_list); |
2461 } | 2465 } |
2462 #endif /* HAVE_MS_WINDOWS */ | 2466 #endif /* HAVE_MS_WINDOWS */ |
2463 | 2467 |
2464 set_specifier_fallback (Fget (Vdefault_face, Qfont, Qnil), inst_list); | 2468 set_specifier_fallback (Fget (Vdefault_face, Qfont, Qnil), inst_list); |
2478 list1 (Fcons (Qnil, Qnil))); | 2482 list1 (Fcons (Qnil, Qnil))); |
2479 | 2483 |
2480 /* gui-element is the parent face of all gui elements such as | 2484 /* gui-element is the parent face of all gui elements such as |
2481 modeline, vertical divider and toolbar. */ | 2485 modeline, vertical divider and toolbar. */ |
2482 Vgui_element_face = Fmake_face (Qgui_element, | 2486 Vgui_element_face = Fmake_face (Qgui_element, |
2483 build_msg_string ("gui element face"), | 2487 build_defer_string ("gui element face"), |
2484 Qnil); | 2488 Qnil); |
2485 | 2489 |
2486 /* Provide some last-resort fallbacks for gui-element face which | 2490 /* Provide some last-resort fallbacks for gui-element face which |
2487 mustn't default to default. */ | 2491 mustn't default to default. */ |
2488 { | 2492 { |
2492 But it gets referred to later! */ | 2496 But it gets referred to later! */ |
2493 #ifdef HAVE_GTK | 2497 #ifdef HAVE_GTK |
2494 /* We need to put something in there, or error checking gets | 2498 /* We need to put something in there, or error checking gets |
2495 #%!@#ed up before the styles are set, which override the | 2499 #%!@#ed up before the styles are set, which override the |
2496 fallbacks. */ | 2500 fallbacks. */ |
2497 fg_fb = acons (list1 (Qgtk), build_string ("black"), fg_fb); | 2501 fg_fb = acons (list1 (Qgtk), build_ascstring ("black"), fg_fb); |
2498 bg_fb = acons (list1 (Qgtk), build_string ("Gray80"), bg_fb); | 2502 bg_fb = acons (list1 (Qgtk), build_ascstring ("Gray80"), bg_fb); |
2499 #endif | 2503 #endif |
2500 #ifdef HAVE_X_WINDOWS | 2504 #ifdef HAVE_X_WINDOWS |
2501 fg_fb = acons (list1 (Qx), build_string ("black"), fg_fb); | 2505 fg_fb = acons (list1 (Qx), build_ascstring ("black"), fg_fb); |
2502 bg_fb = acons (list1 (Qx), build_string ("Gray80"), bg_fb); | 2506 bg_fb = acons (list1 (Qx), build_ascstring ("Gray80"), bg_fb); |
2503 #endif | 2507 #endif |
2504 #ifdef HAVE_TTY | 2508 #ifdef HAVE_TTY |
2505 fg_fb = acons (list1 (Qtty), Fvector (0, 0), fg_fb); | 2509 fg_fb = acons (list1 (Qtty), Fvector (0, 0), fg_fb); |
2506 bg_fb = acons (list1 (Qtty), Fvector (0, 0), bg_fb); | 2510 bg_fb = acons (list1 (Qtty), Fvector (0, 0), bg_fb); |
2507 #endif | 2511 #endif |
2508 #ifdef HAVE_MS_WINDOWS | 2512 #ifdef HAVE_MS_WINDOWS |
2509 fg_fb = acons (list1 (Qmsprinter), build_string ("black"), fg_fb); | 2513 fg_fb = acons (list1 (Qmsprinter), build_ascstring ("black"), fg_fb); |
2510 bg_fb = acons (list1 (Qmsprinter), build_string ("white"), bg_fb); | 2514 bg_fb = acons (list1 (Qmsprinter), build_ascstring ("white"), bg_fb); |
2511 fg_fb = acons (list1 (Qmswindows), build_string ("black"), fg_fb); | 2515 fg_fb = acons (list1 (Qmswindows), build_ascstring ("black"), fg_fb); |
2512 bg_fb = acons (list1 (Qmswindows), build_string ("Gray75"), bg_fb); | 2516 bg_fb = acons (list1 (Qmswindows), build_ascstring ("Gray75"), bg_fb); |
2513 #endif | 2517 #endif |
2514 set_specifier_fallback (Fget (Vgui_element_face, Qforeground, Qnil), fg_fb); | 2518 set_specifier_fallback (Fget (Vgui_element_face, Qforeground, Qnil), fg_fb); |
2515 set_specifier_fallback (Fget (Vgui_element_face, Qbackground, Qnil), bg_fb); | 2519 set_specifier_fallback (Fget (Vgui_element_face, Qbackground, Qnil), bg_fb); |
2516 } | 2520 } |
2517 | 2521 |
2518 /* Now create the other faces that redisplay needs to refer to | 2522 /* Now create the other faces that redisplay needs to refer to |
2519 directly. We could create them in Lisp but it's simpler this | 2523 directly. We could create them in Lisp but it's simpler this |
2520 way since we need to get them anyway. */ | 2524 way since we need to get them anyway. */ |
2521 | 2525 |
2522 /* modeline is gui element. */ | 2526 /* modeline is gui element. */ |
2523 Vmodeline_face = Fmake_face (Qmodeline, build_msg_string ("modeline face"), | 2527 Vmodeline_face = Fmake_face (Qmodeline, build_defer_string ("modeline face"), |
2524 Qnil); | 2528 Qnil); |
2525 | 2529 |
2526 set_specifier_fallback (Fget (Vmodeline_face, Qforeground, Qunbound), | 2530 set_specifier_fallback (Fget (Vmodeline_face, Qforeground, Qunbound), |
2527 Fget (Vgui_element_face, Qforeground, Qunbound)); | 2531 Fget (Vgui_element_face, Qforeground, Qunbound)); |
2528 set_specifier_fallback (Fget (Vmodeline_face, Qbackground, Qunbound), | 2532 set_specifier_fallback (Fget (Vmodeline_face, Qbackground, Qunbound), |
2531 Fget (Vgui_element_face, Qbackground_pixmap, | 2535 Fget (Vgui_element_face, Qbackground_pixmap, |
2532 Qunbound)); | 2536 Qunbound)); |
2533 | 2537 |
2534 /* toolbar is another gui element */ | 2538 /* toolbar is another gui element */ |
2535 Vtoolbar_face = Fmake_face (Qtoolbar, | 2539 Vtoolbar_face = Fmake_face (Qtoolbar, |
2536 build_msg_string ("toolbar face"), | 2540 build_defer_string ("toolbar face"), |
2537 Qnil); | 2541 Qnil); |
2538 set_specifier_fallback (Fget (Vtoolbar_face, Qforeground, Qunbound), | 2542 set_specifier_fallback (Fget (Vtoolbar_face, Qforeground, Qunbound), |
2539 Fget (Vgui_element_face, Qforeground, Qunbound)); | 2543 Fget (Vgui_element_face, Qforeground, Qunbound)); |
2540 set_specifier_fallback (Fget (Vtoolbar_face, Qbackground, Qunbound), | 2544 set_specifier_fallback (Fget (Vtoolbar_face, Qbackground, Qunbound), |
2541 Fget (Vgui_element_face, Qbackground, Qunbound)); | 2545 Fget (Vgui_element_face, Qbackground, Qunbound)); |
2543 Fget (Vgui_element_face, Qbackground_pixmap, | 2547 Fget (Vgui_element_face, Qbackground_pixmap, |
2544 Qunbound)); | 2548 Qunbound)); |
2545 | 2549 |
2546 /* vertical divider is another gui element */ | 2550 /* vertical divider is another gui element */ |
2547 Vvertical_divider_face = Fmake_face (Qvertical_divider, | 2551 Vvertical_divider_face = Fmake_face (Qvertical_divider, |
2548 build_msg_string ("vertical divider face"), | 2552 build_defer_string ("vertical divider face"), |
2549 Qnil); | 2553 Qnil); |
2550 | 2554 |
2551 set_specifier_fallback (Fget (Vvertical_divider_face, Qforeground, Qunbound), | 2555 set_specifier_fallback (Fget (Vvertical_divider_face, Qforeground, Qunbound), |
2552 Fget (Vgui_element_face, Qforeground, Qunbound)); | 2556 Fget (Vgui_element_face, Qforeground, Qunbound)); |
2553 set_specifier_fallback (Fget (Vvertical_divider_face, Qbackground, Qunbound), | 2557 set_specifier_fallback (Fget (Vvertical_divider_face, Qbackground, Qunbound), |
2557 Fget (Vgui_element_face, Qbackground_pixmap, | 2561 Fget (Vgui_element_face, Qbackground_pixmap, |
2558 Qunbound)); | 2562 Qunbound)); |
2559 | 2563 |
2560 /* widget is another gui element */ | 2564 /* widget is another gui element */ |
2561 Vwidget_face = Fmake_face (Qwidget, | 2565 Vwidget_face = Fmake_face (Qwidget, |
2562 build_msg_string ("widget face"), | 2566 build_defer_string ("widget face"), |
2563 Qnil); | 2567 Qnil); |
2564 /* #### weird ... the gui-element face doesn't have its own font yet */ | 2568 /* #### weird ... the gui-element face doesn't have its own font yet */ |
2565 set_specifier_fallback (Fget (Vwidget_face, Qfont, Qunbound), | 2569 set_specifier_fallback (Fget (Vwidget_face, Qfont, Qunbound), |
2566 Fget (Vgui_element_face, Qfont, Qunbound)); | 2570 Fget (Vgui_element_face, Qfont, Qunbound)); |
2567 set_specifier_fallback (Fget (Vwidget_face, Qforeground, Qunbound), | 2571 set_specifier_fallback (Fget (Vwidget_face, Qforeground, Qunbound), |
2569 set_specifier_fallback (Fget (Vwidget_face, Qbackground, Qunbound), | 2573 set_specifier_fallback (Fget (Vwidget_face, Qbackground, Qunbound), |
2570 Fget (Vgui_element_face, Qbackground, Qunbound)); | 2574 Fget (Vgui_element_face, Qbackground, Qunbound)); |
2571 /* We don't want widgets to have a default background pixmap. */ | 2575 /* We don't want widgets to have a default background pixmap. */ |
2572 | 2576 |
2573 Vleft_margin_face = Fmake_face (Qleft_margin, | 2577 Vleft_margin_face = Fmake_face (Qleft_margin, |
2574 build_msg_string ("left margin face"), | 2578 build_defer_string ("left margin face"), |
2575 Qnil); | 2579 Qnil); |
2576 Vright_margin_face = Fmake_face (Qright_margin, | 2580 Vright_margin_face = Fmake_face (Qright_margin, |
2577 build_msg_string ("right margin face"), | 2581 build_defer_string ("right margin face"), |
2578 Qnil); | 2582 Qnil); |
2579 Vtext_cursor_face = Fmake_face (Qtext_cursor, | 2583 Vtext_cursor_face = Fmake_face (Qtext_cursor, |
2580 build_msg_string ("face for text cursor"), | 2584 build_defer_string ("face for text cursor"), |
2581 Qnil); | 2585 Qnil); |
2582 Vpointer_face = | 2586 Vpointer_face = |
2583 Fmake_face (Qpointer, | 2587 Fmake_face (Qpointer, |
2584 build_msg_string | 2588 build_defer_string |
2585 ("face for foreground/background colors of mouse pointer"), | 2589 ("face for foreground/background colors of mouse pointer"), |
2586 Qnil); | 2590 Qnil); |
2587 } | 2591 } |