comparison src/faces.c @ 872:79c6ff3eef26

[xemacs-hg @ 2002-06-20 21:18:01 by ben] font changes etc.; some 21.4 changes mule/mule-msw-init-late.el: Specify charset->windows-registry conversion. mule/mule-x-init.el: Delete extra mule font additions here. Put them in faces.c. cl-macs.el: Document better. font-lock.el: Move Lisp function regexp to lisp-mode.el. lisp-mode.el: Various indentation fixes: Handle flet functions better. Handle argument lists in defuns and flets. Handle quoted lists, e.g. property lists -- don't indent like function calls. Distinguish between lambdas and other lists. lisp-mode.el: Handle this form. faces.el, font-menu.el, font.el, gtk-faces.el, msw-faces.el, msw-font-menu.el, x-faces.el, x-init.el: Major overhaul of face-handling code: -- Fix lots of bogus code in msw-faces.el, msw-font-menu.el, font-menu.el that was "truenaming" font specs -- i.e. in the process of frobbing a particular field in a general user-specified font spec with wildcarded fields, sticking in particular values for all the remaining wildcarded fields. This bug was rampant everywhere except in x-faces.el (the oldest and only correctly written code). This also means that we need to work with font names at all times and not font instances, because a font instance is essentially a truenamed font. -- Total rewrite of extremely junky code in msw-faces.el. Work with names as well as font instances, and return names; stop truenaming when canonicalizing and frobbing; fix handling of the combined style field, i.e. weight/slant (also fixed in font.el). -- Totally rewrite the frobbing functions in faces.el. This time, we frob all the instantiators rather than just computing a single instance value and working backwards. That way, e.g., `bold' will work for all charsets that have bold available, rather than only for whatever charset was part of the computed font instance (another example of the truename virus). Also fix up code to look at the fallbacks (all of them) when no global value present, so we don't need to put something in the global value. Intelligently handle a request to frob a buffer locale, rather than signalling an error. When frobbing instantiators, try hard to figure out what device type is associated with them, and frob each according to its own proper device type. Correctly handle inheritance vectors given as instantiators. Preserve existing tags when putting back frobbed instantiators. Extract out general specifier-frobbing code into specifier.el. Document everything cleanly. Do lots of other things better, etc. -- Don't duplicatively set a global specification for the default font -- it's already in the fallback and we no longer need a default global specification present. Delete various code in x-faces.el and msw-faces.el that duplicated the lists of fonts in faces.c. -- init-global-faces was not being called at all under MS Windows! Major bogosity. That caused device-specific values to get stuck into all the fonts, making it very hard to change them -- setting global specs caused nothing to happen. -- Correct weight names in font.el. -- Lots more font fixups in objects*.c. Printer.el: Warning fix. specifier.el: Add more args to map-specifier. Add various "heuristic" specifier functions to aid in creation of specifier-munging code such as in faces.el. subr.el: New functions. lwlib.c: Fix warning. config.inc.samp: Clean up, add args to control fastcall (not yet supported! the changes needed are in another ws of mine), profile support, vc6 support, union-type. xemacs.dsp, xemacs.mak: Semi-major overhaul. Fix bug where dump-id was always getting recomputed, forcing a redump even when nothing changed. Add support for fastcall. Support edit-and-continue (on by default) with vc6. Use incremental linking when doing a debug compilation. Add support for profiling. Consolidate the various debug flags. Partial support for "batch-compiling" -- compiling many files on a single invocation of the compiler. Doesn't seem to help that much for me, so it's not finished or enabled by default. Remove HAVE_MSW_C_DIRED, we always do. Correct some sloppy use of directories. s/cygwin32.h: Allow pdump to work under Cygwin (mmap is broken, so need to undefine HAVE_MMAP). s/win32-common.h, s/windowsnt.h: Support for fastcall. Add WIN32_ANY for identifying all Win32 variants (Cygwin, native, MinGW). Both of these are properly used in another ws. alloc.c, balloon-x.c, buffer.c, bytecode.c, callint.c, cm.c, cmdloop.c, cmds.c, console-gtk.c, console-gtk.h, console-msw.c, console-msw.h, console-stream.c, console-stream.h, console-tty.c, console-tty.h, console-x.c, console-x.h, console.c, console.h, device-gtk.c, device-msw.c, device-tty.c, device-x.c, device.c, device.h, devslots.h, dialog-gtk.c, dialog-msw.c, dialog-x.c, dialog.c, dired-msw.c, editfns.c, emacs.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, event-tty.c, event-unixoid.c, events.c, extents.c, extents.h, faces.c, fileio.c, fns.c, frame-gtk.c, frame-msw.c, frame-tty.c, frame-x.c, frame.c, frame.h, glyphs-eimage.c, glyphs-gtk.c, glyphs-msw.c, glyphs-widget.c, glyphs-x.c, glyphs.c, glyphs.h, gui-gtk.c, gui-msw.c, gui-x.c, gui.c, gutter.c, input-method-xlib.c, intl-encap-win32.c, intl-win32.c, keymap.c, lisp.h, macros.c, menubar-gtk.c, menubar-msw.c, menubar-x.c, menubar.c, menubar.h, minibuf.c, mule-charset.c, nt.c, objects-gtk.c, objects-gtk.h, objects-msw.c, objects-msw.h, objects-tty.c, objects-tty.h, objects-x.c, objects-x.h, objects.c, objects.h, postgresql.c, print.c, process.h, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-tty.c, redisplay-x.c, redisplay.c, redisplay.h, scrollbar-gtk.c, scrollbar-msw.c, scrollbar-x.c, scrollbar.c, select-gtk.c, select-msw.c, select-x.c, select.c, signal.c, sound.c, specifier.c, symbols.c, syntax.c, sysdep.c, syssignal.h, syswindows.h, toolbar-common.c, toolbar-gtk.c, toolbar-msw.c, toolbar-x.c, toolbar.c, unicode.c, window.c, window.h: The following are the major changes made: (1) Separation of various header files into an external and an internal version, similar to the existing separation of process.h and procimpl.h. Eventually this should be done for all Lisp objects. The external version has the same name as currently; the internal adds -impl. The external file has XFOO() macros for objects, but the structure is opaque and defined only in the internal file. It's now reasonable to move all prototypes in lisp.h into the appropriate external file, and this should be done. Currently, separation has been done on extents.h, objects*.h, console.h, device.h, frame.h, and window.h. For c/d/f/w, the most basic properties are available in the external header file, with the macros resolving to functions. In the internal header file, the macros are redefined to directly access the structure. Also, the global MARK_FOO_CHANGED macros have been made into functions so that they can be accessed without needing to include lots of -impl headers -- they are used in almost exclusively in non-time-critical functions, and take up enough time that the function overhead will be negligible. Similarly, the function overhead from making the basic properties mentioned above into functions is negligible, and code that does heavy accessing of c/d/f/w structures inevitably ends up needing the internal header files, anyway. (2) More face changes. -- Major rewrite of objects-msw.c. Now handles wildcard specs properly, rather than "truenaming" (or even worse, signalling an error, which previously happened with some of the fallbacks if you tried to use them in make-font-instance!). -- Split charset matching of fonts into two stages -- one to find a font specifically designed for a particular charset (by examining its registry), the second to find a Unicode font that can support the charset. This needs to proceed as two complete, separate instantiations in order to work properly (otherwise many of the fonts in the HELLO page look wrong). This should also make it easy to support iso10646 (Unicode) fonts under X. -- All default values for fonts are now completely specified in the fallbacks. Stuff from mule-x-init.el has all been moved here, merged with the existing specs, and totally rethought so you get sensible results. (HELLO now looks much better!). -- Generalize the "default X/GTK device" stuff into a per-device-type "default device". -- Add mswindows-{set-}charset-registry. In time, charset<->code-page conversion functions will be removed. -- Wrap protective code around calls to compute device specifier tags, and do this computation before calling the face initialization code because the latter may need these tags to be correctly updated. (3) Other changes. EmacsFrame.c, glyphs-msw.c, eval.c, gui-x.c, intl-encap-win32.c, search.c, signal.c, toolbar-msw.c, unicode.c: Warning fixes. config.h.in: #undefs meant to be frobbed by configure *MUST* go inside of #ifndef WIN32_NO_CONFIGURE, and everything else *MUST* go outside! eval.c: Let detailed backtraces be detailed. specifier.c: Don't override user's print-string-length/print-length settings. glyphs.c: New function image-instance-instantiator. config.h.in, sysdep.c: Changes for fastcall. sysdep.c, nt.c: Fix up a previous botched patch that tried to add support for both EEXIST and EACCES. IF THE BOTCHED PATCH WENT INTO 21.4, THIS FIXUP NEEDS TO GO IN, TOO. search.c: Fix *evil* crash due to incorrect synching of syntax-cache code with 21.1. THIS SHOULD GO INTO 21.4.
author ben
date Thu, 20 Jun 2002 21:19:10 +0000
parents 6728e641994e
children d4ba25667ff4
comparison
equal deleted inserted replaced
871:732270854293 872:79c6ff3eef26
28 28
29 #include <config.h> 29 #include <config.h>
30 #include "lisp.h" 30 #include "lisp.h"
31 31
32 #include "buffer.h" 32 #include "buffer.h"
33 #include "device.h" 33 #include "device-impl.h"
34 #include "elhash.h" 34 #include "elhash.h"
35 #include "extents.h" 35 #include "extents-impl.h" /* for extent_face */
36 #include "faces.h" 36 #include "faces.h"
37 #include "frame.h" 37 #include "frame-impl.h"
38 #include "glyphs.h" 38 #include "glyphs.h"
39 #include "objects.h" 39 #include "objects-impl.h"
40 #include "specifier.h" 40 #include "specifier.h"
41 #include "window.h" 41 #include "window.h"
42 42
43 Lisp_Object Qfacep; 43 Lisp_Object Qfacep;
44 Lisp_Object Qforeground, Qbackground, Qdisplay_table; 44 Lisp_Object Qforeground, Qbackground, Qdisplay_table;
551 Lisp_Object charset, Lisp_Object domain, 551 Lisp_Object charset, Lisp_Object domain,
552 Error_Behavior errb, int no_fallback, 552 Error_Behavior errb, int no_fallback,
553 Lisp_Object depth) 553 Lisp_Object depth)
554 { 554 {
555 Lisp_Object retval; 555 Lisp_Object retval;
556 556 Lisp_Object matchspec = Qunbound;
557 retval = specifier_instance_no_quit (Fget (face, property, Qnil), charset, 557 struct gcpro gcpro1;
558
559 if (!NILP (charset))
560 matchspec = noseeum_cons (charset, Qnil);
561 GCPRO1 (matchspec);
562 retval = specifier_instance_no_quit (Fget (face, property, Qnil), matchspec,
558 domain, errb, no_fallback, depth); 563 domain, errb, no_fallback, depth);
564 if (UNBOUNDP (retval))
565 {
566 Fsetcdr (matchspec, Qt);
567 retval = specifier_instance_no_quit (Fget (face, property, Qnil),
568 matchspec, domain, errb,
569 no_fallback, depth);
570 }
571 UNGCPRO;
572 if (CONSP (matchspec))
573 free_cons (matchspec);
559 574
560 if (UNBOUNDP (retval) && !no_fallback) 575 if (UNBOUNDP (retval) && !no_fallback)
561 { 576 {
562 if (EQ (property, Qfont)) 577 if (EQ (property, Qfont))
563 { 578 {
864 init_global_faces (struct device *d) 879 init_global_faces (struct device *d)
865 { 880 {
866 /* When making the initial terminal device, there is no Lisp code 881 /* When making the initial terminal device, there is no Lisp code
867 loaded, so we can't do this. */ 882 loaded, so we can't do this. */
868 if (initialized && !noninteractive) 883 if (initialized && !noninteractive)
869 { 884 call_critical_lisp_code (d, Qinit_global_faces, wrap_device (d));
870 call_critical_lisp_code (d, Qinit_global_faces, Qnil);
871 }
872 } 885 }
873 886
874 void 887 void
875 init_device_faces (struct device *d) 888 init_device_faces (struct device *d)
876 { 889 {
877 /* This function can call lisp */ 890 /* This function can call lisp */
878 891
879 /* When making the initial terminal device, there is no Lisp code 892 /* When making the initial terminal device, there is no Lisp code
880 loaded, so we can't do this. */ 893 loaded, so we can't do this. */
881 if (initialized) 894 if (initialized)
882 { 895 call_critical_lisp_code (d, Qinit_device_faces, wrap_device (d));
883 Lisp_Object tdevice = wrap_device (d);
884
885 call_critical_lisp_code (d, Qinit_device_faces, tdevice);
886 }
887 } 896 }
888 897
889 void 898 void
890 init_frame_faces (struct frame *frm) 899 init_frame_faces (struct frame *frm)
891 { 900 {
986 elements referring to a particular face and that do not 995 elements referring to a particular face and that do not
987 have an iteration number equal to the current one. We 996 have an iteration number equal to the current one. We
988 keep them in a chain, and use them to allocate new 997 keep them in a chain, and use them to allocate new
989 elements when possible instead of increasing the Dynarr. 998 elements when possible instead of increasing the Dynarr.
990 999
1000 --ben (?? At least I think I wrote this!)
991 */ 1001 */
992 1002
993 /* mark for GC a dynarr of face cachels. */ 1003 /* mark for GC a dynarr of face cachels. */
994 1004
995 void 1005 void
1957 /* #### We may want to have different fallback values if NeXTstep 1967 /* #### We may want to have different fallback values if NeXTstep
1958 support is compiled in. */ 1968 support is compiled in. */
1959 { 1969 {
1960 Lisp_Object inst_list = Qnil; 1970 Lisp_Object inst_list = Qnil;
1961 1971
1962 #if defined(HAVE_X_WINDOWS) || defined(HAVE_GTK) 1972 #if defined (HAVE_X_WINDOWS) || defined (HAVE_GTK)
1963 /* This is kind of ugly because stephen wanted this to be CPP
1964 ** identical to the old version, at least for the initial
1965 ** checkin
1966 **
1967 ** WMP March 9, 2001
1968 */
1969 1973
1970 /* The same gory list from x-faces.el.
1971 (#### Perhaps we should remove the stuff from x-faces.el
1972 and only depend on this stuff here? That should work.)
1973 */
1974 const Char_ASCII *fonts[] = 1974 const Char_ASCII *fonts[] =
1975 { 1975 {
1976 /************** ISO-8859 fonts *************/
1977
1976 "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-*", 1978 "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-*",
1977 "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-*", 1979 "-*-fixed-medium-r-*-*-*-120-*-*-*-*-iso8859-*"
1978 "-*-courier-*-r-*-*-*-120-*-*-*-*-iso8859-*", 1980 "-*-courier-*-r-*-*-*-120-*-*-*-*-iso8859-*",
1981 "-*-fixed-*-r-*-*-*-120-*-*-*-*-iso8859-*"
1982 /* Next try for any "medium" charcell or monospaced iso8859 font. */
1979 "-*-*-medium-r-*-*-*-120-*-*-m-*-iso8859-*", 1983 "-*-*-medium-r-*-*-*-120-*-*-m-*-iso8859-*",
1980 "-*-*-medium-r-*-*-*-120-*-*-c-*-iso8859-*", 1984 "-*-*-medium-r-*-*-*-120-*-*-c-*-iso8859-*",
1985 /* Next try for any charcell or monospaced iso8859 font. */
1981 "-*-*-*-r-*-*-*-120-*-*-m-*-iso8859-*", 1986 "-*-*-*-r-*-*-*-120-*-*-m-*-iso8859-*",
1982 "-*-*-*-r-*-*-*-120-*-*-c-*-iso8859-*", 1987 "-*-*-*-r-*-*-*-120-*-*-c-*-iso8859-*",
1988
1989 /* Repeat, any size */
1990 "-*-courier-medium-r-*-*-*-*-*-*-*-*-iso8859-*",
1991 "-*-fixed-medium-r-*-*-*-*-*-*-*-*-iso8859-*"
1992 "-*-courier-*-r-*-*-*-*-*-*-*-*-iso8859-*",
1993 "-*-fixed-*-r-*-*-*-*-*-*-*-*-iso8859-*"
1994 /* Next try for any "medium" charcell or monospaced iso8859 font. */
1995 "-*-*-medium-r-*-*-*-*-*-*-m-*-iso8859-*",
1996 "-*-*-medium-r-*-*-*-*-*-*-c-*-iso8859-*",
1997 /* Next try for any charcell or monospaced iso8859 font. */
1998 "-*-*-*-r-*-*-*-*-*-*-m-*-iso8859-*",
1999 "-*-*-*-r-*-*-*-*-*-*-c-*-iso8859-*",
2000
2001 /* Non-proportional fonts -- last resort. */
1983 "-*-*-*-r-*-*-*-120-*-*-*-*-iso8859-*", 2002 "-*-*-*-r-*-*-*-120-*-*-*-*-iso8859-*",
2003 "-*-*-*-r-*-*-*-*-*-*-*-*-iso8859-*",
2004 "-*-*-*-*-*-*-*-*-*-*-*-*-iso8859-*",
2005
2006 /************* Japanese fonts ************/
2007
2008 /* Following 3 fonts proposed by Teruhiko.Kurosaka@Japan.eng.sun */
2009 "-sun-gothic-medium-r-normal--14-120-75-75-c-60-jisx0201.1976-0",
2010 "-sun-gothic-medium-r-normal--14-120-75-75-c-120-jisx0208.1983-0",
2011 "-wadalab-gothic-medium-r-normal--14-120-75-75-c-120-jisx0212.1990-0",
2012
2013 /* Other Japanese fonts */
2014 "-*-fixed-medium-r-*--*-jisx0201.1976-*",
2015 "-*-fixed-medium-r-*--*-jisx0208.1983-*",
2016 "-*-fixed-medium-r-*--*-jisx0212*-*",
2017 "-*-*-*-r-*--*-jisx0201.1976-*",
2018 "-*-*-*-r-*--*-jisx0208.1983-*",
2019 "-*-*-*-r-*--*-jisx0212*-*",
2020
2021 /************* Chinese fonts ************/
2022
2023 "-*-*-medium-r-*--*-gb2312.1980-*",
2024 "-*-fixed-medium-r-*--*-cns11643*-*",
2025
2026 "-*-fixed-medium-r-*--*-big5*-*,"
2027 "-*-fixed-medium-r-*--*-sisheng_cwnn-0",
2028
2029 /************* Korean fonts *************/
2030
2031 "-*-mincho-medium-r-*--*-ksc5601.1987-*",
2032
2033 /************* Thai fonts **************/
2034
2035 "-*-fixed-medium-r-*--*-tis620.2529-1",
2036
2037 /************* Other fonts (nonstandard) *************/
2038
2039 "-*-fixed-medium-r-*--*-viscii1.1-1",
2040 "-*-fixed-medium-r-*--*-mulearabic-*",
2041 "-*-fixed-medium-r-*--*-muleipa-*",
2042 "-*-fixed-medium-r-*--*-ethio-*",
2043
2044 /************* Unicode fonts **************/
2045
2046 /* #### We don't yet support Unicode fonts, but doing so would not be
2047 hard because all the machinery has already been added for Windows
2048 support. We need to do this:
2049
2050 (1) Add "stage 2" support in find_charset_font()/etc.; this finds
2051 an appropriate Unicode font after all the charset-specific fonts
2052 have been checked. This should look at the per-char font info and
2053 check whether we have support for some of the chars in the
2054 charset. (#### Bogus, but that's the way it currently works)
2055
2056 (2) Record in the font instance a flag indicating when we're
2057 dealing with a Unicode font.
2058
2059 (3) Notice this flag in separate_textual_runs() and translate the
2060 text into Unicode if so.
2061 */
2062
2063 "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso10646-1",
2064 "-*-fixed-medium-r-*-*-*-120-*-*-*-*-iso10646-1"
2065 "-*-courier-*-r-*-*-*-120-*-*-*-*-iso10646-1",
2066 "-*-fixed-*-r-*-*-*-120-*-*-*-*-iso10646-1"
2067 /* Next try for any "medium" charcell or monospaced iso8859 font. */
2068 "-*-*-medium-r-*-*-*-120-*-*-m-*-iso10646-1",
2069 "-*-*-medium-r-*-*-*-120-*-*-c-*-iso10646-1",
2070 /* Next try for any charcell or monospaced iso8859 font. */
2071 "-*-*-*-r-*-*-*-120-*-*-m-*-iso10646-1",
2072 "-*-*-*-r-*-*-*-120-*-*-c-*-iso10646-1",
2073
2074 /* Repeat, any size */
2075 "-*-courier-medium-r-*-*-*-*-*-*-*-*-iso10646-1",
2076 "-*-fixed-medium-r-*-*-*-*-*-*-*-*-iso10646-1"
2077 "-*-courier-*-r-*-*-*-*-*-*-*-*-iso10646-1",
2078 "-*-fixed-*-r-*-*-*-*-*-*-*-*-iso10646-1"
2079 /* Next try for any "medium" charcell or monospaced iso8859 font. */
2080 "-*-*-medium-r-*-*-*-*-*-*-m-*-iso10646-1",
2081 "-*-*-medium-r-*-*-*-*-*-*-c-*-iso10646-1",
2082 /* Next try for any charcell or monospaced iso8859 font. */
2083 "-*-*-*-r-*-*-*-*-*-*-m-*-iso10646-1",
2084 "-*-*-*-r-*-*-*-*-*-*-c-*-iso10646-1",
2085
2086 /* Non-proportional fonts -- last resort. */
2087 "-*-*-*-r-*-*-*-120-*-*-*-*-iso10646-1",
2088 "-*-*-*-r-*-*-*-*-*-*-*-*-iso10646-1",
2089 "-*-*-*-*-*-*-*-*-*-*-*-*-iso10646-1",
2090
2091 /*********** Last resort ***********/
2092
2093 /* Boy, we sure are losing now. Try the above, but in any encoding. */
1984 "-*-*-medium-r-*-*-*-120-*-*-m-*-*-*", 2094 "-*-*-medium-r-*-*-*-120-*-*-m-*-*-*",
1985 "-*-*-medium-r-*-*-*-120-*-*-c-*-*-*", 2095 "-*-*-medium-r-*-*-*-120-*-*-c-*-*-*",
1986 "-*-*-*-r-*-*-*-120-*-*-m-*-*-*", 2096 "-*-*-*-r-*-*-*-120-*-*-m-*-*-*",
1987 "-*-*-*-r-*-*-*-120-*-*-c-*-*-*", 2097 "-*-*-*-r-*-*-*-120-*-*-c-*-*-*",
2098 /* Hello? Please? */
1988 "-*-*-*-r-*-*-*-120-*-*-*-*-*-*", 2099 "-*-*-*-r-*-*-*-120-*-*-*-*-*-*",
1989 "-*-*-*-*-*-*-*-120-*-*-*-*-*-*", 2100 "-*-*-*-*-*-*-*-120-*-*-*-*-*-*",
2101 "-*-*-*-*-*-*-*-*-*-*-*-*-*-*",
1990 "*" 2102 "*"
1991 }; 2103 };
1992 const Char_ASCII **fontptr; 2104 const Char_ASCII **fontptr;
1993 2105
1994 #ifdef HAVE_X_WINDOWS 2106 #ifdef HAVE_X_WINDOWS
2011 2123
2012 #ifdef HAVE_MS_WINDOWS 2124 #ifdef HAVE_MS_WINDOWS
2013 { 2125 {
2014 const Char_ASCII *mswfonts[] = 2126 const Char_ASCII *mswfonts[] =
2015 { 2127 {
2016 "Courier New:Regular:10::Western",
2017 "Courier:Regular:10::Western",
2018 "Courier New:Regular:10::", 2128 "Courier New:Regular:10::",
2019 "Courier:Regular:10::", 2129 "Courier:Regular:10::",
2020 ":Regular:10::" 2130 ":Regular:10::"
2021 }; 2131 };
2022 const Char_ASCII **mswfontptr; 2132 const Char_ASCII **mswfontptr;