annotate lisp/faces.el @ 3555:db783273b399

[xemacs-hg @ 2006-08-11 01:30:22 by vins] Move definition of string-to-char-list to obsolete.el.
author vins
date Fri, 11 Aug 2006 01:30:23 +0000
parents 316fddbf58e2
children 98af8a976fc3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 ;;; faces.el --- Lisp interface to the C "face" structure
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 ;; Copyright (C) 1992-4, 1997 Free Software Foundation, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 ;; Copyright (C) 1995 Board of Trustees, University of Illinois
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
5 ;; Copyright (C) 1995, 1996, 2002, 2005 Ben Wing
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 ;; Author: Ben Wing <ben@xemacs.org>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 ;; Keywords: faces, internal, dumped
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 ;; This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 ;; XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 ;; under the terms of the GNU General Public License as published by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 ;; any later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 ;; XEmacs is distributed in the hope that it will be useful, but
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 ;; General Public License for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 ;; along with XEmacs; see the file COPYING. If not, write to the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 ;; Boston, MA 02111-1307, USA.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 ;;; Synched up with: Not synched with FSF. Almost completely divergent.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 ;;; Commentary:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 ;; This file is dumped with XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 ;; face implementation #1 (used Lisp vectors and parallel C vectors;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 ;; FSFmacs still uses this) authored by Jamie Zawinski <jwz@jwz.org>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 ;; pre Lucid-Emacs 19.0.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 ;; face implementation #2 (used one face object per frame per face)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 ;; authored by Jamie Zawinski for 19.9.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 ;; face implementation #3 (use one face object per face) originally
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 ;; authored for 19.12 by Chuck Thompson <cthomp@cs.uiuc.edu>,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 ;; rewritten by Ben Wing with the advent of specifiers.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 ;;; Some stuff in FSF's faces.el is in our x-faces.el.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 ;;; Code:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 735
diff changeset
49 ;; To elude the warnings for font functions. (Normally autoloaded when
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 735
diff changeset
50 ;; font-create-object is called)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 735
diff changeset
51 (eval-when-compile
3094
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3027
diff changeset
52 (require 'font)
ad2f4ae9895b [xemacs-hg @ 2005-11-26 11:45:47 by stephent]
stephent
parents: 3027
diff changeset
53 (load "cl-macs"))
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 735
diff changeset
54
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 (defgroup faces nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 "Support for multiple text attributes (fonts, colors, ...)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 Such a collection of attributes is called a \"face\"."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 :group 'emacs)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 (defun read-face-name (prompt)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 (let (face)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 (while (= (length face) 0) ; nil or ""
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 (setq face (completing-read prompt
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 (mapcar (lambda (x) (list (symbol-name x)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 (face-list))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 nil t)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 (intern face)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 (defun face-interactive (what &optional bool)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 (let* ((fn (intern (concat "face-" what "-instance")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 (face (read-face-name (format "Set %s of face: " what)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 (default (if (fboundp fn)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 ;; #### we should distinguish here between
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 ;; explicitly setting the value to be the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 ;; same as the default face's value, and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 ;; not setting a value at all.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 (funcall fn face)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 (value (if bool
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 (y-or-n-p (format "Should face %s be %s? "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 (symbol-name face) bool))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 (read-string (format "Set %s of face %s to: "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 what (symbol-name face))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 (cond ((font-instance-p default)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 (font-instance-name default))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 ((color-instance-p default)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 (color-instance-name default))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 ((image-instance-p default)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 (image-instance-file-name default))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 (t default))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 (list face (if (equal value "") nil value))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 (defconst built-in-face-specifiers
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 (built-in-face-specifiers)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 "A list of the built-in face properties that are specifiers.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 (defun face-property (face property &optional locale tag-set exact-p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 "Return FACE's value of the given PROPERTY.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
100 NOTE: If you are looking for the \"value\" of a built-in face property
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
101 (`foreground', `background', `font', `background-pixmap', etc.), you
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
102 are probably better off calling `face-property-instance'. The return
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
103 value of `face-property' for built-in properties describes the original
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
104 specification used to determine the face property, which may be nil,
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
105 a list of instantiators, or something else that is unexpected. For
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
106 example, if you ask for a face property in a particular buffer (by
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
107 specifying a buffer for LOCALE), you will get a non-nil return value
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
108 only if a buffer-local specification for that particular buffer had
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
109 previously been given.
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
110
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
111 For a full list of built-in property names and their semantics, see
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
112 `set-face-property'.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
114 If LOCALE is omitted, the FACE's actual value for PROPERTY will be
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
115 returned. In this case, this function appears to behave rather
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
116 differently depending on whether PROPERTY is a built-in face property of
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
117 a user-defined face property. This is because the most basic value of a
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
118 user-defined property is simply whatever was set using
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
119 `set-face-property', but for a built-in property it's always a specifier,
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
120 which is an abstract object encapsulating all the specifications for that
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
121 particular property.
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
122
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
123 LOCALE, if supplied, will generally be a buffer, frame or
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
124 `global' (for the global value), but there are other possibilities -- see
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
125 the following paragraph. This mostly applies to built-in properties. In
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
126 this case, the return value will not be a specifier object but the
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
127 specification(s) for the given locale or locale type will be returned
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
128 (equivalent to calling `specifier-specs' on the specifier).
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
129 (Technically, the same thing happens if the basic value of a user-
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
130 defined property is a specifier, although this usage is rare.)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 The return value will be a list of instantiators (e.g. strings
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 specifying a font or color name), or a list of specifications, each
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 of which is a cons of a locale and a list of instantiators.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 Specifically, if LOCALE is a particular locale (a buffer, window,
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
136 frame, device, or `global'), a list of instantiators for that locale
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 will be returned. Otherwise, if LOCALE is a locale type (one of
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
138 the symbols `buffer', `window', `frame', or `device'), the specifications
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 for all locales of that type will be returned. Finally, if LOCALE is
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
140 `all', the specifications for all locales of all types will be returned.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 The specifications in a specifier determine what the value of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 PROPERTY will be in a particular \"domain\" or set of circumstances,
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
144 which is typically a particular Emacs window -- which in turn defines
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
145 a buffer (the buffer in the window), a frame (the frame that the window
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
146 is in), and a device (the device that the frame is in). The value is
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
147 derived from the instantiator associated with the most specific
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
148 locale (in the order buffer, window, frame, device, and `global')
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 that matches the domain in question. In other words, given a domain
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
150 (i.e. an Emacs window, usually), the specifier for PROPERTY will
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
151 first be searched for a specification whose locale is the buffer
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
152 contained within that window; then for a specification whose locale
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
153 is the window itself; then for a specification whose locale is the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
154 frame that the window is contained within; etc. The first
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
155 instantiator that is valid for the domain (usually this means that
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
156 the instantiator is recognized by the device [i.e. MS Windows, the X
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
157 server or TTY device]) will be \"instantiated\", which generates
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
158 a Lisp object encapsulating the original instantiator and the underlying
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
159 window-system object describing the property. The function
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
160 `face-property-instance' actually does all this."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 (setq face (get-face face))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 (let ((value (get face property)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 (if (and locale
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 (or (memq property built-in-face-specifiers)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 (specifierp value)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 (setq value (specifier-specs value locale tag-set exact-p)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 value))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 (defun convert-face-property-into-specifier (face property)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 "Convert PROPERTY on FACE into a specifier, if it's not already."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 (setq face (get-face face))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 (let ((specifier (get face property)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 ;; if a user-property does not have a specifier but a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 ;; locale was specified, put a specifier there.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 ;; If there was already a value there, convert it to a
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
177 ;; specifier with the value as its `global' instantiator.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 (unless (specifierp specifier)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 (let ((new-specifier (make-specifier 'generic)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 (if (or (not (null specifier))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 ;; make sure the nil returned from `get' wasn't
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 ;; actually the value of the property
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 (null (get face property t)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 (add-spec-to-specifier new-specifier specifier))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 (setq specifier new-specifier)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 (put face property specifier)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 (defun face-property-instance (face property
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
189 &optional domain default no-fallback)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 "Return the instance of FACE's PROPERTY in the specified DOMAIN.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 Under most circumstances, DOMAIN will be a particular window,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 and the returned instance describes how the specified property
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 actually is displayed for that window and the particular buffer
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 in it. Note that this may not be the same as how the property
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 appears when the buffer is displayed in a different window or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 frame, or how the property appears in the same window if you
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 switch to another buffer in that window; and in those cases,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 the returned instance would be different.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 The returned instance will typically be a color-instance,
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
202 font-instance, or image-instance object, and you can query
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 it using the appropriate object-specific functions. For example,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 you could use `color-instance-rgb-components' to find out the
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
205 RGB (red, green, and blue) components of how the `background'
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
206 property of the `highlight' face is displayed in a particular
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 window. The results might be different from the results
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 you would get for another window (perhaps the user
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 specified a different color for the frame that window is on;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 or perhaps the same color was specified but the window is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 on a different X server, and that X server has different RGB
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 values for the color from this one).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 DOMAIN defaults to the selected window if omitted.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 DOMAIN can be a frame or device, instead of a window. The value
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 returned for a such a domain is used in special circumstances
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 when a more specific domain does not apply; for example, a frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 value might be used for coloring a toolbar, which is conceptually
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 attached to a frame rather than a particular window. The value
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 is also useful in determining what the value would be for a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 particular window within the frame or device, if it is not
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 overridden by a more specific specification.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 If PROPERTY does not name a built-in property, its value will
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 simply be returned unless it is a specifier object, in which case
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 it will be instanced using `specifier-instance'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 Optional arguments DEFAULT and NO-FALLBACK are the same as in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 `specifier-instance'."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 (setq face (get-face face))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 (let ((value (get face property)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 (if (specifierp value)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 (setq value (specifier-instance value domain default no-fallback)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 value))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 (defun face-property-matching-instance (face property matchspec
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
239 &optional domain default
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
240 no-fallback)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 "Return the instance of FACE's PROPERTY matching MATCHSPEC in DOMAIN.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 Currently the only useful value for MATCHSPEC is a charset, when used
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 in conjunction with the face's font; this allows you to retrieve a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 font that can be used to display a particular charset, rather than just
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 any font.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 Other than MATCHSPEC, this function is identical to `face-property-instance'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 See also `specifier-matching-instance' for a fuller description of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 matching process."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 (setq face (get-face face))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 (let ((value (get face property)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 (if (specifierp value)
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
254 (setq value (if (or (charsetp matchspec)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
255 (and (symbolp matchspec)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
256 (find-charset matchspec)))
1137
c6facab13185 [xemacs-hg @ 2002-12-03 10:35:06 by didierv]
didierv
parents: 872
diff changeset
257 (or
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
258 (specifier-matching-instance
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
259 value (cons matchspec nil) domain default
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
260 no-fallback)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
261 (specifier-matching-instance
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
262 value (cons matchspec t) domain default
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
263 no-fallback))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
264 (specifier-matching-instance value matchspec domain
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
265 default no-fallback))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266 value))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 (defun set-face-property (face property value &optional locale tag-set
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
269 how-to-add)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 "Change a property of FACE.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 NOTE: If you want to remove a property from a face, use `remove-face-property'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 rather than attempting to set a value of nil for the property.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 For built-in properties, the actual value of the property is a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276 specifier and you cannot change this; but you can change the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277 specifications within the specifier, and that is what this function
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 will do. For user-defined properties, you can use this function
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 to either change the actual value of the property or, if this value
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 is a specifier, change the specifications within it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282 If PROPERTY is a built-in property, the specifications to be added to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283 this property can be supplied in many different ways:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 -- If VALUE is a simple instantiator (e.g. a string naming a font or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 color) or a list of instantiators, then the instantiator(s) will
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 be added as a specification of the property for the given LOCALE
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
288 (which defaults to `global' if omitted).
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 -- If VALUE is a list of specifications (each of which is a cons of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 a locale and a list of instantiators), then LOCALE must be nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291 (it does not make sense to explicitly specify a locale in this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292 case), and specifications will be added as given.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 -- If VALUE is a specifier (as would be returned by `face-property'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 if no LOCALE argument is given), then some or all of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 specifications in the specifier will be added to the property.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 In this case, the function is really equivalent to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 `copy-specifier' and LOCALE has the same semantics (if it is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 a particular locale, the specification for the locale will be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 copied; if a locale type, specifications for all locales of
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
300 that type will be copied; if nil or `all', then all
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 specifications will be copied).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
303 HOW-TO-ADD should be either nil or one of the symbols `prepend',
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
304 `append', `remove-tag-set-prepend', `remove-tag-set-append', `remove-locale',
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
305 `remove-locale-type', or `remove-all'. See `copy-specifier' and
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 `add-spec-to-specifier' for a description of what each of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307 these means. Most of the time, you do not need to worry about
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 this argument; the default behavior usually is fine.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310 In general, it is OK to pass an instance object (e.g. as returned
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 by `face-property-instance') as an instantiator in place of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312 an actual instantiator. In such a case, the instantiator used
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313 to create that instance object will be used (for example, if
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
314 you set a font-instance object as the value of the `font'
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 property, then the font name used to create that object will
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316 be used instead). If some cases, however, doing this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 conversion does not make sense, and this will be noted in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 the documentation for particular types of instance objects.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 If PROPERTY is not a built-in property, then this function will
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 simply set its value if LOCALE is nil. However, if LOCALE is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 given, then this function will attempt to add VALUE as the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 instantiator for the given LOCALE, using `add-spec-to-specifier'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 If the value of the property is not a specifier, it will
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
325 automatically be converted into a `generic' specifier.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328 The following symbols have predefined meanings:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330 foreground The foreground color of the face.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
331 For valid instantiators, see `make-color-specifier'.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 background The background color of the face.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
334 For valid instantiators, see `make-color-specifier'.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336 font The font used to display text covered by this face.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
337 For valid instantiators, see `make-font-specifier'.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 display-table The display table of the face.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 This should be a vector of 256 elements.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 background-pixmap The pixmap displayed in the background of the face.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
343 Only used by faces on X and MS Windows devices.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
344 For valid instantiators, see `make-image-specifier'.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
345
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346 underline Underline all text covered by this face.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
347 For valid instantiators, see `make-face-boolean-specifier'.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 strikethru Draw a line through all text covered by this face.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
350 For valid instantiators, see `make-face-boolean-specifier'.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352 highlight Highlight all text covered by this face.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353 Only used by faces on TTY devices.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
354 For valid instantiators, see `make-face-boolean-specifier'.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356 dim Dim all text covered by this face.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
357 For valid instantiators, see `make-face-boolean-specifier'.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359 blinking Blink all text covered by this face.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360 Only used by faces on TTY devices.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
361 For valid instantiators, see `make-face-boolean-specifier'.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363 reverse Reverse the foreground and background colors.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364 Only used by faces on TTY devices.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
365 For valid instantiators, see `make-face-boolean-specifier'.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
366
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
367 inherit Face name or face object from which to inherit attributes,
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
368 or a list of such elements. Attributes from inherited
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
369 faces are merged into the face like an underlying face
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
370 would be, with higher priority than underlying faces.
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
371
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
372 doc-string Description of what the face's normal use is.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
373 NOTE: This is not a specifier, unlike all
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
374 the other built-in properties, and cannot
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375 contain locale-specific values."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
376
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377 (setq face (get-face face))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
378 (if (memq property built-in-face-specifiers)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379 (set-specifier (get face property) value locale tag-set how-to-add)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381 ;; This section adds user defined properties.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382 (if (not locale)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383 (put face property value)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384 (convert-face-property-into-specifier face property)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385 (add-spec-to-specifier (get face property) value locale tag-set
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
386 how-to-add)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
387 value)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389 (defun remove-face-property (face property &optional locale tag-set exact-p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
390 "Remove a property from FACE.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391 For built-in properties, this is analogous to `remove-specifier'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392 See `remove-specifier' for the meaning of the LOCALE, TAG-SET, and EXACT-P
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 arguments."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 (or locale (setq locale 'all))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 (if (memq property built-in-face-specifiers)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396 (remove-specifier (face-property face property) locale tag-set exact-p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 (if (eq locale 'all)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398 (remprop (get-face face) property)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399 (convert-face-property-into-specifier face property)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 (remove-specifier (face-property face property) locale tag-set
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 exact-p))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
403 (defun reset-face (face &optional locale tag-set exact-p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404 "Clear all existing built-in specifications from FACE.
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
405 This makes FACE inherit all its display properties from `default'.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 WARNING: Be absolutely sure you want to do this!!! It is a dangerous
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 operation and is not undoable.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 The arguments LOCALE, TAG-SET and EXACT-P are the same as for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 `remove-specifier'."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 (mapc (lambda (x)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412 (remove-specifier (face-property face x) locale tag-set exact-p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413 built-in-face-specifiers)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 (defun set-face-parent (face parent &optional locale tag-set how-to-add)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 "Set the parent of FACE to PARENT, for all properties.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418 This makes all properties of FACE inherit from PARENT."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419 (setq parent (get-face parent))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420 (mapcar (lambda (x)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 (set-face-property face x (vector parent) locale tag-set
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
422 how-to-add))
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
423 (set-difference built-in-face-specifiers
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
424 '(display-table background-pixmap inherit)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
425 (set-face-background-pixmap face (vector 'inherit ':face parent)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426 locale tag-set how-to-add)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
427 nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
429 (defun face-doc-string (face)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430 "Return the documentation string for FACE."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431 (face-property face 'doc-string))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433 (defun set-face-doc-string (face doc-string)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
434 "Change the documentation string of FACE to DOC-STRING."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435 (interactive (face-interactive "doc-string"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436 (set-face-property face 'doc-string doc-string))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
437
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
438 (defun face-font-name (face &optional domain charset)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
439 "Return the font name of FACE in DOMAIN, or nil if it is unspecified.
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
440 DOMAIN is as in `face-font-instance'.
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
441
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
442 Font names are strings, as described in `make-font-specifier'."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
443 (let ((f (face-font-instance face domain charset)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
444 (and f (font-instance-name f))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
445
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
446 (defun face-font (face &optional locale tag-set exact-p)
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
447 "Return the font spec of FACE in LOCALE, or nil if it is unspecified.
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
448
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
449 NOTE: This returns a locale-specific specification, not any sort of value
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
450 corresponding to the actual font being used. If you want to know the
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
451 actual font used in a particular domain, use `face-font-instance', or
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
452 `face-font-name' for its name (i.e. the instantiator used to create it).
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
454 FACE may be either a face object or a symbol representing a face.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456 LOCALE may be a locale (the instantiators for that particular locale
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457 will be returned), a locale type (the specifications for all locales
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
458 of that type will be returned), `all' (all specifications will be
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459 returned), or nil (the actual specifier object will be returned).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
460
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
461 See `face-property' for more information."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
462 (face-property face 'font locale tag-set exact-p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 (defun face-font-instance (face &optional domain charset)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
465 "Return the instance of FACE's font in DOMAIN.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
466
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
467 Return value will be a font instance object; query its properties using
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
468 `font-instance-name', `font-instance-height', `font-instance-width', etc.
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
469
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470 FACE may be either a face object or a symbol representing a face.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472 Normally DOMAIN will be a window or nil (meaning the selected window),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
473 and an instance object describing how the font appears in that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
474 particular window and buffer will be returned.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476 See `face-property-instance' for more information."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477 (if charset
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478 (face-property-matching-instance face 'font charset domain)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479 (face-property-instance face 'font domain)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 (defun set-face-font (face font &optional locale tag-set how-to-add)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482 "Change the font of FACE to FONT in LOCALE.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484 FACE may be either a face object or a symbol representing a face.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
486 FONT should be an instantiator (see `make-font-specifier'), a list of
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487 instantiators, an alist of specifications (each mapping a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
488 locale to an instantiator list), or a font specifier object.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
490 If FONT is an alist, LOCALE must be omitted. If FONT is a
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
491 specifier object, LOCALE can be a locale, a locale type, `all',
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492 or nil; see `copy-specifier' for its semantics. Otherwise LOCALE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
493 specifies the locale under which the specified instantiator(s)
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
494 will be added, and defaults to `global'.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
495
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
496 See `set-face-property' for more information."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
497 (interactive (face-interactive "font"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498 (set-face-property face 'font font locale tag-set how-to-add))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
500 (defun face-foreground (face &optional locale tag-set exact-p)
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
501 "Return the foreground spec of FACE in LOCALE, or nil if it is unspecified.
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
502
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
503 NOTE: This returns a locale-specific specification, not any sort of value
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
504 corresponding to the actual foreground being used. If you want to know the
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
505 actual foreground color used in a particular domain, use
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
506 `face-foreground-instance', or `face-foreground-name' for its name
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
507 \(i.e. the instantiator used to create it).
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
509 FACE may be either a face object or a symbol representing a face.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
510
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
511 LOCALE may be a locale (the instantiators for that particular locale
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
512 will be returned), a locale type (the specifications for all locales
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
513 of that type will be returned), `all' (all specifications will be
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
514 returned), or nil (the actual specifier object will be returned).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
515
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516 See `face-property' for more information."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
517 (face-property face 'foreground locale tag-set exact-p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
519 (defun face-foreground-instance (face &optional domain default no-fallback)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
520 "Return the instance of FACE's foreground in DOMAIN.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
521
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
522 Return value will be a color instance object; query its properties using
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
523 `color-instance-name' or `color-instance-rgb-properties'.
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
524
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
525 FACE may be either a face object or a symbol representing a face.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
527 Normally DOMAIN will be a window or nil (meaning the selected window),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528 and an instance object describing how the foreground appears in that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
529 particular window and buffer will be returned.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
530
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
531 See `face-property-instance' for more information."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
532 (face-property-instance face 'foreground domain default no-fallback))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
533
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
534 (defun face-foreground-name (face &optional domain default no-fallback)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
535 "Return the name of FACE's foreground color in DOMAIN.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
536
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
537 FACE may be either a face object or a symbol representing a face.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
539 Normally DOMAIN will be a window or nil (meaning the selected window),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
540 and an instance object describing how the background appears in that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
541 particular window and buffer will be returned.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
542
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
543 See `face-property-instance' for more information."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
544 (color-instance-name (face-foreground-instance
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
545 face domain default no-fallback)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
546
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
547 (defun set-face-foreground (face color &optional locale tag-set how-to-add)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
548 "Change the foreground color of FACE to COLOR in LOCALE.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
549
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
550 FACE may be either a face object or a symbol representing a face.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
551
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
552 COLOR should be an instantiator (see `make-color-specifier'), a list of
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
553 instantiators, an alist of specifications (each mapping a locale to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
554 an instantiator list), or a color specifier object.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
555
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
556 If COLOR is an alist, LOCALE must be omitted. If COLOR is a
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
557 specifier object, LOCALE can be a locale, a locale type, `all',
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
558 or nil; see `copy-specifier' for its semantics. Otherwise LOCALE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
559 specifies the locale under which the specified instantiator(s)
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
560 will be added, and defaults to `global'.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
561
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
562 See `set-face-property' for more information."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
563 (interactive (face-interactive "foreground"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
564 (set-face-property face 'foreground color locale tag-set how-to-add))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
565
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
566 (defun face-background (face &optional locale tag-set exact-p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
567 "Return the background color of FACE in LOCALE, or nil if it is unspecified.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
568
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
569 NOTE: This returns a locale-specific specification, not any sort of value
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
570 corresponding to the actual background being used. If you want to know the
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
571 actual background color used in a particular domain, use
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
572 `face-background-instance', or `face-background-name' for its name
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
573 \(i.e. the instantiator used to create it).
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
574
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
575 FACE may be either a face object or a symbol representing a face.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
576
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
577 LOCALE may be a locale (the instantiators for that particular locale
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
578 will be returned), a locale type (the specifications for all locales
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
579 of that type will be returned), `all' (all specifications will be
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
580 returned), or nil (the actual specifier object will be returned).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
581
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
582 See `face-property' for more information."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
583 (face-property face 'background locale tag-set exact-p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
584
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
585 (defun face-background-instance (face &optional domain default no-fallback)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
586 "Return the instance of FACE's background in DOMAIN.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
587
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
588 Return value will be a color instance object; query its properties using
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
589 `color-instance-name' or `color-instance-rgb-properties'.
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
590
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
591 FACE may be either a face object or a symbol representing a face.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
592
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
593 Normally DOMAIN will be a window or nil (meaning the selected window),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
594 and an instance object describing how the background appears in that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
595 particular window and buffer will be returned.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
596
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
597 See `face-property-instance' for more information."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
598 (face-property-instance face 'background domain default no-fallback))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
599
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
600 (defun face-background-name (face &optional domain default no-fallback)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
601 "Return the name of FACE's background color in DOMAIN.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
602
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
603 FACE may be either a face object or a symbol representing a face.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
604
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
605 Normally DOMAIN will be a window or nil (meaning the selected window),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
606 and an instance object describing how the background appears in that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
607 particular window and buffer will be returned.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
608
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
609 See `face-property-instance' for more information."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
610 (color-instance-name (face-background-instance
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
611 face domain default no-fallback)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
612
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
613 (defun set-face-background (face color &optional locale tag-set how-to-add)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
614 "Change the background color of FACE to COLOR in LOCALE.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
615
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
616 FACE may be either a face object or a symbol representing a face.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
617
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
618 COLOR should be an instantiator (see `make-color-specifier'), a list of
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
619 instantiators, an alist of specifications (each mapping a locale to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
620 an instantiator list), or a color specifier object.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
621
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
622 If COLOR is an alist, LOCALE must be omitted. If COLOR is a
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
623 specifier object, LOCALE can be a locale, a locale type, `all',
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
624 or nil; see `copy-specifier' for its semantics. Otherwise LOCALE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
625 specifies the locale under which the specified instantiator(s)
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
626 will be added, and defaults to `global'.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
627
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
628 See `set-face-property' for more information."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
629 (interactive (face-interactive "background"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
630 (set-face-property face 'background color locale tag-set how-to-add))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
631
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
632 (defun face-background-pixmap (face &optional locale tag-set exact-p)
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
633 "Return the background pixmap spec of FACE in LOCALE, or nil if unspecified.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
634 This property is only used on window system devices.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
635
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
636 NOTE: This returns a locale-specific specification, not any sort of value
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
637 corresponding to the actual background pixmap being used. If you want to
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
638 know the actual background pixmap used in a particular domain, use
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
639 `face-background-pixmap-instance'.
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
640
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
641 FACE may be either a face object or a symbol representing a face.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
642
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
643 LOCALE may be a locale (the instantiators for that particular locale
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
644 will be returned), a locale type (the specifications for all locales
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
645 of that type will be returned), `all' (all specifications will be
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
646 returned), or nil (the actual specifier object will be returned).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
647
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
648 See `face-property' for more information."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
649 (face-property face 'background-pixmap locale tag-set exact-p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
650
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
651 (defun face-background-pixmap-instance (face &optional domain default
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
652 no-fallback)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
653 "Return the instance of FACE's background pixmap in DOMAIN.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
654
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
655 Return value will be an image instance object; query its properties using
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
656 `image-instance-instantiator' (the original instantiator used to create
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
657 the image, which may be a complex beast -- see `make-image-specifier'),
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
658 `image-instance-file-name' (the file, if any, from which the image was
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
659 created), `image-instance-height', etc.
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
660
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
661 FACE may be either a face object or a symbol representing a face.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
662
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
663 Normally DOMAIN will be a window or nil (meaning the selected window),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
664 and an instance object describing how the background appears in that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
665 particular window and buffer will be returned.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
666
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
667 See `face-property-instance' for more information."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
668 (face-property-instance face 'background-pixmap domain default no-fallback))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
669
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
670 (defun set-face-background-pixmap (face pixmap &optional locale tag-set
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
671 how-to-add)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
672 "Change the background pixmap of FACE to PIXMAP in LOCALE.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
673 This property is only used on window system devices.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
674
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
675 FACE may be either a face object or a symbol representing a face.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
676
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
677 PIXMAP should be an instantiator (see `make-image-specifier'), a list
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
678 of instantiators, an alist of specifications (each mapping a locale
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
679 to an instantiator list), or an image specifier object.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
680
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
681 If PIXMAP is an alist, LOCALE must be omitted. If PIXMAP is a
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
682 specifier object, LOCALE can be a locale, a locale type, `all',
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
683 or nil; see `copy-specifier' for its semantics. Otherwise LOCALE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
684 specifies the locale under which the specified instantiator(s)
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
685 will be added, and defaults to `global'.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
686
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
687 See `set-face-property' for more information."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
688 (interactive (face-interactive "background-pixmap"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
689 (set-face-property face 'background-pixmap pixmap locale tag-set how-to-add))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
690
1137
c6facab13185 [xemacs-hg @ 2002-12-03 10:35:06 by didierv]
didierv
parents: 872
diff changeset
691 (defvar background-pixmap-file-history nil
c6facab13185 [xemacs-hg @ 2002-12-03 10:35:06 by didierv]
didierv
parents: 872
diff changeset
692 ;; History for `set-face-background-pixmap-file'
c6facab13185 [xemacs-hg @ 2002-12-03 10:35:06 by didierv]
didierv
parents: 872
diff changeset
693 )
c6facab13185 [xemacs-hg @ 2002-12-03 10:35:06 by didierv]
didierv
parents: 872
diff changeset
694
c6facab13185 [xemacs-hg @ 2002-12-03 10:35:06 by didierv]
didierv
parents: 872
diff changeset
695 (defun set-face-background-pixmap-file (face file)
c6facab13185 [xemacs-hg @ 2002-12-03 10:35:06 by didierv]
didierv
parents: 872
diff changeset
696 "Read (and set) the background pixmap of FACE from FILE.
c6facab13185 [xemacs-hg @ 2002-12-03 10:35:06 by didierv]
didierv
parents: 872
diff changeset
697 This function is a simplified version of `set-face-background-pixmap',
c6facab13185 [xemacs-hg @ 2002-12-03 10:35:06 by didierv]
didierv
parents: 872
diff changeset
698 designed for interactive use."
c6facab13185 [xemacs-hg @ 2002-12-03 10:35:06 by didierv]
didierv
parents: 872
diff changeset
699 (interactive
c6facab13185 [xemacs-hg @ 2002-12-03 10:35:06 by didierv]
didierv
parents: 872
diff changeset
700 (let* ((face (read-face-name "Set background pixmap of face: "))
1139
c2550fff5469 [xemacs-hg @ 2002-12-03 14:02:49 by didierv]
didierv
parents: 1137
diff changeset
701 (default (and (face-background-pixmap-instance face)
c2550fff5469 [xemacs-hg @ 2002-12-03 14:02:49 by didierv]
didierv
parents: 1137
diff changeset
702 ((image-instance-file-name
c2550fff5469 [xemacs-hg @ 2002-12-03 14:02:49 by didierv]
didierv
parents: 1137
diff changeset
703 (face-background-pixmap-instance face)))))
1137
c6facab13185 [xemacs-hg @ 2002-12-03 10:35:06 by didierv]
didierv
parents: 872
diff changeset
704 (file (read-file-name
c6facab13185 [xemacs-hg @ 2002-12-03 10:35:06 by didierv]
didierv
parents: 872
diff changeset
705 (format "Set background pixmap of face %s to: "
c6facab13185 [xemacs-hg @ 2002-12-03 10:35:06 by didierv]
didierv
parents: 872
diff changeset
706 (symbol-name face))
1139
c2550fff5469 [xemacs-hg @ 2002-12-03 14:02:49 by didierv]
didierv
parents: 1137
diff changeset
707 nil default t nil
1137
c6facab13185 [xemacs-hg @ 2002-12-03 10:35:06 by didierv]
didierv
parents: 872
diff changeset
708 'background-pixmap-file-history)))
c6facab13185 [xemacs-hg @ 2002-12-03 10:35:06 by didierv]
didierv
parents: 872
diff changeset
709 (list face (if (equal file "") nil file))))
c6facab13185 [xemacs-hg @ 2002-12-03 10:35:06 by didierv]
didierv
parents: 872
diff changeset
710 (set-face-property face 'background-pixmap file))
c6facab13185 [xemacs-hg @ 2002-12-03 10:35:06 by didierv]
didierv
parents: 872
diff changeset
711
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
712 (defun face-display-table (face &optional locale tag-set exact-p)
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
713 "Return the display table spec of FACE in LOCALE, or nil if unspecified..
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
714
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
715 NOTE: This returns a locale-specific specification, not any sort of value
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
716 corresponding to the actual display table being used. If you want to
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
717 know the actual display table used in a particular domain, use
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
718 `face-display-table-instance'.
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
719
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
720 FACE may be either a face object or a symbol representing a face.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
721
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
722 LOCALE may be a locale (the instantiators for that particular locale
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
723 will be returned), a locale type (the specifications for all locales
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
724 of that type will be returned), `all' (all specifications will be
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
725 returned), or nil (the actual specifier object will be returned).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
726
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
727 See `face-property' for more information."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
728 (face-property face 'display-table locale tag-set exact-p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
729
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
730 (defun face-display-table-instance (face &optional domain default no-fallback)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
731 "Return the instance of FACE's display table in DOMAIN.
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
732
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
733 Return value will be a vector, char table or range table; see
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
734 `current-display-table'.
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
735
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
736 FACE may be either a face object or a symbol representing a face.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
737
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
738 Normally DOMAIN will be a window or nil (meaning the selected window),
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
739 and the actual display table used in that particular window and buffer
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
740 will be returned.
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
741
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
742 See `face-property-instance' for more information."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
743 (face-property-instance face 'display-table domain default no-fallback))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
744
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
745 (defun set-face-display-table (face display-table &optional locale tag-set
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
746 how-to-add)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
747 "Change the display table of FACE to DISPLAY-TABLE in LOCALE.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
748 DISPLAY-TABLE should be a vector as returned by `make-display-table'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
749
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
750 See `set-face-property' for the semantics of the LOCALE, TAG-SET, and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
751 HOW-TO-ADD arguments."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
752 (interactive (face-interactive "display-table"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
753 (set-face-property face 'display-table display-table locale tag-set
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
754 how-to-add))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
755
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
756 ;; The following accessors and mutators are, IMHO, good
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
757 ;; implementation. Cf. with `make-face-bold'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
758
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
759 (defun face-underline-p (face &optional domain default no-fallback)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
760 "Return t if FACE is underlined in DOMAIN.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
761 See `face-property-instance' for the semantics of the DOMAIN argument."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
762 (face-property-instance face 'underline domain default no-fallback))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
763
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
764 (defun set-face-underline-p (face underline-p &optional locale tag-set
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
765 how-to-add)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
766 "Change the underline property of FACE to UNDERLINE-P.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
767 UNDERLINE-P is normally a face-boolean instantiator; see
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
768 `make-face-boolean-specifier'.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
769 See `set-face-property' for the semantics of the LOCALE, TAG-SET, and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
770 HOW-TO-ADD arguments."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
771 (interactive (face-interactive "underline-p" "underlined"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
772 (set-face-property face 'underline underline-p locale tag-set how-to-add))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
773
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
774 (defun face-strikethru-p (face &optional domain default no-fallback)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
775 "Return t if FACE is strikethru-d (i.e. struck through) in DOMAIN.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
776 See `face-property-instance' for the semantics of the DOMAIN argument."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
777 (face-property-instance face 'strikethru domain default no-fallback))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
778
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
779 (defun set-face-strikethru-p (face strikethru-p &optional locale tag-set
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
780 how-to-add)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
781 "Change whether FACE is strikethru-d (i.e. struck through) in LOCALE.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
782 STRIKETHRU-P is normally a face-boolean instantiator; see
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
783 `make-face-boolean-specifier'.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
784 See `set-face-property' for the semantics of the LOCALE, TAG-SET, and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
785 HOW-TO-ADD arguments."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
786 (interactive (face-interactive "strikethru-p" "strikethru-d"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
787 (set-face-property face 'strikethru strikethru-p locale tag-set how-to-add))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
788
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
789 (defun face-highlight-p (face &optional domain default no-fallback)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
790 "Return t if FACE is highlighted in DOMAIN (TTY domains only).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
791 See `face-property-instance' for the semantics of the DOMAIN argument."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
792 (face-property-instance face 'highlight domain default no-fallback))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
793
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
794 (defun set-face-highlight-p (face highlight-p &optional locale tag-set
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
795 how-to-add)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
796 "Change whether FACE is highlighted in LOCALE (TTY locales only).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
797 HIGHLIGHT-P is normally a face-boolean instantiator; see
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
798 `make-face-boolean-specifier'.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
799 See `set-face-property' for the semantics of the LOCALE, TAG-SET, and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
800 HOW-TO-ADD arguments."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
801 (interactive (face-interactive "highlight-p" "highlighted"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
802 (set-face-property face 'highlight highlight-p locale tag-set how-to-add))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
803
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
804 (defun face-dim-p (face &optional domain default no-fallback)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
805 "Return t if FACE is dimmed in DOMAIN.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
806 See `face-property-instance' for the semantics of the DOMAIN argument."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
807 (face-property-instance face 'dim domain default no-fallback))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
808
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
809 (defun set-face-dim-p (face dim-p &optional locale tag-set how-to-add)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
810 "Change whether FACE is dimmed in LOCALE.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
811 DIM-P is normally a face-boolean instantiator; see
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
812 `make-face-boolean-specifier'.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
813 See `set-face-property' for the semantics of the LOCALE, TAG-SET, and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
814 HOW-TO-ADD arguments."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
815 (interactive (face-interactive "dim-p" "dimmed"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
816 (set-face-property face 'dim dim-p locale tag-set how-to-add))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
817
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
818 (defun face-blinking-p (face &optional domain default no-fallback)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
819 "Return t if FACE is blinking in DOMAIN (TTY domains only).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
820 See `face-property-instance' for the semantics of the DOMAIN argument."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
821 (face-property-instance face 'blinking domain default no-fallback))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
822
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
823 (defun set-face-blinking-p (face blinking-p &optional locale tag-set
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
824 how-to-add)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
825 "Change whether FACE is blinking in LOCALE (TTY locales only).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
826 BLINKING-P is normally a face-boolean instantiator; see
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
827 `make-face-boolean-specifier'.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
828 See `set-face-property' for the semantics of the LOCALE, TAG-SET, and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
829 HOW-TO-ADD arguments."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
830 (interactive (face-interactive "blinking-p" "blinking"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
831 (set-face-property face 'blinking blinking-p locale tag-set how-to-add))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
832
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
833 (defun face-reverse-p (face &optional domain default no-fallback)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
834 "Return t if FACE is reversed in DOMAIN (TTY domains only).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
835 See `face-property-instance' for the semantics of the DOMAIN argument."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
836 (face-property-instance face 'reverse domain default no-fallback))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
837
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
838 (defun set-face-reverse-p (face reverse-p &optional locale tag-set how-to-add)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
839 "Change whether FACE is reversed in LOCALE (TTY locales only).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
840 REVERSE-P is normally a face-boolean instantiator; see
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
841 `make-face-boolean-specifier'.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
842 See `set-face-property' for the semantics of the LOCALE, TAG-SET, and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
843 HOW-TO-ADD arguments."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
844 (interactive (face-interactive "reverse-p" "reversed"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
845 (set-face-property face 'reverse reverse-p locale tag-set how-to-add))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
846
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
847
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
848 (defun face-property-equal (face1 face2 prop domain)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
849 (equal (face-property-instance face1 prop domain)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
850 (face-property-instance face2 prop domain)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
851
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
852 (defun face-equal-loop (props face1 face2 domain)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
853 (while (and props
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
854 (face-property-equal face1 face2 (car props) domain))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
855 (setq props (cdr props)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
856 (null props))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
857
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
858 (defun face-equal (face1 face2 &optional domain)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
859 "Return t if FACE1 and FACE2 will display in the same way in DOMAIN.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
860 See `face-property-instance' for the semantics of the DOMAIN argument."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
861 (if (null domain) (setq domain (selected-window)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
862 (if (not (valid-specifier-domain-p domain))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
863 (error "Invalid specifier domain"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
864 (let ((device (dfw-device domain))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
865 (common-props '(foreground background font display-table underline
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
866 dim inherit))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
867 (win-props '(background-pixmap strikethru))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
868 (tty-props '(highlight blinking reverse)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
869
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
870 ;; First check the properties which are used in common between the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
871 ;; x and tty devices. Then, check those properties specific to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
872 ;; the particular device type.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
873 (and (face-equal-loop common-props face1 face2 domain)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
874 (cond ((eq 'tty (device-type device))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
875 (face-equal-loop tty-props face1 face2 domain))
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
876 ((console-on-window-system-p (device-console device))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
877 (face-equal-loop win-props face1 face2 domain))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
878 (t t)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
879
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
880 (defun face-differs-from-default-p (face &optional domain)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
881 "Return t if FACE will display differently from the default face in DOMAIN.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
882 See `face-property-instance' for the semantics of the DOMAIN argument."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
883 (not (face-equal face 'default domain)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
884
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
885 (defun try-font-name (name &optional device)
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
886 "Return NAME if it's a valid font name on DEVICE, else nil."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
887 ;; yes, name really should be here twice.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
888 (and name (make-font-instance name device t) name))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
889
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
890
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
891
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
892 (defcustom face-frob-from-locale-first nil
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
893 "*If non nil, use kludgy way of frobbing fonts suitable for non-mule
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
894 multi-charset environments."
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
895 :group 'faces
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
896 :type 'boolean)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
897
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
898 ;; This function is a terrible, disgusting hack!!!! Need to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
899 ;; separate out the font elements as separate face properties!
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
900
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
901 ;; WE DEMAND LEXICAL SCOPING!!!
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
902 ;; WE DEMAND LEXICAL SCOPING!!!
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
903 ;; WE DEMAND LEXICAL SCOPING!!!
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
904 ;; WE DEMAND LEXICAL SCOPING!!!
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
905 ;; WE DEMAND LEXICAL SCOPING!!!
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
906 ;; WE DEMAND LEXICAL SCOPING!!!
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
907 ;; WE DEMAND LEXICAL SCOPING!!!
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
908 ;; WE DEMAND LEXICAL SCOPING!!!
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
909 ;; WE DEMAND LEXICAL SCOPING!!!
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
910 ;; WE DEMAND LEXICAL SCOPING!!!
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
911 ;; WE DEMAND LEXICAL SCOPING!!!
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
912 ;; WE DEMAND LEXICAL SCOPING!!!
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
913 ;; WE DEMAND LEXICAL SCOPING!!!
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
914 ;; WE DEMAND LEXICAL SCOPING!!!
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
915 ;; WE DEMAND LEXICAL SCOPING!!!
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
916
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
917 ;; When we are initializing a device, it won't be selected; we communicate
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
918 ;; the device to consider as selected using this variable.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
919 (defvar Face-frob-property-device-considered-current nil)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
920
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
921 (defun Face-frob-property (face locale tag-set exact-p
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
922 unfrobbed-face frobbed-face
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
923 win-prop tty-props
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
924 frob-mapping standard-face-mapping)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
925 ;; implement the semantics of `make-face-bold' et al. FACE, LOCALE, TAG-SET
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
926 ;; and EXACT-P are as in that call. UNFROBBED-FACE and FROBBED-FACE are
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
927 ;; what we expect the original face and the result to look like,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
928 ;; respectively. TTY-PROPS is a list of face properties to frob in place
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
929 ;; of `font' for TTY's. FROB-MAPPING is either a plist mapping device
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
930 ;; types to functions of two args (NAME DEVICE) that will frob the
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
931 ;; instantiator as appropriate for the device type (this includes TTY's),
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
932 ;; or a function to handle the mapping for all device types.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
933 ;; STANDARD-FACE-MAPPING is an alist of mappings of inheritance
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
934 ;; instantiators to be replaced with other inheritance instantiators, meant
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
935 ;; for e.g. converting [bold] into [bold-italic].
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
936
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
937 ;; #### it would be nice if this function could be generalized to be
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
938 ;; a general specifier frobber. but so much of what it does is specific
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
939 ;; to faces -- e.g. handling of inheritance, standard faces,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
940 ;; special-casing in various ways for tty's, etc. i've already extracted
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
941 ;; as much of the functionality as i can into subfunctions in the
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
942 ;; heuristic section of specifier.el.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
943
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
944 ;; #### Note: The old code was totally different (and there was much less
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
945 ;; of it). It didn't bother with trying to frob all the instantiators,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
946 ;; or handle inheritance vectors as instantiators, or do something
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
947 ;; sensible with buffer locales, or many other things. (It always, or
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
948 ;; usually, did a specifier-instance and frobbed the result.) But it did
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
949 ;; do three things we don't:
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
950 ;;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
951 ;; (1) Map over all devices when processing global or buffer locales.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
952 ;; Should we be doing this in stages 2 and/or 3? The fact that we
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
953 ;; now process all fallback instantiators seems to make this less
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
954 ;; necessary, at least for global locales.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
955 ;;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
956 ;; (2) Remove all instantiators tagged with `default' when putting the
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
957 ;; instantiators back. I don't see why this is necessary, but maybe
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
958 ;; it is.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
959 ;;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
960 ;; (3) Pay attention to the face-frob-from-locale-first variable. ####
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
961 ;; I don't understand its purpose. Undocumented hacks like this,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
962 ;; clearly added after-the-fact, don't deserve to live. DOCUMENT
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
963 ;; THIS SHIT!
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
964
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
965 (flet
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
966 (
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
967
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
968 ;; non-nil if either instantiator non-nil, or nil instantiators allowed.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
969 (nil-instantiator-ok (inst devtype-spec)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
970 (or inst (eq devtype-spec 'tty)))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
971
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
972 ;; if LOCALE is a global locale (all, nil, global), return 'global,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
973 ;; else nil.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
974 (global-locale (locale)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
975 (and (memq locale '(all nil global)) 'global))
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
976
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
977 ;; Given a locale and the inst-list from that locale, frob the
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
978 ;; instantiators according to FROB-MAPPING, a plist mapping device
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
979 ;; types to functions that frob instantiators of that device type.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
980 ;; NOTE: TAG-SET and FROB-MAPPING from environment.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
981 (frob-face-inst-list (locale inst-list prop devtype-spec)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
982 (let* ((ffpdev Face-frob-property-device-considered-current)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
983 (results
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
984 ;; for each inst-pair, frob it (the result will be 0 or
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
985 ;; more inst-pairs; we may get more than one if, e.g. the
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
986 ;; instantiator specifies inheritance and we expand the
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
987 ;; inheritance); then nconc the results together
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
988 (loop for (tag-set . x) in inst-list
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
989 for devtype = (derive-device-type-from-locale-and-tag-set
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
990 locale tag-set devtype-spec ffpdev)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
991 ;; devtype may be nil if it fails to match DEVTYPE-SPEC
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
992 if devtype
3360
316fddbf58e2 [xemacs-hg @ 2006-04-25 14:01:52 by stephent]
stephent
parents: 3094
diff changeset
993 if (let* ((mapper
316fddbf58e2 [xemacs-hg @ 2006-04-25 14:01:52 by stephent]
stephent
parents: 3094
diff changeset
994 (cond ((functionp frob-mapping) frob-mapping)
316fddbf58e2 [xemacs-hg @ 2006-04-25 14:01:52 by stephent]
stephent
parents: 3094
diff changeset
995 ((plist-get frob-mapping devtype))
316fddbf58e2 [xemacs-hg @ 2006-04-25 14:01:52 by stephent]
stephent
parents: 3094
diff changeset
996 (t (error 'unimplemented "mapper" devtype))))
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
997 (result
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
998 (cond
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
999 ;; if a vector ...
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1000 ((vectorp x)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1001 (let ((change-to
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1002 (cdr (assoc x standard-face-mapping))))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1003 (cond
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1004 ;; (1) handle standard mappings/null vectors
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1005 ((or change-to (null (length x)))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1006 (list (cons tag-set
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1007 (cond ((eq change-to t) x)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1008 (change-to)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1009 (t x)))))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1010 ;; (2) inheritance vectors. retrieve the
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1011 ;; inherited value and recursively frob.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1012 ;; stick the tag-set into the result.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1013 (t (let*
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1014 ((subprop
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1015 (if (> (length x) 1) (elt x 1)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1016 prop))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1017 (subinsts
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1018 (frob-face-inst-list
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1019 locale
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1020 (cdar
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1021 (specifier-spec-list
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1022 (face-property (elt x 0)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1023 subprop)))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1024 subprop devtype-spec)))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1025 ;; #### we don't currently handle
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1026 ;; the "reverse the sense" flag on
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1027 ;; tty inheritance vectors.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1028 (add-tag-to-inst-list subinsts
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1029 tag-set))))))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1030 ;; (3) not a vector. just process it.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1031 (t
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1032 (let ((value
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1033 (if (eq devtype-spec 'tty)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1034 (funcall mapper x)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1035 (funcall mapper x
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1036 (derive-domain-from-locale
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1037 locale devtype-spec
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1038 ffpdev)))))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1039 (and (nil-instantiator-ok value devtype-spec)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1040 (list (cons tag-set value))))))))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1041 ;; if we're adding to a tty, we need to tag our
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1042 ;; additions with `tty'; see [note 1] below. we leave
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1043 ;; the old spec in place, however -- if e.g. we're
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1044 ;; italicizing a font that was always set to be
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1045 ;; underlined, even on window systems, then we still
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1046 ;; want the underline there. unless we put the old
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1047 ;; spec back, the underline will disappear, since
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1048 ;; the new specs are all tagged with `tty'. this
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1049 ;; doesn't apply to the [note 1] situations below
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1050 ;; because there we're just adding, not substituting.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1051 (if (and (eq 'tty devtype-spec)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1052 (not (or (eq 'tty tag-set)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1053 (memq 'tty tag-set))))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1054 (nconc (add-tag-to-inst-list result 'tty)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1055 (list (cons tag-set x)))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1056 result))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1057 nconc it)))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1058 (delete-duplicates results :test #'equal)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1059
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1060 ;; Frob INST-LIST, which came from LOCALE, and put the new value back
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1061 ;; into SP at LOCALE. THUNK is a cons of (PROP . DEVTYPE-SPEC), the
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1062 ;; property being processed and whether this is a TTY property or a
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1063 ;; win property.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1064 (frob-locale (sp locale inst-list thunk)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1065 (let ((newinst (frob-face-inst-list locale inst-list
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1066 (car thunk) (cdr thunk))))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1067 (remove-specifier sp locale tag-set exact-p)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1068 (add-spec-list-to-specifier sp (list (cons locale newinst))))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1069 ;; map-specifier should keep going
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1070 nil)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1071
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1072 ;; map over all specified locales in LOCALE; for each locale,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1073 ;; frob the instantiators in that locale in the specifier in both
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1074 ;; WIN-PROP and TTY-PROPS in FACE. Takes values from environment.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1075 (map-over-locales (locale)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1076 (map-specifier (get face win-prop) #'frob-locale locale
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1077 (cons win-prop 'window-system)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1078 tag-set exact-p)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1079 (loop for prop in tty-props do
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1080 (map-specifier (get face prop) #'frob-locale locale
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1081 (cons prop 'tty)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1082 tag-set exact-p)))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1083
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1084 ;; end of flets
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1085 )
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1086
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1087 ;; the function itself
452
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
1088
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1089 (let* ((ffpdev Face-frob-property-device-considered-current)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1090 (do-later-stages
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1091 (or (global-locale locale)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1092 (valid-specifier-domain-p locale)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1093 (bufferp locale)))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1094 (domain (and do-later-stages
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1095 (derive-domain-from-locale locale 'window-system
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1096 ffpdev)))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1097 (check-differences
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1098 (and unfrobbed-face frobbed-face domain
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1099 (not (memq (face-name face)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1100 '(default bold italic bold-italic)))))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1101 (orig-instance
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1102 (and check-differences
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1103 (face-property-instance face win-prop domain))))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1104
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1105 ;; first do the frobbing
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1106 (setq face (get-face face))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1107 (map-over-locales locale)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1108
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1109 (when do-later-stages
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1110
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1111 (if (global-locale locale) (setq locale 'global))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1112
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1113 ;; now do the second stage -- if there's nothing there, try
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1114 ;; harder to find an instantiator, and frob it.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1115 (let (do-something)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1116 (loop for prop in (cons win-prop tty-props)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1117 for propspec = (get face prop)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1118 for devtype-spec = (if (eq prop win-prop) 'window-system 'tty)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1119 if propspec
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1120 do
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1121 (or (specifier-spec-list propspec locale)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1122 (let ((doit (derive-specifier-specs-from-locale
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1123 propspec locale devtype-spec ffpdev
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1124 ;; #### does this make sense? When no tags
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1125 ;; given, frob the whole list of fallbacks when
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1126 ;; global, else just retrieve a current-device
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1127 ;; value. this tries to mirror normal practices,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1128 ;; where with no tags you want everything frobbed,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1129 ;; but with a tag you want only the tag frobbed
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1130 ;; and hence you probably don't want lots and lots
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1131 ;; of items there. (#### Perhaps the best way --
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1132 ;; or at least a way with some theoretical
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1133 ;; justifiability -- is to fetch the fallbacks
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1134 ;; that match the TAG-SET/EXACT-P, and if none,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1135 ;; fall back onto doing the selected-device
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1136 ;; trick.)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1137 (and (not tag-set) (not exact-p)))))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1138 (if (and (not doit) (eq locale 'global))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1139 (error
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1140 "No fallback for specifier property %s in face %s???"
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1141 prop face))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1142 ;; [note 1] whenever we add to a tty property,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1143 ;; make sure we tag our additions with `tty' to
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1144 ;; avoid accidentally messing things up on window
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1145 ;; systems (e.g. when making things italic we
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1146 ;; don't want to set the underline property on
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1147 ;; window systems)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1148 (when doit
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1149 (add-spec-list-to-specifier
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1150 propspec
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1151 (list (cons locale
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1152 (add-tag-to-inst-list
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1153 doit
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1154 (append (if (listp tag-set) tag-set
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1155 (list tag-set))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1156 (if (eq devtype-spec 'tty) '(tty)))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1157 ))))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1158 (setq do-something t)))))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1159 (when do-something
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1160 (map-over-locales (or (global-locale locale) locale))))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1161
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1162 ;; then do the third stage -- check for whether we have to do
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1163 ;; the inheritance trick.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1164
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1165 (when (and check-differences
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1166 (let ((new-instance
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1167 (face-property-instance face win-prop domain)))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1168 (and
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1169 (equal orig-instance new-instance)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1170 (equal orig-instance
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1171 (face-property-instance unfrobbed-face win-prop
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1172 domain)))))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1173 (set-face-property face win-prop (vector frobbed-face)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1174 (or (global-locale locale) locale) tag-set))))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1175
707
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 502
diff changeset
1176 ;; WE DEMAND FOUNDRY FROBBING!
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 502
diff changeset
1177
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 502
diff changeset
1178 ;; Family frobbing
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 502
diff changeset
1179 ;; Thx Jan Vroonhof, Ref xemacs-beta <87oflypbum.fsf@petteflet.ntlworld.com>
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 502
diff changeset
1180 ;; Brainlessly derived from make-face-size by Stephen; don't blame Jan.
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 502
diff changeset
1181 ;; I'm long since flown to Rio, it does you little good to blame me, either.
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1182 (defun make-face-family (face family &optional locale tags exact-p)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1183 "Set FACE's family to FAMILY in LOCALE, if possible."
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1184 (interactive (list (read-face-name "Set family of which face: ")
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1185 (read-string "Family to set: ")))
707
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 502
diff changeset
1186
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1187 (Face-frob-property face locale tags exact-p
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1188 nil nil 'font nil
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1189 `(lambda (f d)
707
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 502
diff changeset
1190 ;; keep the dependency on font.el for now
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1191 (let ((fo (font-create-object f d)))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1192 (set-font-family fo ,family)
707
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 502
diff changeset
1193 (font-create-name fo d)))
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1194 nil))
707
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 502
diff changeset
1195
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 502
diff changeset
1196 ;; Style (ie, typographical face) frobbing
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1197 (defun make-face-bold (face &optional locale tags exact-p)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1198 "Make FACE bold in LOCALE, if possible.
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1199 This will attempt to make the font bold for window-system locales and will
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1200 set the highlight flag for TTY locales.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1201
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1202 The actual behavior of this function is somewhat messy, in an attempt to
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1203 get more intuitive behavior in quite a lot of different circumstances. (You
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1204 might view this as indicative of design failures with specifiers, but in
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1205 fact almost all code that attempts to interface to humans and produce
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1206 \"intuitive\" results gets messy, particularly with a system as complicated
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1207 as specifiers, whose complexity results from an attempt to work well in
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1208 many different circumstances.)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1209
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1210 The meaning of LOCALE is the same as for `specifier-spec-list', i.e.:
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1211
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1212 -- If LOCALE is nil, omitted, or `all', this will attempt to \"frob\" all
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1213 font specifications for FACE to make them appear bold (i.e. the
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1214 specifications are replaced with equivalent specifications, where the
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1215 font names have been changed to the closest bold font).
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1216
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1217 -- If LOCALE is a locale type \(`buffer', `window', etc.), this frobs all
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1218 font specifications for locales of that type.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1219
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1220 -- If LOCALE is a particular locale, this frobs all font specifications for
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1221 that locale.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1222
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1223 If TAGS is given, this only processes instantiators whose tag set includes
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1224 all tags mentioned in TAGS. In addition, if EXACT-P is non-nil, only
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1225 instantiators whose tag set exactly matches TAGS are processed; otherwise,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1226 additional tags may be present in the instantiator's tag set.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1227
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1228 This function proceeeds in three stages.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1229
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1230 STAGE 1: Frob the settings that are already present.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1231 STAGE 2: (if called for) Ensure that *some* setting exists in the locale
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1232 that was given, finding it in various ways and frobbing it as in
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1233 stage 1. This ensures that there is an actual setting for
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1234 the locale, so you will get the expected buffer-local/frame-local
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1235 behavior -- changes to the global value, to other locales, won't
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1236 affect this locale, (b) the face will actually look bold in
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1237 the locale.
1137
c6facab13185 [xemacs-hg @ 2002-12-03 10:35:06 by didierv]
didierv
parents: 872
diff changeset
1238 STAGE 3: (if called for)
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1239
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1240 The way the frobbing works depends on the device type -- first on whether
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1241 or not it's TTY, and second, if it's a window-system device type, on which
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1242 particular window-system device type. For locales with a specific device
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1243 type, we do the frobbing in the context of that device type -- this means
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1244 that for TTY device types we set the highlight flag, and for window-system
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1245 device types we modify the font spec according to the rules for font specs
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1246 of that device type. For global locales, we may process both the highlight
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1247 flag and the font specs (depending on the device types compiled into this
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1248 XEmacs). When processing font specs, we check the tag set associated with
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1249 each font spec to see if it's specific to a particular device type; if so,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1250 we frob it in the context of that type, else we use the type of the current
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1251 device. (A hack, but works well in practice -- and if a new device is
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1252 created, we will automatically frob all the standard fonts to make sure
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1253 they display OK on that device.)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1254
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1255 If LOCALE is not a locale type, and both TAGS and EXACT-P are omitted, we
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1256 do further frobbing in an attempt to give more intuitive behavior.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1257
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1258 First, if there are no specifications in LOCALE (if LOCALE is `all', we act
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1259 as if it were `global' for this step), we do our utmost to put a
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1260 specification there; otherwise, this function will have no effect. For
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1261 device, frame, or window locales, the face's font is instantiated using the
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1262 locale as a domain, and the resulting font is frobbed and added back as a
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1263 specification for this locale. If LOCALE is `global', we retrieve the
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1264 fallback specs and frob them. If LOCALE is a buffer, things get tricky
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1265 since you can't instantiate a specifier in a buffer domain \(the buffer can
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1266 appear in multiple places, or in different places over time, so this
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1267 operation is not well-defined). We used to signal an error in this case,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1268 but now we instead try to do something logical so that we work somewhat
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1269 similarly to buffer-local variables. Specifically, we use
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1270 `get-buffer-window' to find a window viewing the buffer, and if there is
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1271 one, use this as a domain to instantiate the font, and frob the resulting
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1272 value. Otherwise, we use the selected window for the same purpose.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1273
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1274 Finally, if the frobbing didn't actually make the font look any different
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1275 in whatever domain we instantiated the font in (this happens, for example,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1276 if your font specification is already bold or has no bold equivalent; note
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1277 that in this step, we use the selected device in place of `global' or `all'
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1278 -- another hack, but works well in practice since there's usually only one
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1279 device), and the font currently looks like the font of the `default' face,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1280 it is set to inherit from the `bold' face.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1281
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1282 NOTE: For the other functions defined below, the identity of these two
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1283 standard faces mentioned in the previous paragraph, and the TTY properties
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1284 that are modified, may be different, and whether the TTY property or
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1285 properties are set or unset may be different. For example, for
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1286 `make-face-unitalic', the last sentence in the previous paragraph would
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1287 read \"... and the font currently looks like the font of the `italic' face,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1288 it is set to inherit from the `default' face.\", and the second sentence in
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1289 the first paragraph would read \"This will attempt to make the font
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1290 non-italic for window-system locales and will unset the underline flag for
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1291 TTY locales.\"
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1292
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1293 Here's a table indicating the behavior differences with the different
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1294 functions:
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1295
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1296 function face1 face2 tty-props tty-val
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1297 ----------------------------------------------------------------------------
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1298 make-face-bold default bold highlight t
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1299 make-face-italic default italic underline t
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1300 make-face-bold-italic default bold-italic highlight,underline t
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1301 make-face-unbold bold default highlight nil
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1302 make-face-unitalic italic default underline nil
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1303 "
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1304 (interactive (list (read-face-name "Make which face bold: ")))
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1305 (Face-frob-property face locale tags exact-p
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1306 'default 'bold 'font '(highlight)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1307 '(tty (lambda (x) t)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1308 x x-make-font-bold
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1309 gtk gtk-make-font-bold
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1310 mswindows mswindows-make-font-bold
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1311 msprinter mswindows-make-font-bold)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1312 '(([default] . [bold])
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1313 ([bold] . t)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1314 ([italic] . [bold-italic])
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1315 ([bold-italic] . t))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1316
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1317 (defun make-face-italic (face &optional locale tags exact-p)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1318 "Make FACE italic in LOCALE, if possible.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1319 This will attempt to make the font italic for X/MS Windows locales and
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1320 will set the underline flag for TTY locales. See `make-face-bold' for
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1321 the semantics of the LOCALE argument and for more specifics on exactly
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1322 how this function works."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1323 (interactive (list (read-face-name "Make which face italic: ")))
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1324 (Face-frob-property face locale tags exact-p
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1325 'default 'italic 'font '(underline)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1326 '(tty (lambda (x) t)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1327 x x-make-font-italic
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1328 gtk gtk-make-font-italic
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1329 mswindows mswindows-make-font-italic
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1330 msprinter mswindows-make-font-italic)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1331 '(([default] . [italic])
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1332 ([bold] . [bold-italic])
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1333 ([italic] . t)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1334 ([bold-italic] . t))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1335
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1336 (defun make-face-bold-italic (face &optional locale tags exact-p)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1337 "Make FACE bold and italic in LOCALE, if possible.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1338 This will attempt to make the font bold-italic for X/MS Windows
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1339 locales and will set the highlight and underline flags for TTY
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1340 locales. See `make-face-bold' for the semantics of the LOCALE
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1341 argument and for more specifics on exactly how this function works."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1342 (interactive (list (read-face-name "Make which face bold-italic: ")))
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1343 (Face-frob-property face locale tags exact-p
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1344 'default 'bold-italic 'font '(underline highlight)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1345 '(tty (lambda (x) t)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1346 x x-make-font-bold-italic
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1347 gtk gtk-make-font-bold-italic
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1348 mswindows mswindows-make-font-bold-italic
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1349 msprinter mswindows-make-font-bold-italic)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1350 '(([default] . [italic])
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1351 ([bold] . [bold-italic])
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1352 ([italic] . [bold-italic])
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1353 ([bold-italic] . t))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1354
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1355
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1356 (defun make-face-unbold (face &optional locale tags exact-p)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1357 "Make FACE non-bold in LOCALE, if possible.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1358 This will attempt to make the font non-bold for X/MS Windows locales
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1359 and will unset the highlight flag for TTY locales. See
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1360 `make-face-bold' for the semantics of the LOCALE argument and for more
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1361 specifics on exactly how this function works."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1362 (interactive (list (read-face-name "Make which face non-bold: ")))
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1363 (Face-frob-property face locale tags exact-p
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1364 'bold 'default 'font '(highlight)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1365 '(tty (lambda (x) nil)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1366 x x-make-font-unbold
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1367 gtk gtk-make-font-unbold
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1368 mswindows mswindows-make-font-unbold
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1369 msprinter mswindows-make-font-unbold)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1370 '(([default] . t)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1371 ([bold] . [default])
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1372 ([italic] . t)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1373 ([bold-italic] . [italic]))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1374
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1375 (defun make-face-unitalic (face &optional locale tags exact-p)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1376 "Make FACE non-italic in LOCALE, if possible.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1377 This will attempt to make the font non-italic for X/MS Windows locales
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1378 and will unset the underline flag for TTY locales. See
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1379 `make-face-bold' for the semantics of the LOCALE argument and for more
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1380 specifics on exactly how this function works."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1381 (interactive (list (read-face-name "Make which face non-italic: ")))
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1382 (Face-frob-property face locale tags exact-p
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1383 'italic 'default 'font '(underline)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1384 '(tty (lambda (x) nil)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1385 x x-make-font-unitalic
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1386 gtk gtk-make-font-unitalic
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1387 mswindows mswindows-make-font-unitalic
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1388 msprinter mswindows-make-font-unitalic)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1389 '(([default] . t)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1390 ([bold] . t)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1391 ([italic] . [default])
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1392 ([bold-italic] . [bold]))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1393
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1394
707
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 502
diff changeset
1395 ;; Size frobbing
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 502
diff changeset
1396 ;; Thx Jan Vroonhof, Ref xemacs-beta <87oflypbum.fsf@petteflet.ntlworld.com>
1137
c6facab13185 [xemacs-hg @ 2002-12-03 10:35:06 by didierv]
didierv
parents: 872
diff changeset
1397 ;; Jan had a separate helper function
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1398 (defun make-face-size (face size &optional locale tags exact-p)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1399 "Adjust FACE to SIZE in LOCALE, if possible."
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1400 (interactive (list (read-face-name "Set size of which face: ")
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1401 (read-number "Size to set: " t 10)))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1402 (Face-frob-property face locale tags exact-p
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1403 nil nil 'font nil
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1404 `(lambda (f d)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1405 ;; keep the dependency on font.el for now
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1406 (let ((fo (font-create-object f d)))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1407 (set-font-size fo ,size)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1408 (font-create-name fo d)))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1409 nil))
707
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 502
diff changeset
1410
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1411 ;; Why do the following two functions lose so badly in so many
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1412 ;; circumstances?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1413
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1414 (defun make-face-smaller (face &optional locale tags exact-p)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1415 "Make the font of FACE be smaller, if possible.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1416 LOCALE works as in `make-face-bold' et al., but the ``inheriting-
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1417 from-the-bold-face'' operations described there are not done
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1418 because they don't make sense in this context."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1419 (interactive (list (read-face-name "Shrink which face: ")))
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1420 (Face-frob-property face locale tags exact-p
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1421 nil nil 'font nil
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1422 '(x x-find-smaller-font
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1423 gtk gtk-find-smaller-font
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1424 mswindows mswindows-find-smaller-font
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1425 msprinter mswindows-find-smaller-font)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1426 nil))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1427
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1428 (defun make-face-larger (face &optional locale tags exact-p)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1429 "Make the font of FACE be larger, if possible.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1430 See `make-face-smaller' for the semantics of the LOCALE argument."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1431 (interactive (list (read-face-name "Enlarge which face: ")))
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1432 (Face-frob-property face locale tags exact-p
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1433 nil nil 'font nil
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1434 '(x x-find-larger-font
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1435 gtk gtk-find-larger-font
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1436 mswindows mswindows-find-larger-font
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1437 msprinter mswindows-find-larger-font)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1438 nil))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1439
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1440 (defun invert-face (face &optional locale)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1441 "Swap the foreground and background colors of the face."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1442 (interactive (list (read-face-name "Invert face: ")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1443 (if (valid-specifier-domain-p locale)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1444 (let ((foreface (face-foreground-instance face locale)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1445 (set-face-foreground face (face-background-instance face locale)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1446 locale)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1447 (set-face-background face foreface locale))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1448 (let ((forespec (copy-specifier (face-foreground face) nil locale)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1449 (copy-specifier (face-background face) (face-foreground face) locale)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1450 (copy-specifier forespec (face-background face) locale))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1451
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1452
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1453 ;;; Convenience functions
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1454
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1455 (defun face-ascent (face &optional domain charset)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1456 "Return the ascent of FACE in DOMAIN.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1457 See `face-property-instance' for the semantics of the DOMAIN argument."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1458 (font-ascent (face-font face) domain charset))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1459
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1460 (defun face-descent (face &optional domain charset)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1461 "Return the descent of FACE in DOMAIN.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1462 See `face-property-instance' for the semantics of the DOMAIN argument."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1463 (font-descent (face-font face) domain charset))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1464
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1465 (defun face-width (face &optional domain charset)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1466 "Return the width of FACE in DOMAIN.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1467 See `face-property-instance' for the semantics of the DOMAIN argument."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1468 (font-width (face-font face) domain charset))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1469
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1470 (defun face-height (face &optional domain charset)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1471 "Return the height of FACE in DOMAIN.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1472 See `face-property-instance' for the semantics of the DOMAIN argument."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1473 (+ (face-ascent face domain charset) (face-descent face domain charset)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1474
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1475 (defun face-proportional-p (face &optional domain charset)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1476 "Return t if FACE is proportional in DOMAIN.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1477 See `face-property-instance' for the semantics of the DOMAIN argument."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1478 (font-proportional-p (face-font face) domain charset))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1479
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1480
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1481 ;; Functions that used to be in cus-face.el, but logically go here.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1482
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1483 (defcustom frame-background-mode nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1484 "*The brightness of the background.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1485 Set this to the symbol dark if your background color is dark, light if
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1486 your background is light, or nil (default) if you want Emacs to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1487 examine the brightness for you."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1488 :group 'faces
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1489 :type '(choice (choice-item dark)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1490 (choice-item light)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1491 (choice-item :tag "Auto" nil)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1492
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1493 ;; The old variable that many people still have in .emacs files.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1494 (define-obsolete-variable-alias 'custom-background-mode
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1495 'frame-background-mode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1496
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1497 (defun get-frame-background-mode (frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1498 "Detect background mode for FRAME."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1499 (let* ((color-instance (face-background-instance 'default frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1500 (mode (condition-case nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1501 (if (< (apply '+ (color-instance-rgb-components
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1502 color-instance)) 65536)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1503 'dark 'light)
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1504 ;; Here, we get an error on a TTY (Return value from
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1505 ;; color-instance-rgb-components is nil), and on the
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1506 ;; initial stream device (Return value from
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1507 ;; face-background-instance is nil). As we don't have a
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1508 ;; good way of detecting whether a TTY is light or dark,
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1509 ;; we'll guess it's dark.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1510 (error 'dark))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1511 (set-frame-property frame 'background-mode mode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1512 mode))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1513
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1514 (defun extract-custom-frame-properties (frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1515 "Return a plist with the frame properties of FRAME used by custom."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1516 (list 'type (or (frame-property frame 'display-type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1517 (device-type (frame-device frame)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1518 'class (device-class (frame-device frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1519 'background (or frame-background-mode
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1520 (frame-property frame 'background-mode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1521 (get-frame-background-mode frame))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1522
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1523 (defcustom init-face-from-resources t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1524 "If non nil, attempt to initialize faces from the resource database."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1525 :group 'faces
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1526 :type 'boolean)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1527
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1528 ;; Old name, used by custom. Also, FSFmacs name.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1529 (defvaralias 'initialize-face-resources 'init-face-from-resources)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1530
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1531 ;; Make sure all custom setting are added with this tag so we can
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1532 ;; identify-them
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1533 (define-specifier-tag 'custom)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1534
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1535 (defun face-spec-set (face spec &optional frame tags)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1536 "Set FACE's face attributes according to the first matching entry in SPEC.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1537 If optional FRAME is non-nil, set it for that frame only.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1538 If it is nil, then apply SPEC to each frame individually.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1539 See `defface' for information about SPEC."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1540 (if frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1541 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1542 (reset-face face frame tags)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1543 (face-display-set face spec frame tags)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1544 (init-face-from-resources face frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1545 (let ((frames (relevant-custom-frames)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1546 (reset-face face nil tags)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1547 ;; This should not be needed. We only remove our own specifiers
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1548 ;; (if (and (eq 'default face) (featurep 'x))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1549 ;; (x-init-global-faces))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1550 (face-display-set face spec nil tags)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1551 (while frames
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1552 (face-display-set face spec (car frames) tags)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1553 (pop frames))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1554 (init-face-from-resources face))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1555
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1556 (defun face-display-set (face spec &optional frame tags)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1557 "Set FACE to the attributes to the first matching entry in SPEC.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1558 Iff optional FRAME is non-nil, set it for that frame only.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1559 See `defface' for information about SPEC."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1560 (while spec
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1561 (let ((display (caar spec))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1562 (atts (cadar spec)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1563 (pop spec)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1564 (when (face-spec-set-match-display display frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1565 ;; Avoid creating frame local duplicates of the global face.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1566 (unless (and frame (eq display (get face 'custom-face-display)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1567 (apply 'face-custom-attributes-set face frame tags atts))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1568 (unless frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1569 (put face 'custom-face-display display))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1570 (setq spec nil)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1571
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1572 (defvar default-custom-frame-properties nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1573 "The frame properties used for the global faces.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1574 Frames not matching these properties should have frame local faces.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1575 The value should be nil, if uninitialized, or a plist otherwise.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1576 See `defface' for a list of valid keys and values for the plist.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1577
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1578 (defun get-custom-frame-properties (&optional frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1579 "Return a plist with the frame properties of FRAME used by custom.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1580 If FRAME is nil, return the default frame properties."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1581 (cond (frame
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1582 ;; Try to get from cache.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1583 (let ((cache (frame-property frame 'custom-properties)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1584 (unless cache
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1585 ;; Oh well, get it then.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1586 (setq cache (extract-custom-frame-properties frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1587 ;; and cache it...
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1588 (set-frame-property frame 'custom-properties cache))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1589 cache))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1590 (default-custom-frame-properties)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1591 (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1592 (setq default-custom-frame-properties
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1593 (extract-custom-frame-properties (selected-frame))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1594
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1595 (defun face-spec-update-all-matching (spec display plist)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1596 "Update all entries in the face spec that could match display to
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1597 have the entries from the new plist and return the new spec."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1598 (mapcar
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1599 (lambda (e)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1600 (let ((entries (car e))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1601 (options (cadr e))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1602 (match t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1603 dplist
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1604 (new-options plist)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1605 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1606 (unless (eq display t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1607 (mapc (lambda (arg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1608 (setq dplist (plist-put dplist (car arg) (cadr arg))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1609 display))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1610 (unless (eq entries t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1611 (mapc (lambda (arg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1612 (setq match (and match (eq (cadr arg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1613 (plist-get
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1614 dplist (car arg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1615 (cadr arg))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1616 entries))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1617 (if (not match)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1618 e
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1619 (while new-options
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1620 (setq options
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1621 (plist-put options (car new-options) (cadr new-options)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1622 (setq new-options (cddr new-options)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1623 (list entries options))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1624 (copy-sequence spec)))
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1625
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
1626
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1627
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1628 (defun face-spec-set-match-display (display &optional frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1629 "Return non-nil if DISPLAY matches FRAME.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1630 DISPLAY is part of a spec such as can be used in `defface'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1631 If FRAME is nil or omitted, the selected frame is used."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1632 (if (eq display t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1633 t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1634 (let* ((props (get-custom-frame-properties frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1635 (type (plist-get props 'type))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1636 (class (plist-get props 'class))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1637 (background (plist-get props 'background))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1638 (match t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1639 (entries display)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1640 entry req options)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1641 (while (and entries match)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1642 (setq entry (car entries)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1643 entries (cdr entries)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1644 req (car entry)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1645 options (cdr entry)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1646 match (case req
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1647 (type (memq type options))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1648 (class (memq class options))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1649 (background (memq background options))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1650 (t (warn "Unknown req `%S' with options `%S'"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1651 req options)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1652 nil))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1653 match)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1654
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1655 (defun relevant-custom-frames ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1656 "List of frames whose custom properties differ from the default."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1657 (let ((relevant nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1658 (default (get-custom-frame-properties))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1659 (frames (frame-list))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1660 frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1661 (while frames
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1662 (setq frame (car frames)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1663 frames (cdr frames))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1664 (unless (equal default (get-custom-frame-properties frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1665 (push frame relevant)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1666 relevant))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1667
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1668 (defun initialize-custom-faces (&optional frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1669 "Initialize all custom faces for FRAME.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1670 If FRAME is nil or omitted, initialize them for all frames."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1671 (mapc (lambda (symbol)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1672 (let ((spec (or (get symbol 'saved-face)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1673 (get symbol 'face-defface-spec))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1674 (when spec
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1675 ;; No need to init-face-from-resources -- code in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1676 ;; `init-frame-faces' does it already.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1677 (face-display-set symbol spec frame))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1678 (face-list)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1679
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1680 (defun custom-initialize-frame (frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1681 "Initialize frame-local custom faces for FRAME if necessary."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1682 (unless (equal (get-custom-frame-properties)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1683 (get-custom-frame-properties frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1684 (initialize-custom-faces frame)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1685
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1686 (defun startup-initialize-custom-faces ()
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1687 "Reset faces created by defface. Only called at startup.
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1688 Don't use this function in your program."
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1689 (when default-custom-frame-properties
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1690 ;; Reset default value to the actual frame, not stream.
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1691 (setq default-custom-frame-properties
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1692 (extract-custom-frame-properties (selected-frame)))
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1693 ;; like initialize-custom-faces but removes property first.
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1694 (mapc (lambda (symbol)
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1695 (let ((spec (or (get symbol 'saved-face)
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1696 (get symbol 'face-defface-spec))))
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1697 (when spec
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1698 ;; Reset faces created during auto-autoloads loading.
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1699 (reset-face symbol)
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1700 ;; And set it according to the spec.
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1701 (face-display-set symbol spec nil))))
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1702 (face-list))))
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1703
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1704
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1705 (defun make-empty-face (name &optional doc-string temporary)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1706 "Like `make-face', but doesn't query the resource database."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1707 (let ((init-face-from-resources nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1708 (make-face name doc-string temporary)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1709
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1710 (defun init-face-from-resources (face &optional locale)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1711 "Initialize FACE from the resource database.
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
1712 If LOCALE is specified, it should be a frame, device, or `global', and
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1713 the face will be resourced over that locale. Otherwise, the face will
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1714 be resourced over all possible locales (i.e. all frames, all devices,
3027
7efd3a9bbcfb [xemacs-hg @ 2005-10-25 11:28:23 by ben]
ben
parents: 2703
diff changeset
1715 and `global')."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1716 (cond ((null init-face-from-resources)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1717 ;; Do nothing.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1718 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1719 ((not locale)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1720 ;; Global, set for all frames.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1721 (progn
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1722 (init-face-from-resources face 'global)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1723 (let ((devices (device-list)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1724 (while devices
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1725 (init-face-from-resources face (car devices))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1726 (setq devices (cdr devices))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1727 (let ((frames (frame-list)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1728 (while frames
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1729 (init-face-from-resources face (car frames))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1730 (setq frames (cdr frames))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1731 (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1732 ;; Specific.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1733 (let ((devtype (cond ((devicep locale) (device-type locale))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1734 ((framep locale) (frame-type locale))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1735 (t nil))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1736 (cond ((or (and (not devtype) (featurep 'x)) (eq 'x devtype))
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 484
diff changeset
1737 (declare-fboundp (x-init-face-from-resources face locale)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1738 ((or (not devtype) (eq 'tty devtype))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1739 ;; Nothing to do for TTYs?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1740 ))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1741
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1742 (defun init-device-faces (device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1743 ;; First, add any device-local face resources.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1744 (when init-face-from-resources
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1745 (loop for face in (face-list) do
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1746 (init-face-from-resources face device))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1747 ;; Then do any device-specific initialization.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1748 (cond ((eq 'x (device-type device))
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 484
diff changeset
1749 (declare-fboundp (x-init-device-faces device)))
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 452
diff changeset
1750 ((eq 'gtk (device-type device))
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 484
diff changeset
1751 (declare-fboundp (gtk-init-device-faces device)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1752 ((eq 'mswindows (device-type device))
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 484
diff changeset
1753 (declare-fboundp (mswindows-init-device-faces device)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1754 ;; Nothing to do for TTYs?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1755 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1756 (or (eq 'stream (device-type device))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1757 (init-other-random-faces device))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1758
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1759 (defun init-frame-faces (frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1760 (when init-face-from-resources
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1761 ;; First, add any frame-local face resources.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1762 (loop for face in (face-list) do
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1763 (init-face-from-resources face frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1764 ;; Then do any frame-specific initialization.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1765 (cond ((eq 'x (frame-type frame))
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 484
diff changeset
1766 (declare-fboundp (x-init-frame-faces frame)))
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 452
diff changeset
1767 ((eq 'gtk (frame-type frame))
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 484
diff changeset
1768 (declare-fboundp (gtk-init-frame-faces frame)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1769 ((eq 'mswindows (frame-type frame))
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 484
diff changeset
1770 (declare-fboundp (mswindows-init-frame-faces frame)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1771 ;; Is there anything which should be done for TTY's?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1772 )))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1773
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1774 ;; Called when the first device created.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1775
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1776 (defun init-global-faces (device)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1777 (let ((Face-frob-property-device-considered-current device))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1778 ;; Look for global face resources.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1779 (loop for face in (face-list) do
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1780 (init-face-from-resources face 'global))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1781 ;; Further frobbing.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1782 (and (featurep 'x) (declare-fboundp (x-init-global-faces)))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1783 (and (featurep 'gtk) (declare-fboundp (gtk-init-global-faces)))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1784 (and (featurep 'mswindows) (declare-fboundp (mswindows-init-global-faces)))
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 452
diff changeset
1785
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1786 ;; for bold and the like, make the global specification be bold etc.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1787 ;; if the user didn't already specify a value. These will also be
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1788 ;; frobbed further in init-other-random-faces.
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1789 (unless (face-font 'bold 'global)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1790 (make-face-bold 'bold 'global))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1791 ;;
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1792 (unless (face-font 'italic 'global)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1793 (make-face-italic 'italic 'global))
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1794 ;;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1795 (unless (face-font 'bold-italic 'global)
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1796 (make-face-bold-italic 'bold-italic 'global)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1797 (unless (face-font 'bold-italic 'global)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1798 (copy-face 'bold 'bold-italic)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1799 (make-face-italic 'bold-italic)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1800
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1801 (when (face-equal 'bold 'bold-italic device)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1802 (copy-face 'italic 'bold-italic)
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 853
diff changeset
1803 (make-face-bold 'bold-italic))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1804
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1805
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1806 ;; These warnings are there for a reason. Just specify your fonts
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1807 ;; correctly. Deal with it. Additionally, one can use
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1808 ;; `log-warning-minimum-level' instead of this.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1809 ;(defvar inhibit-font-complaints nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1810 ; "Whether to suppress complaints about incomplete sets of fonts.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1811
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1812 (defun face-complain-about-font (face device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1813 (if (symbolp face) (setq face (symbol-name face)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1814 ;; (if (not inhibit-font-complaints)
707
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 502
diff changeset
1815 ;; complaining for printers is generally annoying.
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 502
diff changeset
1816 (unless (device-printer-p device)
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 502
diff changeset
1817 (display-warning
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 502
diff changeset
1818 'font
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 502
diff changeset
1819 (let ((default-name (face-font-name 'default device)))
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 502
diff changeset
1820 (format "%s: couldn't deduce %s %s version of the font
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1821 %S.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1822
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1823 Please specify X resources to make the %s face
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1824 visually distinguishable from the default face.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1825 For example, you could add one of the following to $HOME/Emacs:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1826
2703
2f2d12f4f93a [xemacs-hg @ 2005-03-31 11:28:41 by aidan]
aidan
parents: 1139
diff changeset
1827 XEmacs.%s.attributeFont: -dt-*-medium-i-*
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1828 or
2703
2f2d12f4f93a [xemacs-hg @ 2005-03-31 11:28:41 by aidan]
aidan
parents: 1139
diff changeset
1829 XEmacs.%s.attributeForeground: hotpink\n"
707
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 502
diff changeset
1830 invocation-name
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 502
diff changeset
1831 (if (string-match "\\`[aeiouAEIOU]" face) "an" "a")
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 502
diff changeset
1832 face
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 502
diff changeset
1833 default-name
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 502
diff changeset
1834 face
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 502
diff changeset
1835 face
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 502
diff changeset
1836 face
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 502
diff changeset
1837 )))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1838
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1839
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1840 ;; #### This is quite a mess. We should use the custom mechanism for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1841 ;; most of this stuff. Currently we don't do it, because Custom
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1842 ;; doesn't use specifiers (yet.) FSF does it the Right Way.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1843
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1844 ;; For instance, the definition of `bold' should be something like
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1845 ;; (defface bold ((t (:bold t))) "Bold text.") -- and `:bold t' should
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1846 ;; make sure that everything works properly.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1847
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1848 (defun init-other-random-faces (device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1849 "Initialize the colors and fonts of the bold, italic, bold-italic,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1850 zmacs-region, list-mode-item-selected, highlight, primary-selection,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1851 secondary-selection, and isearch faces when each device is created. If
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1852 you want to add code to do stuff like this, use the create-device-hook."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1853
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1854 ;; try to make 'bold look different from the default on this device.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1855 ;; If that doesn't work at all, then issue a warning.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1856 (unless (face-differs-from-default-p 'bold device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1857 (make-face-bold 'bold device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1858 (unless (face-differs-from-default-p 'bold device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1859 (make-face-unbold 'bold device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1860 (unless (face-differs-from-default-p 'bold device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1861 ;; the luser specified one of the bogus font names
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1862 (face-complain-about-font 'bold device))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1863
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1864 ;; Similar for italic.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1865 ;; It's unreasonable to expect to be able to make a font italic all
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1866 ;; the time. For many languages, italic is an alien concept.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1867 ;; Basically, because italic is not a globally meaningful concept,
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1868 ;; the use of the italic face should really be obsoleted.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1869
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1870 ;; I disagree with above. In many languages, the concept of capital
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1871 ;; letters is just as alien, and yet we use them. Italic is here to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1872 ;; stay. -hniksic
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1873
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1874 ;; In a Solaris Japanese environment, there just aren't any italic
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1875 ;; fonts - period. CDE recognizes this reality, and fonts
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1876 ;; -dt-interface user-medium-r-normal-*-*-*-*-*-*-*-*-* don't come
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1877 ;; in italic versions. So we first try to make the font bold before
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1878 ;; complaining.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1879 (unless (face-differs-from-default-p 'italic device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1880 (make-face-italic 'italic device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1881 (unless (face-differs-from-default-p 'italic device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1882 (make-face-bold 'italic device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1883 (unless (face-differs-from-default-p 'italic device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1884 (face-complain-about-font 'italic device))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1885
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1886 ;; similar for bold-italic.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1887 (unless (face-differs-from-default-p 'bold-italic device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1888 (make-face-bold-italic 'bold-italic device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1889 ;; if we couldn't get a bold-italic version, try just bold.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1890 (unless (face-differs-from-default-p 'bold-italic device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1891 (make-face-bold 'bold-italic device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1892 ;; if we couldn't get bold or bold-italic, then that's probably because
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1893 ;; the default font is bold, so make the `bold-italic' face be unbold.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1894 (unless (face-differs-from-default-p 'bold-italic device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1895 (make-face-unbold 'bold-italic device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1896 (make-face-italic 'bold-italic device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1897 (unless (face-differs-from-default-p 'bold-italic device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1898 ;; if that didn't work, try plain italic
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1899 ;; (can this ever happen? what the hell.)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1900 (make-face-italic 'bold-italic device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1901 (unless (face-differs-from-default-p 'bold-italic device)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1902 ;; then bitch and moan.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1903 (face-complain-about-font 'bold-italic device))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1904
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1905 ;; Set the text-cursor colors unless already specified.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1906 (when (and (not (eq 'tty (device-type device)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1907 (not (face-background 'text-cursor 'global))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1908 (face-property-equal 'text-cursor 'default 'background device))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1909 (set-face-background 'text-cursor [default foreground] 'global
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1910 nil 'append))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1911 (when (and (not (eq 'tty (device-type device)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1912 (not (face-foreground 'text-cursor 'global))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1913 (face-property-equal 'text-cursor 'default 'foreground device))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1914 (set-face-foreground 'text-cursor [default background] 'global
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1915 nil 'append))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1916 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1917
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1918 ;; New function with 20.1, suggested by Per Abrahamsen, coded by Kyle
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1919 ;; Jones and Hrvoje Niksic.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1920 (defun set-face-stipple (face pixmap &optional frame)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1921 "Change the stipple pixmap of FACE to PIXMAP.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1922 This is an Emacs compatibility function; consider using
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1923 set-face-background-pixmap instead.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1924
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1925 PIXMAP should be a string, the name of a file of pixmap data.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1926 The directories listed in the variables `x-bitmap-file-path' and
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1927 `mswindows-bitmap-file-path' under X and MS Windows respectively
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1928 are searched.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1929
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1930 Alternatively, PIXMAP may be a list of the form (WIDTH HEIGHT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1931 DATA) where WIDTH and HEIGHT are the size in pixels, and DATA is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1932 a string, containing the raw bits of the bitmap. XBM data is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1933 expected in this case, other types of image data will not work.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1934
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1935 If the optional FRAME argument is provided, change only
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1936 in that frame; otherwise change each frame."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1937 (while (not (find-face face))
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
1938 (setq face (wrong-type-argument 'facep face)))
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 484
diff changeset
1939 (let ((bitmap-path
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 484
diff changeset
1940 (ecase (console-type)
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 484
diff changeset
1941 (x (declare-boundp x-bitmap-file-path))
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 484
diff changeset
1942 (mswindows (declare-boundp mswindows-bitmap-file-path))))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1943 instantiator)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1944 (while
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1945 (null
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1946 (setq instantiator
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1947 (cond ((stringp pixmap)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1948 (let ((file (if (file-name-absolute-p pixmap)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1949 pixmap
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1950 (locate-file pixmap bitmap-path
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1951 '(".xbm" "")))))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1952 (and file
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1953 `[xbm :file ,file])))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1954 ((and (listp pixmap) (= (length pixmap) 3))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1955 `[xbm :data ,pixmap])
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1956 (t nil))))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1957 ;; We're signaling a continuable error; let's make sure the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1958 ;; function `stipple-pixmap-p' at least exists.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1959 (flet ((stipple-pixmap-p (pixmap)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1960 (or (stringp pixmap)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1961 (and (listp pixmap) (= (length pixmap) 3)))))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1962 (setq pixmap (signal 'wrong-type-argument
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1963 (list 'stipple-pixmap-p pixmap)))))
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
1964 (check-type frame (or null frame))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1965 (set-face-background-pixmap face instantiator frame)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1966
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1967
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1968 ;; Create the remaining standard faces now. This way, packages that we dump
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1969 ;; can reference these faces as parents.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1970 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1971 ;; The default, modeline, left-margin, right-margin, text-cursor,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1972 ;; and pointer faces are created in C.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1973
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1974 (make-face 'bold "Bold text.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1975 (make-face 'italic "Italic text.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1976 (make-face 'bold-italic "Bold-italic text.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1977 (make-face 'underline "Underlined text.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1978 (or (face-differs-from-default-p 'underline)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1979 (set-face-underline-p 'underline t 'global '(default)))
735
b63242824a7a [xemacs-hg @ 2002-01-26 22:02:52 by youngs]
youngs
parents: 711
diff changeset
1980 (make-face 'zmacs-region "Used on highlighted region between point and mark.")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1981 (make-face 'isearch "Used on region matched by isearch.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1982 (make-face 'isearch-secondary "Face to use for highlighting all matches.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1983 (make-face 'list-mode-item-selected
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1984 "Face for the selected list item in list-mode.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1985 (make-face 'highlight "Highlight face.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1986 (make-face 'primary-selection "Primary selection face.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1987 (make-face 'secondary-selection "Secondary selection face.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1988
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1989 ;; Several useful color faces.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1990 (dolist (color '(red green blue yellow))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1991 (make-face color (concat (symbol-name color) " text."))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1992 (set-face-foreground color (symbol-name color) nil 'color))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1993
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1994 ;; Make some useful faces. This happens very early, before creating
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1995 ;; the first non-stream device.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1996
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1997 (set-face-background 'text-cursor
711
5be46355cc42 [xemacs-hg @ 2001-12-23 01:01:45 by wmperry]
wmperry
parents: 707
diff changeset
1998 '(((win default) . "Red3"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1999 'global)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2000
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2001 ;; some older X servers don't recognize "darkseagreen2"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2002 (set-face-background 'highlight
711
5be46355cc42 [xemacs-hg @ 2001-12-23 01:01:45 by wmperry]
wmperry
parents: 707
diff changeset
2003 '(((win default color) . "darkseagreen2")
5be46355cc42 [xemacs-hg @ 2001-12-23 01:01:45 by wmperry]
wmperry
parents: 707
diff changeset
2004 ((win default color) . "green")
5be46355cc42 [xemacs-hg @ 2001-12-23 01:01:45 by wmperry]
wmperry
parents: 707
diff changeset
2005 ((win default grayscale) . "gray53"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2006 'global)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2007 (set-face-background-pixmap 'highlight
711
5be46355cc42 [xemacs-hg @ 2001-12-23 01:01:45 by wmperry]
wmperry
parents: 707
diff changeset
2008 '(((win default mono) . "gray1"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2009 'global)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2010
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2011 (set-face-background 'zmacs-region
711
5be46355cc42 [xemacs-hg @ 2001-12-23 01:01:45 by wmperry]
wmperry
parents: 707
diff changeset
2012 '(((win default color) . "gray65")
5be46355cc42 [xemacs-hg @ 2001-12-23 01:01:45 by wmperry]
wmperry
parents: 707
diff changeset
2013 ((win default grayscale) . "gray65"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2014 'global)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2015 (set-face-background-pixmap 'zmacs-region
711
5be46355cc42 [xemacs-hg @ 2001-12-23 01:01:45 by wmperry]
wmperry
parents: 707
diff changeset
2016 '(((win default mono) . "gray3"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2017 'global)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2018
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2019 (set-face-background 'list-mode-item-selected
711
5be46355cc42 [xemacs-hg @ 2001-12-23 01:01:45 by wmperry]
wmperry
parents: 707
diff changeset
2020 '(((win default color) . "gray68")
5be46355cc42 [xemacs-hg @ 2001-12-23 01:01:45 by wmperry]
wmperry
parents: 707
diff changeset
2021 ((win default grayscale) . "gray68")
5be46355cc42 [xemacs-hg @ 2001-12-23 01:01:45 by wmperry]
wmperry
parents: 707
diff changeset
2022 ((win default mono) . [default foreground]))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2023 'global)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2024 (set-face-foreground 'list-mode-item-selected
711
5be46355cc42 [xemacs-hg @ 2001-12-23 01:01:45 by wmperry]
wmperry
parents: 707
diff changeset
2025 '(((win default mono) . [default background]))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2026 'global)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2027
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2028 (set-face-background 'primary-selection
711
5be46355cc42 [xemacs-hg @ 2001-12-23 01:01:45 by wmperry]
wmperry
parents: 707
diff changeset
2029 '(((win default color) . "gray65")
5be46355cc42 [xemacs-hg @ 2001-12-23 01:01:45 by wmperry]
wmperry
parents: 707
diff changeset
2030 ((win default grayscale) . "gray65"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2031 'global)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2032 (set-face-background-pixmap 'primary-selection
711
5be46355cc42 [xemacs-hg @ 2001-12-23 01:01:45 by wmperry]
wmperry
parents: 707
diff changeset
2033 '(((win default mono) . "gray3"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2034 'global)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2035
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2036 (set-face-background 'secondary-selection
711
5be46355cc42 [xemacs-hg @ 2001-12-23 01:01:45 by wmperry]
wmperry
parents: 707
diff changeset
2037 '(((win default color) . "paleturquoise")
5be46355cc42 [xemacs-hg @ 2001-12-23 01:01:45 by wmperry]
wmperry
parents: 707
diff changeset
2038 ((win default color) . "green")
5be46355cc42 [xemacs-hg @ 2001-12-23 01:01:45 by wmperry]
wmperry
parents: 707
diff changeset
2039 ((win default grayscale) . "gray53"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2040 'global)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2041 (set-face-background-pixmap 'secondary-selection
711
5be46355cc42 [xemacs-hg @ 2001-12-23 01:01:45 by wmperry]
wmperry
parents: 707
diff changeset
2042 '(((win default mono) . "gray1"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2043 'global)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2044
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2045 (set-face-background 'isearch
711
5be46355cc42 [xemacs-hg @ 2001-12-23 01:01:45 by wmperry]
wmperry
parents: 707
diff changeset
2046 '(((win default color) . "paleturquoise")
5be46355cc42 [xemacs-hg @ 2001-12-23 01:01:45 by wmperry]
wmperry
parents: 707
diff changeset
2047 ((win default color) . "green"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2048 'global)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2049
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2050 ;; #### This should really, I mean *really*, be converted to some form
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2051 ;; of `defface' one day.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2052 (set-face-foreground 'isearch-secondary
711
5be46355cc42 [xemacs-hg @ 2001-12-23 01:01:45 by wmperry]
wmperry
parents: 707
diff changeset
2053 '(((win default color) . "red3"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2054 'global)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2055
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2056 ;; Define some logical color names to be used when reading the pixmap files.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2057 (if (featurep 'xpm)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2058 (setq xpm-color-symbols
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2059 (list
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2060 '("foreground" (face-foreground 'default))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2061 '("background" (face-background 'default))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2062 '("backgroundToolBarColor"
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2063 (or
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2064 (and
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2065 (featurep 'x)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2066 (x-get-resource "backgroundToolBarColor"
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2067 "BackgroundToolBarColor" 'string
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2068 nil nil 'warn))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2069
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2070 (face-background 'toolbar)))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2071 '("foregroundToolBarColor"
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2072 (or
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2073 (and
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2074 (featurep 'x)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2075 (x-get-resource "foregroundToolBarColor"
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2076 "ForegroundToolBarColor" 'string
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2077 nil nil 'warn))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2078 (face-foreground 'toolbar)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2079 )))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2080
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2081 (when (featurep 'tty)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2082 (set-face-highlight-p 'bold t 'global '(default tty))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2083 (set-face-underline-p 'italic t 'global '(default tty))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2084 (set-face-highlight-p 'bold-italic t 'global '(default tty))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2085 (set-face-underline-p 'bold-italic t 'global '(default tty))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2086 (set-face-highlight-p 'highlight t 'global '(default tty))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2087 (set-face-reverse-p 'text-cursor t 'global '(default tty))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2088 (set-face-reverse-p 'modeline t 'global '(default tty))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2089 (set-face-reverse-p 'zmacs-region t 'global '(default tty))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2090 (set-face-reverse-p 'primary-selection t 'global '(default tty))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2091 (set-face-underline-p 'secondary-selection t 'global '(default tty))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2092 (set-face-reverse-p 'list-mode-item-selected t 'global '(default tty))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2093 (set-face-reverse-p 'isearch t 'global '(default tty))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2094 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2095
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2096 ;;; faces.el ends here