comparison src/faces.c @ 771:943eaba38521

[xemacs-hg @ 2002-03-13 08:51:24 by ben] The big ben-mule-21-5 check-in! Various files were added and deleted. See CHANGES-ben-mule. There are still some test suite failures. No crashes, though. Many of the failures have to do with problems in the test suite itself rather than in the actual code. I'll be addressing these in the next day or so -- none of the test suite failures are at all critical. Meanwhile I'll be trying to address the biggest issues -- i.e. build or run failures, which will almost certainly happen on various platforms. All comments should be sent to ben@xemacs.org -- use a Cc: if necessary when sending to mailing lists. There will be pre- and post- tags, something like pre-ben-mule-21-5-merge-in, and post-ben-mule-21-5-merge-in.
author ben
date Wed, 13 Mar 2002 08:54:06 +0000
parents fdefd0186b75
children e38acbeb1cae
comparison
equal deleted inserted replaced
770:336a418893b5 771:943eaba38521
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 Ben Wing. 4 Copyright (C) 1995, 1996, 2001 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
556 face_property_matching_instance (Lisp_Object face, Lisp_Object property, 556 face_property_matching_instance (Lisp_Object face, Lisp_Object property,
557 Lisp_Object charset, Lisp_Object domain, 557 Lisp_Object charset, Lisp_Object domain,
558 Error_Behavior errb, int no_fallback, 558 Error_Behavior errb, int no_fallback,
559 Lisp_Object depth) 559 Lisp_Object depth)
560 { 560 {
561 Lisp_Object retval = 561 Lisp_Object retval;
562 specifier_instance_no_quit (Fget (face, property, Qnil), charset, 562
563 domain, errb, no_fallback, depth); 563 retval = specifier_instance_no_quit (Fget (face, property, Qnil), charset,
564 domain, errb, no_fallback, depth);
564 565
565 if (UNBOUNDP (retval) && !no_fallback) 566 if (UNBOUNDP (retval) && !no_fallback)
566 { 567 {
567 if (EQ (property, Qfont)) 568 if (EQ (property, Qfont))
568 { 569 {
1872 1873
1873 void 1874 void
1874 vars_of_faces (void) 1875 vars_of_faces (void)
1875 { 1876 {
1876 staticpro (&Vpermanent_faces_cache); 1877 staticpro (&Vpermanent_faces_cache);
1877 Vpermanent_faces_cache = Qnil; 1878 Vpermanent_faces_cache =
1879 make_lisp_hash_table (10, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ);
1878 staticpro (&Vtemporary_faces_cache); 1880 staticpro (&Vtemporary_faces_cache);
1879 Vtemporary_faces_cache = Qnil; 1881 Vtemporary_faces_cache =
1882 make_lisp_hash_table (0, HASH_TABLE_WEAK, HASH_TABLE_EQ);
1880 1883
1881 staticpro (&Vdefault_face); 1884 staticpro (&Vdefault_face);
1882 Vdefault_face = Qnil; 1885 Vdefault_face = Qnil;
1883 staticpro (&Vgui_element_face); 1886 staticpro (&Vgui_element_face);
1884 Vgui_element_face = Qnil; 1887 Vgui_element_face = Qnil;
1922 } 1925 }
1923 1926
1924 void 1927 void
1925 complex_vars_of_faces (void) 1928 complex_vars_of_faces (void)
1926 { 1929 {
1927 Vpermanent_faces_cache =
1928 make_lisp_hash_table (10, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ);
1929 Vtemporary_faces_cache =
1930 make_lisp_hash_table (0, HASH_TABLE_WEAK, HASH_TABLE_EQ);
1931
1932 /* Create the default face now so we know what it is immediately. */ 1930 /* Create the default face now so we know what it is immediately. */
1933 1931
1934 Vdefault_face = Qnil; /* so that Fmake_face() doesn't set up a bogus 1932 Vdefault_face = Qnil; /* so that Fmake_face() doesn't set up a bogus
1935 default value */ 1933 default value */
1936 Vdefault_face = Fmake_face (Qdefault, build_string ("default face"), 1934 Vdefault_face = Fmake_face (Qdefault, build_msg_string ("default face"),
1937 Qnil); 1935 Qnil);
1938 1936
1939 /* Provide some last-resort fallbacks to avoid utter fuckage if 1937 /* Provide some last-resort fallbacks to avoid utter fuckage if
1940 someone provides invalid values for the global specifications. */ 1938 someone provides invalid values for the global specifications. */
1941 1939
1979 1977
1980 /* The same gory list from x-faces.el. 1978 /* The same gory list from x-faces.el.
1981 (#### Perhaps we should remove the stuff from x-faces.el 1979 (#### Perhaps we should remove the stuff from x-faces.el
1982 and only depend on this stuff here? That should work.) 1980 and only depend on this stuff here? That should work.)
1983 */ 1981 */
1984 const char *fonts[] = 1982 const Char_ASCII *fonts[] =
1985 { 1983 {
1986 "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-*", 1984 "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-*",
1987 "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-*", 1985 "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-*",
1988 "-*-courier-*-r-*-*-*-120-*-*-*-*-iso8859-*", 1986 "-*-courier-*-r-*-*-*-120-*-*-*-*-iso8859-*",
1989 "-*-*-medium-r-*-*-*-120-*-*-m-*-iso8859-*", 1987 "-*-*-medium-r-*-*-*-120-*-*-m-*-iso8859-*",
1997 "-*-*-*-r-*-*-*-120-*-*-c-*-*-*", 1995 "-*-*-*-r-*-*-*-120-*-*-c-*-*-*",
1998 "-*-*-*-r-*-*-*-120-*-*-*-*-*-*", 1996 "-*-*-*-r-*-*-*-120-*-*-*-*-*-*",
1999 "-*-*-*-*-*-*-*-120-*-*-*-*-*-*", 1997 "-*-*-*-*-*-*-*-120-*-*-*-*-*-*",
2000 "*" 1998 "*"
2001 }; 1999 };
2002 const char **fontptr; 2000 const Char_ASCII **fontptr;
2003 2001
2004 #ifdef HAVE_X_WINDOWS 2002 #ifdef HAVE_X_WINDOWS
2005 for (fontptr = fonts + countof(fonts) - 1; fontptr >= fonts; fontptr--) 2003 for (fontptr = fonts + countof(fonts) - 1; fontptr >= fonts; fontptr--)
2006 inst_list = Fcons (Fcons (list1 (Qx), build_string (*fontptr)), 2004 inst_list = Fcons (Fcons (list1 (Qx), build_string (*fontptr)),
2007 inst_list); 2005 inst_list);
2012 inst_list = Fcons (Fcons (list1 (Qgtk), build_string (*fontptr)), 2010 inst_list = Fcons (Fcons (list1 (Qgtk), build_string (*fontptr)),
2013 inst_list); 2011 inst_list);
2014 #endif /* HAVE_GTK */ 2012 #endif /* HAVE_GTK */
2015 #endif /* HAVE_X_WINDOWS || HAVE_GTK */ 2013 #endif /* HAVE_X_WINDOWS || HAVE_GTK */
2016 2014
2017
2018 #ifdef HAVE_TTY 2015 #ifdef HAVE_TTY
2019 inst_list = Fcons (Fcons (list1 (Qtty), build_string ("normal")), 2016 inst_list = Fcons (Fcons (list1 (Qtty), build_string ("normal")),
2020 inst_list); 2017 inst_list);
2021 #endif /* HAVE_TTY */ 2018 #endif /* HAVE_TTY */
2019
2022 #ifdef HAVE_MS_WINDOWS 2020 #ifdef HAVE_MS_WINDOWS
2023 /* Fixedsys does not exist for printers */ 2021 {
2024 inst_list = Fcons (Fcons (list1 (Qmsprinter), 2022 const Char_ASCII *mswfonts[] =
2025 build_string ("Courier:Regular:10::Western")), inst_list); 2023 {
2026 inst_list = Fcons (Fcons (list1 (Qmsprinter), 2024 "Courier New:Regular:10::Western",
2027 build_string ("Courier New:Regular:10::Western")), inst_list); 2025 "Courier:Regular:10::Western",
2028 2026 "Courier New:Regular:10::",
2029 inst_list = Fcons (Fcons (list1 (Qmswindows), 2027 "Courier:Regular:10::",
2030 build_string ("Fixedsys:Regular:9::Western")), inst_list); 2028 ":Regular:10::"
2031 inst_list = Fcons (Fcons (list1 (Qmswindows), 2029 };
2032 build_string ("Courier:Regular:10::Western")), inst_list); 2030 const Char_ASCII **mswfontptr;
2033 inst_list = Fcons (Fcons (list1 (Qmswindows), 2031
2034 build_string ("Courier New:Regular:10::Western")), inst_list); 2032 for (mswfontptr = mswfonts + countof (mswfonts) - 1;
2033 mswfontptr >= mswfonts; mswfontptr--)
2034 {
2035 /* display device */
2036 inst_list = Fcons (Fcons (list1 (Qmswindows),
2037 build_string (*mswfontptr)),
2038 inst_list);
2039 /* printer device */
2040 inst_list = Fcons (Fcons (list1 (Qmsprinter),
2041 build_string (*mswfontptr)),
2042 inst_list);
2043 }
2044 }
2035 #endif /* HAVE_MS_WINDOWS */ 2045 #endif /* HAVE_MS_WINDOWS */
2046
2036 set_specifier_fallback (Fget (Vdefault_face, Qfont, Qnil), inst_list); 2047 set_specifier_fallback (Fget (Vdefault_face, Qfont, Qnil), inst_list);
2037 } 2048 }
2038 2049
2039 set_specifier_fallback (Fget (Vdefault_face, Qunderline, Qnil), 2050 set_specifier_fallback (Fget (Vdefault_face, Qunderline, Qnil),
2040 list1 (Fcons (Qnil, Qnil))); 2051 list1 (Fcons (Qnil, Qnil)));
2050 list1 (Fcons (Qnil, Qnil))); 2061 list1 (Fcons (Qnil, Qnil)));
2051 2062
2052 /* gui-element is the parent face of all gui elements such as 2063 /* gui-element is the parent face of all gui elements such as
2053 modeline, vertical divider and toolbar. */ 2064 modeline, vertical divider and toolbar. */
2054 Vgui_element_face = Fmake_face (Qgui_element, 2065 Vgui_element_face = Fmake_face (Qgui_element,
2055 build_string ("gui element face"), 2066 build_msg_string ("gui element face"),
2056 Qnil); 2067 Qnil);
2057 2068
2058 /* Provide some last-resort fallbacks for gui-element face which 2069 /* Provide some last-resort fallbacks for gui-element face which
2059 mustn't default to default. */ 2070 mustn't default to default. */
2060 { 2071 {
2088 /* Now create the other faces that redisplay needs to refer to 2099 /* Now create the other faces that redisplay needs to refer to
2089 directly. We could create them in Lisp but it's simpler this 2100 directly. We could create them in Lisp but it's simpler this
2090 way since we need to get them anyway. */ 2101 way since we need to get them anyway. */
2091 2102
2092 /* modeline is gui element. */ 2103 /* modeline is gui element. */
2093 Vmodeline_face = Fmake_face (Qmodeline, build_string ("modeline face"), 2104 Vmodeline_face = Fmake_face (Qmodeline, build_msg_string ("modeline face"),
2094 Qnil); 2105 Qnil);
2095 2106
2096 set_specifier_fallback (Fget (Vmodeline_face, Qforeground, Qunbound), 2107 set_specifier_fallback (Fget (Vmodeline_face, Qforeground, Qunbound),
2097 Fget (Vgui_element_face, Qforeground, Qunbound)); 2108 Fget (Vgui_element_face, Qforeground, Qunbound));
2098 set_specifier_fallback (Fget (Vmodeline_face, Qbackground, Qunbound), 2109 set_specifier_fallback (Fget (Vmodeline_face, Qbackground, Qunbound),
2101 Fget (Vgui_element_face, Qbackground_pixmap, 2112 Fget (Vgui_element_face, Qbackground_pixmap,
2102 Qunbound)); 2113 Qunbound));
2103 2114
2104 /* toolbar is another gui element */ 2115 /* toolbar is another gui element */
2105 Vtoolbar_face = Fmake_face (Qtoolbar, 2116 Vtoolbar_face = Fmake_face (Qtoolbar,
2106 build_string ("toolbar face"), 2117 build_msg_string ("toolbar face"),
2107 Qnil); 2118 Qnil);
2108 set_specifier_fallback (Fget (Vtoolbar_face, Qforeground, Qunbound), 2119 set_specifier_fallback (Fget (Vtoolbar_face, Qforeground, Qunbound),
2109 Fget (Vgui_element_face, Qforeground, Qunbound)); 2120 Fget (Vgui_element_face, Qforeground, Qunbound));
2110 set_specifier_fallback (Fget (Vtoolbar_face, Qbackground, Qunbound), 2121 set_specifier_fallback (Fget (Vtoolbar_face, Qbackground, Qunbound),
2111 Fget (Vgui_element_face, Qbackground, Qunbound)); 2122 Fget (Vgui_element_face, Qbackground, Qunbound));
2113 Fget (Vgui_element_face, Qbackground_pixmap, 2124 Fget (Vgui_element_face, Qbackground_pixmap,
2114 Qunbound)); 2125 Qunbound));
2115 2126
2116 /* vertical divider is another gui element */ 2127 /* vertical divider is another gui element */
2117 Vvertical_divider_face = Fmake_face (Qvertical_divider, 2128 Vvertical_divider_face = Fmake_face (Qvertical_divider,
2118 build_string ("vertical divider face"), 2129 build_msg_string ("vertical divider face"),
2119 Qnil); 2130 Qnil);
2120 2131
2121 set_specifier_fallback (Fget (Vvertical_divider_face, Qforeground, Qunbound), 2132 set_specifier_fallback (Fget (Vvertical_divider_face, Qforeground, Qunbound),
2122 Fget (Vgui_element_face, Qforeground, Qunbound)); 2133 Fget (Vgui_element_face, Qforeground, Qunbound));
2123 set_specifier_fallback (Fget (Vvertical_divider_face, Qbackground, Qunbound), 2134 set_specifier_fallback (Fget (Vvertical_divider_face, Qbackground, Qunbound),
2127 Fget (Vgui_element_face, Qbackground_pixmap, 2138 Fget (Vgui_element_face, Qbackground_pixmap,
2128 Qunbound)); 2139 Qunbound));
2129 2140
2130 /* widget is another gui element */ 2141 /* widget is another gui element */
2131 Vwidget_face = Fmake_face (Qwidget, 2142 Vwidget_face = Fmake_face (Qwidget,
2132 build_string ("widget face"), 2143 build_msg_string ("widget face"),
2133 Qnil); 2144 Qnil);
2134 set_specifier_fallback (Fget (Vwidget_face, Qfont, Qunbound), 2145 set_specifier_fallback (Fget (Vwidget_face, Qfont, Qunbound),
2135 Fget (Vgui_element_face, Qfont, Qunbound)); 2146 Fget (Vgui_element_face, Qfont, Qunbound));
2136 set_specifier_fallback (Fget (Vwidget_face, Qforeground, Qunbound), 2147 set_specifier_fallback (Fget (Vwidget_face, Qforeground, Qunbound),
2137 Fget (Vgui_element_face, Qforeground, Qunbound)); 2148 Fget (Vgui_element_face, Qforeground, Qunbound));
2138 set_specifier_fallback (Fget (Vwidget_face, Qbackground, Qunbound), 2149 set_specifier_fallback (Fget (Vwidget_face, Qbackground, Qunbound),
2139 Fget (Vgui_element_face, Qbackground, Qunbound)); 2150 Fget (Vgui_element_face, Qbackground, Qunbound));
2140 /* We don't want widgets to have a default background pixmap. */ 2151 /* We don't want widgets to have a default background pixmap. */
2141 2152
2142 Vleft_margin_face = Fmake_face (Qleft_margin, 2153 Vleft_margin_face = Fmake_face (Qleft_margin,
2143 build_string ("left margin face"), 2154 build_msg_string ("left margin face"),
2144 Qnil); 2155 Qnil);
2145 Vright_margin_face = Fmake_face (Qright_margin, 2156 Vright_margin_face = Fmake_face (Qright_margin,
2146 build_string ("right margin face"), 2157 build_msg_string ("right margin face"),
2147 Qnil); 2158 Qnil);
2148 Vtext_cursor_face = Fmake_face (Qtext_cursor, 2159 Vtext_cursor_face = Fmake_face (Qtext_cursor,
2149 build_string ("face for text cursor"), 2160 build_msg_string ("face for text cursor"),
2150 Qnil); 2161 Qnil);
2151 Vpointer_face = 2162 Vpointer_face =
2152 Fmake_face (Qpointer, 2163 Fmake_face (Qpointer,
2153 build_string 2164 build_msg_string
2154 ("face for foreground/background colors of mouse pointer"), 2165 ("face for foreground/background colors of mouse pointer"),
2155 Qnil); 2166 Qnil);
2156 } 2167 }