aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/w32faces.c194
1 files changed, 180 insertions, 14 deletions
diff --git a/src/w32faces.c b/src/w32faces.c
index e0bdefa6493..5384f97ad7c 100644
--- a/src/w32faces.c
+++ b/src/w32faces.c
@@ -182,14 +182,50 @@ Boston, MA 02111-1307, USA. */
182#include "lisp.h" 182#include "lisp.h"
183#include "charset.h" 183#include "charset.h"
184#include "frame.h" 184#include "frame.h"
185
186#ifdef HAVE_X_WINDOWS
187#include "xterm.h"
188#include "fontset.h"
189#ifdef USE_MOTIF
190#include <Xm/Xm.h>
191#include <Xm/XmStrDefs.h>
192#endif /* USE_MOTIF */
193#endif
194
195#ifdef MSDOS
196#include "dosfns.h"
197#endif
198
199#ifdef WINDOWSNT
185#include "w32term.h" 200#include "w32term.h"
186#include "fontset.h" 201#include "fontset.h"
202#endif
203
187#include "buffer.h" 204#include "buffer.h"
188#include "dispextern.h" 205#include "dispextern.h"
189#include "blockinput.h" 206#include "blockinput.h"
190#include "window.h" 207#include "window.h"
191#include "intervals.h" 208#include "intervals.h"
192 209
210#ifdef HAVE_X_WINDOWS
211
212/* Compensate for a bug in Xos.h on some systems, on which it requires
213 time.h. On some such systems, Xos.h tries to redefine struct
214 timeval and struct timezone if USG is #defined while it is
215 #included. */
216
217#ifdef XOS_NEEDS_TIME_H
218#include <time.h>
219#undef USG
220#include <X11/Xos.h>
221#define USG
222#define __TIMEVAL__
223#else /* not XOS_NEEDS_TIME_H */
224#include <X11/Xos.h>
225#endif /* not XOS_NEEDS_TIME_H */
226
227#endif /* HAVE_X_WINDOWS */
228
193#include <stdio.h> 229#include <stdio.h>
194#include <ctype.h> 230#include <ctype.h>
195#include "keyboard.h" 231#include "keyboard.h"
@@ -280,6 +316,7 @@ Lisp_Object Qface_alias;
280 316
281/* Names of frame parameters related to faces. */ 317/* Names of frame parameters related to faces. */
282 318
319extern Lisp_Object Qscroll_bar_foreground, Qscroll_bar_background;
283extern Lisp_Object Qborder_color, Qcursor_color, Qmouse_color; 320extern Lisp_Object Qborder_color, Qcursor_color, Qmouse_color;
284 321
285/* Default stipple pattern used on monochrome displays. This stipple 322/* Default stipple pattern used on monochrome displays. This stipple
@@ -460,6 +497,8 @@ static Lisp_Object xlfd_symbolic_value P_ ((struct table_entry *, int,
460static struct table_entry *xlfd_lookup_field_contents P_ ((struct table_entry *, int, 497static struct table_entry *xlfd_lookup_field_contents P_ ((struct table_entry *, int,
461 struct font_name *, int)); 498 struct font_name *, int));
462 499
500#ifdef HAVE_WINDOW_SYSTEM
501
463static int split_font_name P_ ((struct frame *, struct font_name *, int)); 502static int split_font_name P_ ((struct frame *, struct font_name *, int));
464static int xlfd_point_size P_ ((struct frame *, struct font_name *)); 503static int xlfd_point_size P_ ((struct frame *, struct font_name *));
465static void sort_fonts P_ ((struct frame *, struct font_name *, int, 504static void sort_fonts P_ ((struct frame *, struct font_name *, int,
@@ -468,7 +507,11 @@ static GC x_create_gc P_ ((struct frame *, unsigned long, XGCValues *));
468static void x_free_gc P_ ((struct frame *, GC)); 507static void x_free_gc P_ ((struct frame *, GC));
469static void clear_font_table P_ ((struct frame *)); 508static void clear_font_table P_ ((struct frame *));
470 509
510#ifdef WINDOWSNT
471extern Lisp_Object w32_list_fonts P_ ((struct frame *, Lisp_Object, int, int)); 511extern Lisp_Object w32_list_fonts P_ ((struct frame *, Lisp_Object, int, int));
512#endif /* WINDOWSNT */
513
514#endif /* HAVE_WINDOW_SYSTEM */
472 515
473 516
474/*********************************************************************** 517/***********************************************************************
@@ -506,6 +549,7 @@ x_free_gc (f, gc)
506 UNBLOCK_INPUT; 549 UNBLOCK_INPUT;
507} 550}
508 551
552
509/* Like strdup, but uses xmalloc. */ 553/* Like strdup, but uses xmalloc. */
510 554
511static char * 555static char *
@@ -600,6 +644,7 @@ init_frame_faces (f)
600 if (FRAME_FACE_CACHE (f) == NULL) 644 if (FRAME_FACE_CACHE (f) == NULL)
601 FRAME_FACE_CACHE (f) = make_face_cache (f); 645 FRAME_FACE_CACHE (f) = make_face_cache (f);
602 646
647#ifdef HAVE_WINDOW_SYSTEM
603 /* Make the image cache. */ 648 /* Make the image cache. */
604 if (FRAME_WINDOW_P (f)) 649 if (FRAME_WINDOW_P (f))
605 { 650 {
@@ -607,10 +652,16 @@ init_frame_faces (f)
607 FRAME_X_IMAGE_CACHE (f) = make_image_cache (); 652 FRAME_X_IMAGE_CACHE (f) = make_image_cache ();
608 ++FRAME_X_IMAGE_CACHE (f)->refcount; 653 ++FRAME_X_IMAGE_CACHE (f)->refcount;
609 } 654 }
655#endif /* HAVE_WINDOW_SYSTEM */
610 656
611 /* Realize basic faces. Must have enough information in frame 657 /* Realize basic faces. Must have enough information in frame
612 parameters to realize basic faces at this point. */ 658 parameters to realize basic faces at this point. */
659#ifdef HAVE_X_WINDOWS
660 if (!FRAME_X_P (f) || FRAME_X_WINDOW (f))
661#endif
662#ifdef WINDOWSNT
613 if (!FRAME_WINDOW_P (f) || FRAME_W32_WINDOW (f)) 663 if (!FRAME_WINDOW_P (f) || FRAME_W32_WINDOW (f))
664#endif
614 if (!realize_basic_faces (f)) 665 if (!realize_basic_faces (f))
615 abort (); 666 abort ();
616} 667}
@@ -630,6 +681,7 @@ free_frame_faces (f)
630 FRAME_FACE_CACHE (f) = NULL; 681 FRAME_FACE_CACHE (f) = NULL;
631 } 682 }
632 683
684#ifdef HAVE_WINDOW_SYSTEM
633 if (FRAME_WINDOW_P (f)) 685 if (FRAME_WINDOW_P (f))
634 { 686 {
635 struct image_cache *image_cache = FRAME_X_IMAGE_CACHE (f); 687 struct image_cache *image_cache = FRAME_X_IMAGE_CACHE (f);
@@ -640,6 +692,7 @@ free_frame_faces (f)
640 free_image_cache (f); 692 free_image_cache (f);
641 } 693 }
642 } 694 }
695#endif /* HAVE_WINDOW_SYSTEM */
643} 696}
644 697
645 698
@@ -668,6 +721,7 @@ void
668clear_face_cache (clear_fonts_p) 721clear_face_cache (clear_fonts_p)
669 int clear_fonts_p; 722 int clear_fonts_p;
670{ 723{
724#ifdef HAVE_WINDOW_SYSTEM
671 Lisp_Object tail, frame; 725 Lisp_Object tail, frame;
672 struct frame *f; 726 struct frame *f;
673 727
@@ -703,6 +757,7 @@ clear_face_cache (clear_fonts_p)
703 } 757 }
704 } 758 }
705 } 759 }
760#endif /* HAVE_WINDOW_SYSTEM */
706} 761}
707 762
708 763
@@ -718,6 +773,9 @@ Optional THOROUGHLY non-nil means try to free unused fonts, too.")
718 773
719 774
720 775
776#ifdef HAVE_WINDOW_SYSTEM
777
778
721/* Remove those fonts from the font table of frame F that are not used 779/* Remove those fonts from the font table of frame F that are not used
722 by fontsets. Called from clear_face_cache from time to time. */ 780 by fontsets. Called from clear_face_cache from time to time. */
723 781
@@ -786,11 +844,16 @@ clear_font_table (f)
786} 844}
787 845
788 846
847#endif /* HAVE_WINDOW_SYSTEM */
848
849
789 850
790/*********************************************************************** 851/***********************************************************************
791 X Pixmaps 852 X Pixmaps
792 ***********************************************************************/ 853 ***********************************************************************/
793 854
855#ifdef HAVE_WINDOW_SYSTEM
856
794DEFUN ("bitmap-spec-p", Fbitmap_spec_p, Sbitmap_spec_p, 1, 1, 0, 857DEFUN ("bitmap-spec-p", Fbitmap_spec_p, Sbitmap_spec_p, 1, 1, 0,
795 "Value is non-nil if OBJECT is a valid bitmap specification.\n\ 858 "Value is non-nil if OBJECT is a valid bitmap specification.\n\
796A bitmap specification is either a string, a filename, or a list\n\ 859A bitmap specification is either a string, a filename, or a list\n\
@@ -911,7 +974,7 @@ load_pixmap (f, name, w_ptr, h_ptr)
911 return bitmap_id; 974 return bitmap_id;
912} 975}
913 976
914 977#endif /* HAVE_WINDOW_SYSTEM */
915 978
916 979
917 980
@@ -919,6 +982,8 @@ load_pixmap (f, name, w_ptr, h_ptr)
919 Minimum font bounds 982 Minimum font bounds
920 ***********************************************************************/ 983 ***********************************************************************/
921 984
985#ifdef HAVE_WINDOW_SYSTEM
986
922/* Update the line_height of frame F. Return non-zero if line height 987/* Update the line_height of frame F. Return non-zero if line height
923 changes. */ 988 changes. */
924 989
@@ -939,11 +1004,15 @@ frame_update_line_height (f)
939 return changed_p; 1004 return changed_p;
940} 1005}
941 1006
1007#endif /* HAVE_WINDOW_SYSTEM */
1008
942 1009
943/*********************************************************************** 1010/***********************************************************************
944 Fonts 1011 Fonts
945 ***********************************************************************/ 1012 ***********************************************************************/
946 1013
1014#ifdef HAVE_WINDOW_SYSTEM
1015
947/* Load font or fontset of face FACE which is used on frame F. 1016/* Load font or fontset of face FACE which is used on frame F.
948 FONTSET is the fontset FACE should use or -1, if FACE doesn't use a 1017 FONTSET is the fontset FACE should use or -1, if FACE doesn't use a
949 fontset. FONT_NAME is the name of the font to load, if no fontset 1018 fontset. FONT_NAME is the name of the font to load, if no fontset
@@ -1007,6 +1076,8 @@ load_face_font_or_fontset (f, face, font_name, fontset)
1007 build_string (font_name), Qnil); 1076 build_string (font_name), Qnil);
1008} 1077}
1009 1078
1079#endif /* HAVE_WINDOW_SYSTEM */
1080
1010 1081
1011 1082
1012/*********************************************************************** 1083/***********************************************************************
@@ -1078,9 +1149,6 @@ defined_color (f, color_name, color_def, alloc)
1078 XColor *color_def; 1149 XColor *color_def;
1079 int alloc; 1150 int alloc;
1080{ 1151{
1081 if (!f)
1082 return 1;
1083
1084 if (!FRAME_WINDOW_P (f)) 1152 if (!FRAME_WINDOW_P (f))
1085 return tty_defined_color (f, color_name, color_def, alloc); 1153 return tty_defined_color (f, color_name, color_def, alloc);
1086#ifdef HAVE_X_WINDOWS 1154#ifdef HAVE_X_WINDOWS
@@ -1088,10 +1156,7 @@ defined_color (f, color_name, color_def, alloc)
1088 return x_defined_color (f, color_name, color_def, alloc); 1156 return x_defined_color (f, color_name, color_def, alloc);
1089#endif 1157#endif
1090#ifdef WINDOWSNT 1158#ifdef WINDOWSNT
1091 else if (FRAME_WINDOW_P (f)) 1159 else if (FRAME_W32_P (f))
1092 /* FIXME: w32_defined_color doesn't exist! w32fns.c defines
1093 defined_color which needs to be renamed, and the declaration
1094 of color_def therein should be changed. */
1095 return w32_defined_color (f, color_name, color_def, alloc); 1160 return w32_defined_color (f, color_name, color_def, alloc);
1096#endif 1161#endif
1097#ifdef macintosh 1162#ifdef macintosh
@@ -1130,16 +1195,15 @@ tty_color_name (f, idx)
1130 return msdos_stdcolor_name (idx); 1195 return msdos_stdcolor_name (idx);
1131#endif 1196#endif
1132 1197
1133#ifdef WINDOWSNT
1134 /* FIXME: When/if w32 supports colors in non-window mode, there should
1135 be a call here to a w32-specific function that returns the color
1136 by index using the default color mapping on a Windows console. */
1137#endif
1138
1139 if (idx == FACE_TTY_DEFAULT_FG_COLOR) 1198 if (idx == FACE_TTY_DEFAULT_FG_COLOR)
1140 return build_string (unspecified_fg); 1199 return build_string (unspecified_fg);
1141 if (idx == FACE_TTY_DEFAULT_BG_COLOR) 1200 if (idx == FACE_TTY_DEFAULT_BG_COLOR)
1142 return build_string (unspecified_bg); 1201 return build_string (unspecified_bg);
1202
1203#ifdef WINDOWSNT
1204 return vga_stdcolor_name (idx);
1205#endif
1206
1143 return Qunspecified; 1207 return Qunspecified;
1144} 1208}
1145 1209
@@ -1758,6 +1822,8 @@ face_numeric_swidth (width)
1758} 1822}
1759 1823
1760 1824
1825#ifdef HAVE_WINDOW_SYSTEM
1826
1761/* Return non-zero if FONT is the name of a fixed-pitch font. */ 1827/* Return non-zero if FONT is the name of a fixed-pitch font. */
1762 1828
1763static INLINE int 1829static INLINE int
@@ -2431,6 +2497,8 @@ the WIDTH times as wide as FACE on FRAME.")
2431 } 2497 }
2432} 2498}
2433 2499
2500#endif /* HAVE_WINDOW_SYSTEM */
2501
2434 2502
2435 2503
2436/*********************************************************************** 2504/***********************************************************************
@@ -2927,11 +2995,13 @@ merge_face_vector_with_property (f, to, prop)
2927 } 2995 }
2928 else if (EQ (keyword, QCstipple)) 2996 else if (EQ (keyword, QCstipple))
2929 { 2997 {
2998#ifdef HAVE_X_WINDOWS
2930 Lisp_Object pixmap_p = Fbitmap_spec_p (value); 2999 Lisp_Object pixmap_p = Fbitmap_spec_p (value);
2931 if (!NILP (pixmap_p)) 3000 if (!NILP (pixmap_p))
2932 to[LFACE_STIPPLE_INDEX] = value; 3001 to[LFACE_STIPPLE_INDEX] = value;
2933 else 3002 else
2934 add_to_log ("Illegal face stipple", value, Qnil); 3003 add_to_log ("Illegal face stipple", value, Qnil);
3004#endif
2935 } 3005 }
2936 else if (EQ (keyword, QCwidth)) 3006 else if (EQ (keyword, QCwidth))
2937 { 3007 {
@@ -3345,12 +3415,14 @@ frame.")
3345 } 3415 }
3346 else if (EQ (attr, QCstipple)) 3416 else if (EQ (attr, QCstipple))
3347 { 3417 {
3418#ifdef HAVE_X_WINDOWS
3348 if (!UNSPECIFIEDP (value) 3419 if (!UNSPECIFIEDP (value)
3349 && !NILP (value) 3420 && !NILP (value)
3350 && NILP (Fbitmap_spec_p (value))) 3421 && NILP (Fbitmap_spec_p (value)))
3351 signal_error ("Invalid stipple attribute", value); 3422 signal_error ("Invalid stipple attribute", value);
3352 old_value = LFACE_STIPPLE (lface); 3423 old_value = LFACE_STIPPLE (lface);
3353 LFACE_STIPPLE (lface) = value; 3424 LFACE_STIPPLE (lface) = value;
3425#endif /* HAVE_X_WINDOWS */
3354 } 3426 }
3355 else if (EQ (attr, QCwidth)) 3427 else if (EQ (attr, QCwidth))
3356 { 3428 {
@@ -3366,6 +3438,7 @@ frame.")
3366 } 3438 }
3367 else if (EQ (attr, QCfont)) 3439 else if (EQ (attr, QCfont))
3368 { 3440 {
3441#ifdef HAVE_WINDOW_SYSTEM
3369 /* Set font-related attributes of the Lisp face from an 3442 /* Set font-related attributes of the Lisp face from an
3370 XLFD font name. */ 3443 XLFD font name. */
3371 struct frame *f; 3444 struct frame *f;
@@ -3380,6 +3453,7 @@ frame.")
3380 signal_error ("Invalid font name", value); 3453 signal_error ("Invalid font name", value);
3381 3454
3382 font_related_attr_p = 1; 3455 font_related_attr_p = 1;
3456#endif /* HAVE_WINDOW_SYSTEM */
3383 } 3457 }
3384 else if (EQ (attr, QCbold)) 3458 else if (EQ (attr, QCbold))
3385 { 3459 {
@@ -3409,6 +3483,7 @@ frame.")
3409 ++windows_or_buffers_changed; 3483 ++windows_or_buffers_changed;
3410 } 3484 }
3411 3485
3486#ifdef HAVE_WINDOW_SYSTEM
3412 3487
3413 if (!EQ (frame, Qt) 3488 if (!EQ (frame, Qt)
3414 && !UNSPECIFIEDP (value) 3489 && !UNSPECIFIEDP (value)
@@ -3467,11 +3542,14 @@ frame.")
3467 Fmodify_frame_parameters (frame, Fcons (Fcons (param, value), Qnil)); 3542 Fmodify_frame_parameters (frame, Fcons (Fcons (param, value), Qnil));
3468 } 3543 }
3469 3544
3545#endif /* HAVE_WINDOW_SYSTEM */
3470 3546
3471 return face; 3547 return face;
3472} 3548}
3473 3549
3474 3550
3551#ifdef HAVE_WINDOW_SYSTEM
3552
3475/* Set the `font' frame parameter of FRAME according to `default' face 3553/* Set the `font' frame parameter of FRAME according to `default' face
3476 attributes LFACE. */ 3554 attributes LFACE. */
3477 3555
@@ -3678,6 +3756,8 @@ DEFUN ("internal-set-lisp-face-attribute-from-resource",
3678 return Finternal_set_lisp_face_attribute (face, attr, value, frame); 3756 return Finternal_set_lisp_face_attribute (face, attr, value, frame);
3679} 3757}
3680 3758
3759#endif /* HAVE_WINDOW_SYSTEM */
3760
3681 3761
3682DEFUN ("internal-get-lisp-face-attribute", Finternal_get_lisp_face_attribute, 3762DEFUN ("internal-get-lisp-face-attribute", Finternal_get_lisp_face_attribute,
3683 Sinternal_get_lisp_face_attribute, 3763 Sinternal_get_lisp_face_attribute,
@@ -4057,6 +4137,7 @@ free_realized_face (f, face)
4057{ 4137{
4058 if (face) 4138 if (face)
4059 { 4139 {
4140#ifdef HAVE_WINDOW_SYSTEM
4060 if (FRAME_WINDOW_P (f)) 4141 if (FRAME_WINDOW_P (f))
4061 { 4142 {
4062 if (face->gc) 4143 if (face->gc)
@@ -4068,6 +4149,7 @@ free_realized_face (f, face)
4068 free_face_colors (f, face); 4149 free_face_colors (f, face);
4069 x_destroy_bitmap (f, face->stipple); 4150 x_destroy_bitmap (f, face->stipple);
4070 } 4151 }
4152#endif /* HAVE_WINDOW_SYSTEM */
4071 4153
4072 xfree (face); 4154 xfree (face);
4073 } 4155 }
@@ -4083,6 +4165,7 @@ prepare_face_for_display (f, face)
4083 struct frame *f; 4165 struct frame *f;
4084 struct face *face; 4166 struct face *face;
4085{ 4167{
4168#ifdef HAVE_WINDOW_SYSTEM
4086 xassert (FRAME_WINDOW_P (f)); 4169 xassert (FRAME_WINDOW_P (f));
4087 4170
4088 if (face->gc == 0) 4171 if (face->gc == 0)
@@ -4113,6 +4196,7 @@ prepare_face_for_display (f, face)
4113 face->gc = x_create_gc (f, mask, &xgcv); 4196 face->gc = x_create_gc (f, mask, &xgcv);
4114 UNBLOCK_INPUT; 4197 UNBLOCK_INPUT;
4115 } 4198 }
4199#endif /* HAVE_WINDOW_SYSTEM */
4116} 4200}
4117 4201
4118 4202
@@ -4194,6 +4278,7 @@ clear_face_gcs (c)
4194{ 4278{
4195 if (c && FRAME_WINDOW_P (c->f)) 4279 if (c && FRAME_WINDOW_P (c->f))
4196 { 4280 {
4281#ifdef HAVE_WINDOW_SYSTEM
4197 int i; 4282 int i;
4198 for (i = BASIC_FACE_ID_SENTINEL; i < c->used; ++i) 4283 for (i = BASIC_FACE_ID_SENTINEL; i < c->used; ++i)
4199 { 4284 {
@@ -4204,6 +4289,7 @@ clear_face_gcs (c)
4204 face->gc = 0; 4289 face->gc = 0;
4205 } 4290 }
4206 } 4291 }
4292#endif /* HAVE_WINDOW_SYSTEM */
4207 } 4293 }
4208} 4294}
4209 4295
@@ -4483,6 +4569,7 @@ smaller_face (f, face_id, steps)
4483 struct frame *f; 4569 struct frame *f;
4484 int face_id, steps; 4570 int face_id, steps;
4485 { 4571 {
4572#ifdef HAVE_WINDOW_SYSTEM
4486 struct face *face; 4573 struct face *face;
4487 Lisp_Object attrs[LFACE_VECTOR_SIZE]; 4574 Lisp_Object attrs[LFACE_VECTOR_SIZE];
4488 int pt, last_pt, last_height; 4575 int pt, last_pt, last_height;
@@ -4525,6 +4612,12 @@ smaller_face (f, face_id, steps)
4525 } 4612 }
4526 4613
4527 return new_face_id; 4614 return new_face_id;
4615
4616#else /* not HAVE_WINDOW_SYSTEM */
4617
4618 return face_id;
4619
4620#endif /* not HAVE_WINDOW_SYSTEM */
4528} 4621}
4529 4622
4530 4623
@@ -4537,6 +4630,7 @@ face_with_height (f, face_id, height)
4537 int face_id; 4630 int face_id;
4538 int height; 4631 int height;
4539{ 4632{
4633#ifdef HAVE_WINDOW_SYSTEM
4540 struct face *face; 4634 struct face *face;
4541 Lisp_Object attrs[LFACE_VECTOR_SIZE]; 4635 Lisp_Object attrs[LFACE_VECTOR_SIZE];
4542 4636
@@ -4548,6 +4642,7 @@ face_with_height (f, face_id, height)
4548 bcopy (face->lface, attrs, sizeof attrs); 4642 bcopy (face->lface, attrs, sizeof attrs);
4549 attrs[LFACE_HEIGHT_INDEX] = make_number (height); 4643 attrs[LFACE_HEIGHT_INDEX] = make_number (height);
4550 face_id = lookup_face (f, attrs, CHARSET_ASCII); 4644 face_id = lookup_face (f, attrs, CHARSET_ASCII);
4645#endif /* HAVE_WINDOW_SYSTEM */
4551 4646
4552 return face_id; 4647 return face_id;
4553} 4648}
@@ -4665,6 +4760,8 @@ be found. Value is ALIST.")
4665} 4760}
4666 4761
4667 4762
4763#ifdef HAVE_WINDOW_SYSTEM
4764
4668/* Return the X registry and encoding of font name FONT_NAME on frame F. 4765/* Return the X registry and encoding of font name FONT_NAME on frame F.
4669 Value is nil if not successful. */ 4766 Value is nil if not successful. */
4670 4767
@@ -5183,6 +5280,8 @@ choose_face_fontset_font (f, attrs, fontset, charset)
5183 return font_name; 5280 return font_name;
5184} 5281}
5185 5282
5283#endif /* HAVE_WINDOW_SYSTEM */
5284
5186 5285
5187 5286
5188/*********************************************************************** 5287/***********************************************************************
@@ -5242,6 +5341,7 @@ realize_default_face (f)
5242 lface = Finternal_make_lisp_face (Qdefault, frame); 5341 lface = Finternal_make_lisp_face (Qdefault, frame);
5243 } 5342 }
5244 5343
5344#ifdef HAVE_WINDOW_SYSTEM
5245 if (FRAME_WINDOW_P (f)) 5345 if (FRAME_WINDOW_P (f))
5246 { 5346 {
5247 /* Set frame_font to the value of the `font' frame parameter. */ 5347 /* Set frame_font to the value of the `font' frame parameter. */
@@ -5305,6 +5405,7 @@ realize_default_face (f)
5305 Vface_default_registry = build_string ("iso8859-1"); 5405 Vface_default_registry = build_string ("iso8859-1");
5306 } 5406 }
5307 } 5407 }
5408#endif /* HAVE_WINDOW_SYSTEM */
5308 5409
5309 if (!FRAME_WINDOW_P (f)) 5410 if (!FRAME_WINDOW_P (f))
5310 { 5411 {
@@ -5473,6 +5574,7 @@ realize_x_face (c, attrs, charset)
5473 Lisp_Object *attrs; 5574 Lisp_Object *attrs;
5474 int charset; 5575 int charset;
5475{ 5576{
5577#ifdef HAVE_WINDOW_SYSTEM
5476 struct face *face, *default_face; 5578 struct face *face, *default_face;
5477 struct frame *f; 5579 struct frame *f;
5478 Lisp_Object stipple, overline, strike_through, box; 5580 Lisp_Object stipple, overline, strike_through, box;
@@ -5685,6 +5787,7 @@ realize_x_face (c, attrs, charset)
5685 xassert (face->fontset < 0); 5787 xassert (face->fontset < 0);
5686 xassert (FACE_SUITABLE_FOR_CHARSET_P (face, charset)); 5788 xassert (FACE_SUITABLE_FOR_CHARSET_P (face, charset));
5687 return face; 5789 return face;
5790#endif /* HAVE_WINDOW_SYSTEM */
5688} 5791}
5689 5792
5690 5793
@@ -5751,6 +5854,34 @@ realize_tty_face (c, attrs, charset)
5751 face->foreground = load_color (c->f, face, 5854 face->foreground = load_color (c->f, face,
5752 attrs[LFACE_FOREGROUND_INDEX], 5855 attrs[LFACE_FOREGROUND_INDEX],
5753 LFACE_FOREGROUND_INDEX); 5856 LFACE_FOREGROUND_INDEX);
5857
5858#if defined (MSDOS) || defined (WINDOWSNT)
5859 /* If the foreground of the default face is the default color,
5860 use the foreground color defined by the frame. */
5861#ifdef MSDOS
5862 if (FRAME_MSDOS_P (c->f))
5863 {
5864#endif /* MSDOS */
5865
5866 if (face->foreground == FACE_TTY_DEFAULT_FG_COLOR
5867 || face->foreground == FACE_TTY_DEFAULT_COLOR)
5868 {
5869 face->foreground = FRAME_FOREGROUND_PIXEL (c->f);
5870 attrs[LFACE_FOREGROUND_INDEX] =
5871 tty_color_name (c->f, face->foreground);
5872 face_colors_defaulted = 1;
5873 }
5874 else if (face->foreground == FACE_TTY_DEFAULT_BG_COLOR)
5875 {
5876 face->foreground = FRAME_BACKGROUND_PIXEL (c->f);
5877 attrs[LFACE_FOREGROUND_INDEX] =
5878 tty_color_name (c->f, face->foreground);
5879 face_colors_defaulted = 1;
5880 }
5881#ifdef MSDOS
5882 }
5883#endif /* MSDOS */
5884#endif /* MSDOS or WINDOWSNT */
5754 } 5885 }
5755 5886
5756 color = attrs[LFACE_BACKGROUND_INDEX]; 5887 color = attrs[LFACE_BACKGROUND_INDEX];
@@ -5769,6 +5900,33 @@ realize_tty_face (c, attrs, charset)
5769 face->background = load_color (c->f, face, 5900 face->background = load_color (c->f, face,
5770 attrs[LFACE_BACKGROUND_INDEX], 5901 attrs[LFACE_BACKGROUND_INDEX],
5771 LFACE_BACKGROUND_INDEX); 5902 LFACE_BACKGROUND_INDEX);
5903#if defined (MSDOS) || defined (WINDOWSNT)
5904 /* If the background of the default face is the default color,
5905 use the background color defined by the frame. */
5906#ifdef MSDOS
5907 if (FRAME_MSDOS_P (c->f))
5908 {
5909#endif /* MSDOS */
5910
5911 if (face->background == FACE_TTY_DEFAULT_BG_COLOR
5912 || face->background == FACE_TTY_DEFAULT_COLOR)
5913 {
5914 face->background = FRAME_BACKGROUND_PIXEL (c->f);
5915 attrs[LFACE_BACKGROUND_INDEX] =
5916 tty_color_name (c->f, face->background);
5917 face_colors_defaulted = 1;
5918 }
5919 else if (face->background == FACE_TTY_DEFAULT_FG_COLOR)
5920 {
5921 face->background = FRAME_FOREGROUND_PIXEL (c->f);
5922 attrs[LFACE_BACKGROUND_INDEX] =
5923 tty_color_name (c->f, face->background);
5924 face_colors_defaulted = 1;
5925 }
5926#ifdef MSDOS
5927 }
5928#endif /* MSDOS */
5929#endif /* MSDOS or WINDOWSNT */
5772 } 5930 }
5773 5931
5774 /* Swap colors if face is inverse-video. If the colors are taken 5932 /* Swap colors if face is inverse-video. If the colors are taken
@@ -6068,7 +6226,9 @@ dump_realized_face (face)
6068 struct face *face; 6226 struct face *face;
6069{ 6227{
6070 fprintf (stderr, "ID: %d\n", face->id); 6228 fprintf (stderr, "ID: %d\n", face->id);
6229#ifdef HAVE_WINDOW_SYSTEM
6071 fprintf (stderr, "gc: %d\n", (int) face->gc); 6230 fprintf (stderr, "gc: %d\n", (int) face->gc);
6231#endif
6072 fprintf (stderr, "foreground: 0x%lx (%s)\n", 6232 fprintf (stderr, "foreground: 0x%lx (%s)\n",
6073 face->foreground, 6233 face->foreground,
6074 XSTRING (face->lface[LFACE_FOREGROUND_INDEX])->data); 6234 XSTRING (face->lface[LFACE_FOREGROUND_INDEX])->data);
@@ -6078,7 +6238,9 @@ dump_realized_face (face)
6078 fprintf (stderr, "font_name: %s (%s)\n", 6238 fprintf (stderr, "font_name: %s (%s)\n",
6079 face->font_name, 6239 face->font_name,
6080 XSTRING (face->lface[LFACE_FAMILY_INDEX])->data); 6240 XSTRING (face->lface[LFACE_FAMILY_INDEX])->data);
6241#ifdef HAVE_WINDOW_SYSTEM
6081 fprintf (stderr, "font = %p\n", face->font); 6242 fprintf (stderr, "font = %p\n", face->font);
6243#endif
6082 fprintf (stderr, "font_info_id = %d\n", face->font_info_id); 6244 fprintf (stderr, "font_info_id = %d\n", face->font_info_id);
6083 fprintf (stderr, "fontset: %d\n", face->fontset); 6245 fprintf (stderr, "fontset: %d\n", face->fontset);
6084 fprintf (stderr, "underline: %d (%s)\n", 6246 fprintf (stderr, "underline: %d (%s)\n",
@@ -6279,7 +6441,9 @@ syms_of_w32faces ()
6279 defsubr (&Sinternal_make_lisp_face); 6441 defsubr (&Sinternal_make_lisp_face);
6280 defsubr (&Sinternal_lisp_face_p); 6442 defsubr (&Sinternal_lisp_face_p);
6281 defsubr (&Sinternal_set_lisp_face_attribute); 6443 defsubr (&Sinternal_set_lisp_face_attribute);
6444#ifdef HAVE_WINDOW_SYSTEM
6282 defsubr (&Sinternal_set_lisp_face_attribute_from_resource); 6445 defsubr (&Sinternal_set_lisp_face_attribute_from_resource);
6446#endif
6283 defsubr (&Scolor_gray_p); 6447 defsubr (&Scolor_gray_p);
6284 defsubr (&Scolor_supported_p); 6448 defsubr (&Scolor_supported_p);
6285 defsubr (&Sinternal_get_lisp_face_attribute); 6449 defsubr (&Sinternal_get_lisp_face_attribute);
@@ -6337,9 +6501,11 @@ scaled if its name matches a regular expression in the list.");
6337 6501
6338#endif /* SCALABLE_FONTS */ 6502#endif /* SCALABLE_FONTS */
6339 6503
6504#ifdef HAVE_WINDOW_SYSTEM
6340 defsubr (&Sbitmap_spec_p); 6505 defsubr (&Sbitmap_spec_p);
6341 defsubr (&Sx_list_fonts); 6506 defsubr (&Sx_list_fonts);
6342 defsubr (&Sinternal_face_x_get_resource); 6507 defsubr (&Sinternal_face_x_get_resource);
6343 defsubr (&Sx_family_fonts); 6508 defsubr (&Sx_family_fonts);
6344 defsubr (&Sx_font_family_list); 6509 defsubr (&Sx_font_family_list);
6510#endif /* HAVE_WINDOW_SYSTEM */
6345} 6511}