Mercurial > emacs
annotate src/xfaces.c @ 90054:f2ebccfa87d4
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-74
Merge from emacs--cvs-trunk--0
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-709
Update from CVS: src/indent.c (Fvertical_motion): Fix last change.
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-710
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-715
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-716
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-74
Update from CVS
| author | Miles Bader <miles@gnu.org> |
|---|---|
| date | Wed, 08 Dec 2004 05:02:30 +0000 |
| parents | cb7f41387eb3 b1e7465ce5fc |
| children | 95879cc1ed20 |
| rev | line source |
|---|---|
| 24995 | 1 /* xfaces.c -- "Face" primitives. |
|
54766
b87089cc7e4c
(face_color_supported_p): Fix compilation without X11.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53901
diff
changeset
|
2 Copyright (C) 1993, 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004 |
|
35369
aca9ba55cfcc
(x_face_list_fonts): Call x_list_fonts with SIZE -1,
Gerd Moellmann <gerd@gnu.org>
parents:
35228
diff
changeset
|
3 Free Software Foundation. |
| 2342 | 4 |
| 2336 | 5 This file is part of GNU Emacs. |
| 6 | |
| 7 GNU Emacs is free software; you can redistribute it and/or modify | |
| 8 it under the terms of the GNU General Public License as published by | |
| 2342 | 9 the Free Software Foundation; either version 2, or (at your option) |
| 2336 | 10 any later version. |
| 11 | |
| 12 GNU Emacs is distributed in the hope that it will be useful, | |
| 13 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 GNU General Public License for more details. | |
| 16 | |
| 17 You should have received a copy of the GNU General Public License | |
| 18 along with GNU Emacs; see the file COPYING. If not, write to | |
|
14186
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
14090
diff
changeset
|
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
|
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
14090
diff
changeset
|
20 Boston, MA 02111-1307, USA. */ |
| 2336 | 21 |
| 24995 | 22 /* New face implementation by Gerd Moellmann <gerd@gnu.org>. */ |
| 23 | |
| 24 /* Faces. | |
| 25 | |
| 26 When using Emacs with X, the display style of characters can be | |
| 27 changed by defining `faces'. Each face can specify the following | |
| 28 display attributes: | |
| 29 | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
30 1. Font family name. |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
31 |
| 24995 | 32 2. Relative proportionate width, aka character set width or set |
| 33 width (swidth), e.g. `semi-compressed'. | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
34 |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
35 3. Font height in 1/10pt. |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
36 |
| 24995 | 37 4. Font weight, e.g. `bold'. |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
38 |
| 24995 | 39 5. Font slant, e.g. `italic'. |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
40 |
| 24995 | 41 6. Foreground color. |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
42 |
| 24995 | 43 7. Background color. |
| 44 | |
| 45 8. Whether or not characters should be underlined, and in what color. | |
| 46 | |
| 47 9. Whether or not characters should be displayed in inverse video. | |
| 48 | |
| 49 10. A background stipple, a bitmap. | |
| 50 | |
| 51 11. Whether or not characters should be overlined, and in what color. | |
| 52 | |
| 53 12. Whether or not characters should be strike-through, and in what | |
| 54 color. | |
| 55 | |
| 56 13. Whether or not a box should be drawn around characters, the box | |
| 57 type, and, for simple boxes, in what color. | |
| 58 | |
|
89047
3b6234eb229c
(QCfontset): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88939
diff
changeset
|
59 14. Font pattern, or nil. This is a special attribute. |
| 36946 | 60 When this attribute is specified, the face uses a font opened by |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
61 that pattern as is. In addition, all the other font-related |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
62 attributes (1st thru 5th) are generated from the opened font name. |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
63 On the other hand, if one of the other font-related attributes are |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
64 specified, this attribute is set to nil. In that case, the face |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
65 doesn't inherit this attribute from the `default' face, and uses a |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
66 font determined by the other attributes (those may be inherited |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
67 from the `default' face). |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
68 |
| 31178 | 69 15. A face name or list of face names from which to inherit attributes. |
| 70 | |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
71 16. A specified average font width, which is invisible from Lisp, |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
72 and is used to ensure that a font specified on the command line, |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
73 for example, can be matched exactly. |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
74 |
|
89047
3b6234eb229c
(QCfontset): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88939
diff
changeset
|
75 17. A fontset name. |
|
3b6234eb229c
(QCfontset): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88939
diff
changeset
|
76 |
| 24995 | 77 Faces are frame-local by nature because Emacs allows to define the |
| 78 same named face (face names are symbols) differently for different | |
| 79 frames. Each frame has an alist of face definitions for all named | |
| 80 faces. The value of a named face in such an alist is a Lisp vector | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
81 with the symbol `face' in slot 0, and a slot for each of the face |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
82 attributes mentioned above. |
| 24995 | 83 |
| 84 There is also a global face alist `Vface_new_frame_defaults'. Face | |
| 85 definitions from this list are used to initialize faces of newly | |
| 86 created frames. | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
87 |
| 24995 | 88 A face doesn't have to specify all attributes. Those not specified |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
89 have a value of `unspecified'. Faces specifying all attributes but |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
90 the 14th are called `fully-specified'. |
| 24995 | 91 |
| 92 | |
| 93 Face merging. | |
| 94 | |
| 95 The display style of a given character in the text is determined by | |
| 96 combining several faces. This process is called `face merging'. | |
| 97 Any aspect of the display style that isn't specified by overlays or | |
| 98 text properties is taken from the `default' face. Since it is made | |
| 99 sure that the default face is always fully-specified, face merging | |
| 100 always results in a fully-specified face. | |
| 101 | |
| 102 | |
| 103 Face realization. | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
104 |
| 24995 | 105 After all face attributes for a character have been determined by |
| 106 merging faces of that character, that face is `realized'. The | |
| 107 realization process maps face attributes to what is physically | |
| 108 available on the system where Emacs runs. The result is a | |
| 109 `realized face' in form of a struct face which is stored in the | |
| 110 face cache of the frame on which it was realized. | |
| 111 | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
112 Face realization is done in the context of the character to display |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
113 because different fonts may be used for different characters. In |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
114 other words, for characters that have different font |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
115 specifications, different realized faces are needed to display |
| 24995 | 116 them. |
| 117 | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
118 Font specification is done by fontsets. See the comment in |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
119 fontset.c for the details. In the current implementation, all ASCII |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
120 characters share the same font in a fontset. |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
121 |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
122 Faces are at first realized for ASCII characters, and, at that |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
123 time, assigned a specific realized fontset. Hereafter, we call |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
124 such a face as `ASCII face'. When a face for a multibyte character |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
125 is realized, it inherits (thus shares) a fontset of an ASCII face |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
126 that has the same attributes other than font-related ones. |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
127 |
|
89047
3b6234eb229c
(QCfontset): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88939
diff
changeset
|
128 Thus, all realized faces have a realized fontset. |
| 24995 | 129 |
| 130 | |
| 131 Unibyte text. | |
| 132 | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
133 Unibyte text (i.e. raw 8-bit characters) is displayed with the same |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
134 font as ASCII characters. That is because it is expected that |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
135 unibyte text users specify a font that is suitable both for ASCII |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
136 and raw 8-bit characters. |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
137 |
| 24995 | 138 |
| 139 Font selection. | |
| 140 | |
| 141 Font selection tries to find the best available matching font for a | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
142 given (character, face) combination. |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
143 |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
144 If the face specifies a fontset name, that fontset determines a |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
145 pattern for fonts of the given character. If the face specifies a |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
146 font name or the other font-related attributes, a fontset is |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
147 realized from the default fontset. In that case, that |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
148 specification determines a pattern for ASCII characters and the |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
149 default fontset determines a pattern for multibyte characters. |
| 24995 | 150 |
| 151 Available fonts on the system on which Emacs runs are then matched | |
| 152 against the font pattern. The result of font selection is the best | |
| 153 match for the given face attributes in this font list. | |
| 154 | |
| 155 Font selection can be influenced by the user. | |
| 156 | |
| 157 1. The user can specify the relative importance he gives the face | |
| 158 attributes width, height, weight, and slant by setting | |
| 159 face-font-selection-order (faces.el) to a list of face attribute | |
| 160 names. The default is '(:width :height :weight :slant), and means | |
| 161 that font selection first tries to find a good match for the font | |
| 162 width specified by a face, then---within fonts with that | |
| 163 width---tries to find a best match for the specified font height, | |
| 164 etc. | |
| 165 | |
|
34629
10675adcbf6f
(Vface_ignored_fonts): New variable.
Kenichi Handa <handa@m17n.org>
parents:
34289
diff
changeset
|
166 2. Setting face-font-family-alternatives allows the user to |
| 24995 | 167 specify alternative font families to try if a family specified by a |
| 168 face doesn't exist. | |
| 169 | |
|
34629
10675adcbf6f
(Vface_ignored_fonts): New variable.
Kenichi Handa <handa@m17n.org>
parents:
34289
diff
changeset
|
170 3. Setting face-font-registry-alternatives allows the user to |
|
10675adcbf6f
(Vface_ignored_fonts): New variable.
Kenichi Handa <handa@m17n.org>
parents:
34289
diff
changeset
|
171 specify all alternative font registries to try for a face |
|
10675adcbf6f
(Vface_ignored_fonts): New variable.
Kenichi Handa <handa@m17n.org>
parents:
34289
diff
changeset
|
172 specifying a registry. |
|
10675adcbf6f
(Vface_ignored_fonts): New variable.
Kenichi Handa <handa@m17n.org>
parents:
34289
diff
changeset
|
173 |
|
10675adcbf6f
(Vface_ignored_fonts): New variable.
Kenichi Handa <handa@m17n.org>
parents:
34289
diff
changeset
|
174 4. Setting face-ignored-fonts allows the user to ignore specific |
|
10675adcbf6f
(Vface_ignored_fonts): New variable.
Kenichi Handa <handa@m17n.org>
parents:
34289
diff
changeset
|
175 fonts. |
|
10675adcbf6f
(Vface_ignored_fonts): New variable.
Kenichi Handa <handa@m17n.org>
parents:
34289
diff
changeset
|
176 |
| 24995 | 177 |
| 36946 | 178 Character composition. |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
179 |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
180 Usually, the realization process is already finished when Emacs |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
181 actually reflects the desired glyph matrix on the screen. However, |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
182 on displaying a composition (sequence of characters to be composed |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
183 on the screen), a suitable font for the components of the |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
184 composition is selected and realized while drawing them on the |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
185 screen, i.e. the realization process is delayed but in principle |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
186 the same. |
| 24995 | 187 |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
188 |
| 24995 | 189 Initialization of basic faces. |
| 190 | |
| 191 The faces `default', `modeline' are considered `basic faces'. | |
| 192 When redisplay happens the first time for a newly created frame, | |
| 193 basic faces are realized for CHARSET_ASCII. Frame parameters are | |
| 194 used to fill in unspecified attributes of the default face. */ | |
| 195 | |
|
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25890
diff
changeset
|
196 #include <config.h> |
|
53901
d85f8f2e71f7
Move include stdio.h to same place as in other files.
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
53354
diff
changeset
|
197 #include <stdio.h> |
| 2336 | 198 #include <sys/types.h> |
| 199 #include <sys/stat.h> | |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
200 |
| 2336 | 201 #include "lisp.h" |
|
88394
b954eee715da
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
43270
diff
changeset
|
202 #include "character.h" |
| 17047 | 203 #include "charset.h" |
|
37700
0e6b93106f2a
Include keyboard.h before frame.h, not after it.
Eli Zaretskii <eliz@gnu.org>
parents:
37679
diff
changeset
|
204 #include "keyboard.h" |
|
18083
c361afa561c5
Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents:
17047
diff
changeset
|
205 #include "frame.h" |
|
c361afa561c5
Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents:
17047
diff
changeset
|
206 |
|
29897
cd1bb44e646d
Include fontset.h dependent on HAVE_WINDOW_SYSTEM, not HAVE_X_WINDOWS.
Dave Love <fx@gnu.org>
parents:
29768
diff
changeset
|
207 #ifdef HAVE_WINDOW_SYSTEM |
|
cd1bb44e646d
Include fontset.h dependent on HAVE_WINDOW_SYSTEM, not HAVE_X_WINDOWS.
Dave Love <fx@gnu.org>
parents:
29768
diff
changeset
|
208 #include "fontset.h" |
|
31570
9eeff4863080
Remove conditional compilation on SCALABLE_FONTS.
Gerd Moellmann <gerd@gnu.org>
parents:
31522
diff
changeset
|
209 #endif /* HAVE_WINDOW_SYSTEM */ |
|
9eeff4863080
Remove conditional compilation on SCALABLE_FONTS.
Gerd Moellmann <gerd@gnu.org>
parents:
31522
diff
changeset
|
210 |
| 9572 | 211 #ifdef HAVE_X_WINDOWS |
| 2336 | 212 #include "xterm.h" |
|
25883
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
213 #ifdef USE_MOTIF |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
214 #include <Xm/Xm.h> |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
215 #include <Xm/XmStrDefs.h> |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
216 #endif /* USE_MOTIF */ |
|
31570
9eeff4863080
Remove conditional compilation on SCALABLE_FONTS.
Gerd Moellmann <gerd@gnu.org>
parents:
31522
diff
changeset
|
217 #endif /* HAVE_X_WINDOWS */ |
| 24995 | 218 |
| 9572 | 219 #ifdef MSDOS |
| 220 #include "dosfns.h" | |
| 221 #endif | |
| 24995 | 222 |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
223 #ifdef WINDOWSNT |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
224 #include "w32term.h" |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
225 #include "fontset.h" |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
226 /* Redefine X specifics to W32 equivalents to avoid cluttering the |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
227 code with #ifdef blocks. */ |
|
37700
0e6b93106f2a
Include keyboard.h before frame.h, not after it.
Eli Zaretskii <eliz@gnu.org>
parents:
37679
diff
changeset
|
228 #undef FRAME_X_DISPLAY_INFO |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
229 #define FRAME_X_DISPLAY_INFO FRAME_W32_DISPLAY_INFO |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
230 #define x_display_info w32_display_info |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
231 #define FRAME_X_FONT_TABLE FRAME_W32_FONT_TABLE |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
232 #define check_x check_w32 |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
233 #define x_list_fonts w32_list_fonts |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
234 #define GCGraphicsExposures 0 |
|
31570
9eeff4863080
Remove conditional compilation on SCALABLE_FONTS.
Gerd Moellmann <gerd@gnu.org>
parents:
31522
diff
changeset
|
235 #endif /* WINDOWSNT */ |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
236 |
|
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
44705
diff
changeset
|
237 #ifdef MAC_OS |
|
32752
923b8d6d8277
Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
32176
diff
changeset
|
238 #include "macterm.h" |
|
923b8d6d8277
Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
32176
diff
changeset
|
239 #define x_display_info mac_display_info |
|
923b8d6d8277
Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
32176
diff
changeset
|
240 #define check_x check_mac |
|
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
44705
diff
changeset
|
241 #endif /* MAC_OS */ |
|
32752
923b8d6d8277
Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
32176
diff
changeset
|
242 |
| 2336 | 243 #include "buffer.h" |
| 2391 | 244 #include "dispextern.h" |
| 2438 | 245 #include "blockinput.h" |
|
2767
482fa0725db6
* xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents:
2743
diff
changeset
|
246 #include "window.h" |
| 8848 | 247 #include "intervals.h" |
| 2336 | 248 |
| 9572 | 249 #ifdef HAVE_X_WINDOWS |
| 24995 | 250 |
| 251 /* Compensate for a bug in Xos.h on some systems, on which it requires | |
|
3997
d968bcba16af
* xfaces.c [XOS_NEEDS_TIME_H]: #undef USG while #including
Jim Blandy <jimb@redhat.com>
parents:
3882
diff
changeset
|
252 time.h. On some such systems, Xos.h tries to redefine struct |
|
d968bcba16af
* xfaces.c [XOS_NEEDS_TIME_H]: #undef USG while #including
Jim Blandy <jimb@redhat.com>
parents:
3882
diff
changeset
|
253 timeval and struct timezone if USG is #defined while it is |
|
d968bcba16af
* xfaces.c [XOS_NEEDS_TIME_H]: #undef USG while #including
Jim Blandy <jimb@redhat.com>
parents:
3882
diff
changeset
|
254 #included. */ |
| 24995 | 255 |
|
3436
291f28da7ea1
Test XOS_NEEDS_TIME_H, not HPUX, for including time.hj.
Richard M. Stallman <rms@gnu.org>
parents:
3401
diff
changeset
|
256 #ifdef XOS_NEEDS_TIME_H |
|
3997
d968bcba16af
* xfaces.c [XOS_NEEDS_TIME_H]: #undef USG while #including
Jim Blandy <jimb@redhat.com>
parents:
3882
diff
changeset
|
257 #include <time.h> |
|
d968bcba16af
* xfaces.c [XOS_NEEDS_TIME_H]: #undef USG while #including
Jim Blandy <jimb@redhat.com>
parents:
3882
diff
changeset
|
258 #undef USG |
|
d968bcba16af
* xfaces.c [XOS_NEEDS_TIME_H]: #undef USG while #including
Jim Blandy <jimb@redhat.com>
parents:
3882
diff
changeset
|
259 #include <X11/Xos.h> |
|
d968bcba16af
* xfaces.c [XOS_NEEDS_TIME_H]: #undef USG while #including
Jim Blandy <jimb@redhat.com>
parents:
3882
diff
changeset
|
260 #define USG |
|
d968bcba16af
* xfaces.c [XOS_NEEDS_TIME_H]: #undef USG while #including
Jim Blandy <jimb@redhat.com>
parents:
3882
diff
changeset
|
261 #define __TIMEVAL__ |
| 24995 | 262 #else /* not XOS_NEEDS_TIME_H */ |
| 2336 | 263 #include <X11/Xos.h> |
| 24995 | 264 #endif /* not XOS_NEEDS_TIME_H */ |
| 265 | |
| 9572 | 266 #endif /* HAVE_X_WINDOWS */ |
| 24995 | 267 |
| 268 #include <ctype.h> | |
| 269 | |
| 270 #define abs(X) ((X) < 0 ? -(X) : (X)) | |
| 271 | |
| 34882 | 272 /* Number of pt per inch (from the TeXbook). */ |
| 273 | |
| 274 #define PT_PER_INCH 72.27 | |
| 275 | |
| 24995 | 276 /* Non-zero if face attribute ATTR is unspecified. */ |
| 277 | |
| 278 #define UNSPECIFIEDP(ATTR) EQ ((ATTR), Qunspecified) | |
| 279 | |
| 280 /* Value is the number of elements of VECTOR. */ | |
| 281 | |
| 282 #define DIM(VECTOR) (sizeof (VECTOR) / sizeof *(VECTOR)) | |
| 283 | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
284 /* Make a copy of string S on the stack using alloca. Value is a pointer |
| 24995 | 285 to the copy. */ |
| 286 | |
| 287 #define STRDUPA(S) strcpy ((char *) alloca (strlen ((S)) + 1), (S)) | |
| 288 | |
| 289 /* Make a copy of the contents of Lisp string S on the stack using | |
| 290 alloca. Value is a pointer to the copy. */ | |
| 291 | |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
292 #define LSTRDUPA(S) STRDUPA (SDATA ((S))) |
| 24995 | 293 |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
294 /* Size of hash table of realized faces in face caches (should be a |
| 24995 | 295 prime number). */ |
| 296 | |
| 297 #define FACE_CACHE_BUCKETS_SIZE 1001 | |
| 298 | |
| 299 /* Keyword symbols used for face attribute names. */ | |
| 300 | |
| 301 Lisp_Object QCfamily, QCheight, QCweight, QCslant, QCunderline; | |
| 302 Lisp_Object QCinverse_video, QCforeground, QCbackground, QCstipple; | |
| 303 Lisp_Object QCwidth, QCfont, QCbold, QCitalic; | |
| 304 Lisp_Object QCreverse_video; | |
| 31178 | 305 Lisp_Object QCoverline, QCstrike_through, QCbox, QCinherit; |
|
89047
3b6234eb229c
(QCfontset): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88939
diff
changeset
|
306 Lisp_Object QCfontset; |
| 24995 | 307 |
| 308 /* Symbols used for attribute values. */ | |
| 309 | |
| 310 Lisp_Object Qnormal, Qbold, Qultra_light, Qextra_light, Qlight; | |
| 311 Lisp_Object Qsemi_light, Qsemi_bold, Qextra_bold, Qultra_bold; | |
| 312 Lisp_Object Qoblique, Qitalic, Qreverse_oblique, Qreverse_italic; | |
| 313 Lisp_Object Qultra_condensed, Qextra_condensed, Qcondensed; | |
| 314 Lisp_Object Qsemi_condensed, Qsemi_expanded, Qexpanded, Qextra_expanded; | |
| 315 Lisp_Object Qultra_expanded; | |
| 316 Lisp_Object Qreleased_button, Qpressed_button; | |
| 317 Lisp_Object QCstyle, QCcolor, QCline_width; | |
|
27114
4efa5e54e9a9
(Qunspecified_fg, Qunspecified_bg): Remove.
Eli Zaretskii <eliz@gnu.org>
parents:
27100
diff
changeset
|
318 Lisp_Object Qunspecified; |
|
4efa5e54e9a9
(Qunspecified_fg, Qunspecified_bg): Remove.
Eli Zaretskii <eliz@gnu.org>
parents:
27100
diff
changeset
|
319 |
|
4efa5e54e9a9
(Qunspecified_fg, Qunspecified_bg): Remove.
Eli Zaretskii <eliz@gnu.org>
parents:
27100
diff
changeset
|
320 char unspecified_fg[] = "unspecified-fg", unspecified_bg[] = "unspecified-bg"; |
| 24995 | 321 |
|
25661
a6e2ae7964fb
(Fx_family_fonts): Replaces Fx_font_list.
Gerd Moellmann <gerd@gnu.org>
parents:
25592
diff
changeset
|
322 /* The name of the function to call when the background of the frame |
|
a6e2ae7964fb
(Fx_family_fonts): Replaces Fx_font_list.
Gerd Moellmann <gerd@gnu.org>
parents:
25592
diff
changeset
|
323 has changed, frame_update_face_colors. */ |
|
a6e2ae7964fb
(Fx_family_fonts): Replaces Fx_font_list.
Gerd Moellmann <gerd@gnu.org>
parents:
25592
diff
changeset
|
324 |
|
a6e2ae7964fb
(Fx_family_fonts): Replaces Fx_font_list.
Gerd Moellmann <gerd@gnu.org>
parents:
25592
diff
changeset
|
325 Lisp_Object Qframe_update_face_colors; |
|
a6e2ae7964fb
(Fx_family_fonts): Replaces Fx_font_list.
Gerd Moellmann <gerd@gnu.org>
parents:
25592
diff
changeset
|
326 |
| 24995 | 327 /* Names of basic faces. */ |
| 328 | |
|
26574
5510d0cc07c3
Don't duplicate Qmode_line definition done elsewhere.
Dave Love <fx@gnu.org>
parents:
26088
diff
changeset
|
329 Lisp_Object Qdefault, Qtool_bar, Qregion, Qfringe; |
|
25883
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
330 Lisp_Object Qheader_line, Qscroll_bar, Qcursor, Qborder, Qmouse, Qmenu; |
|
43203
dd98ef3675e5
(Qmode_line_inactive): New face variable for mode-line
Kim F. Storm <storm@cua.dk>
parents:
43069
diff
changeset
|
331 Lisp_Object Qmode_line_inactive; |
|
26574
5510d0cc07c3
Don't duplicate Qmode_line definition done elsewhere.
Dave Love <fx@gnu.org>
parents:
26088
diff
changeset
|
332 extern Lisp_Object Qmode_line; |
|
25592
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
333 |
|
25661
a6e2ae7964fb
(Fx_family_fonts): Replaces Fx_font_list.
Gerd Moellmann <gerd@gnu.org>
parents:
25592
diff
changeset
|
334 /* The symbol `face-alias'. A symbols having that property is an |
|
a6e2ae7964fb
(Fx_family_fonts): Replaces Fx_font_list.
Gerd Moellmann <gerd@gnu.org>
parents:
25592
diff
changeset
|
335 alias for another face. Value of the property is the name of |
|
a6e2ae7964fb
(Fx_family_fonts): Replaces Fx_font_list.
Gerd Moellmann <gerd@gnu.org>
parents:
25592
diff
changeset
|
336 the aliased face. */ |
|
a6e2ae7964fb
(Fx_family_fonts): Replaces Fx_font_list.
Gerd Moellmann <gerd@gnu.org>
parents:
25592
diff
changeset
|
337 |
|
a6e2ae7964fb
(Fx_family_fonts): Replaces Fx_font_list.
Gerd Moellmann <gerd@gnu.org>
parents:
25592
diff
changeset
|
338 Lisp_Object Qface_alias; |
|
a6e2ae7964fb
(Fx_family_fonts): Replaces Fx_font_list.
Gerd Moellmann <gerd@gnu.org>
parents:
25592
diff
changeset
|
339 |
| 24995 | 340 /* Default stipple pattern used on monochrome displays. This stipple |
| 341 pattern is used on monochrome displays instead of shades of gray | |
| 342 for a face background color. See `set-face-stipple' for possible | |
| 343 values for this variable. */ | |
| 344 | |
| 345 Lisp_Object Vface_default_stipple; | |
| 346 | |
| 347 /* Alist of alternative font families. Each element is of the form | |
| 348 (FAMILY FAMILY1 FAMILY2 ...). If fonts of FAMILY can't be loaded, | |
| 349 try FAMILY1, then FAMILY2, ... */ | |
| 350 | |
| 351 Lisp_Object Vface_alternative_font_family_alist; | |
| 352 | |
|
33372
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
353 /* Alist of alternative font registries. Each element is of the form |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
354 (REGISTRY REGISTRY1 REGISTRY2...). If fonts of REGISTRY can't be |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
355 loaded, try REGISTRY1, then REGISTRY2, ... */ |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
356 |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
357 Lisp_Object Vface_alternative_font_registry_alist; |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
358 |
| 24995 | 359 /* Allowed scalable fonts. A value of nil means don't allow any |
| 360 scalable fonts. A value of t means allow the use of any scalable | |
| 361 font. Otherwise, value must be a list of regular expressions. A | |
| 362 font may be scaled if its name matches a regular expression in the | |
| 363 list. */ | |
| 364 | |
|
37394
7847d9b8bbff
(Qscalable_fonts_allowed): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37206
diff
changeset
|
365 Lisp_Object Vscalable_fonts_allowed, Qscalable_fonts_allowed; |
| 24995 | 366 |
|
34629
10675adcbf6f
(Vface_ignored_fonts): New variable.
Kenichi Handa <handa@m17n.org>
parents:
34289
diff
changeset
|
367 /* List of regular expressions that matches names of fonts to ignore. */ |
|
10675adcbf6f
(Vface_ignored_fonts): New variable.
Kenichi Handa <handa@m17n.org>
parents:
34289
diff
changeset
|
368 |
|
10675adcbf6f
(Vface_ignored_fonts): New variable.
Kenichi Handa <handa@m17n.org>
parents:
34289
diff
changeset
|
369 Lisp_Object Vface_ignored_fonts; |
|
10675adcbf6f
(Vface_ignored_fonts): New variable.
Kenichi Handa <handa@m17n.org>
parents:
34289
diff
changeset
|
370 |
|
50515
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
371 /* Alist of font name patterns vs the rescaling factor. */ |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
372 |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
373 Lisp_Object Vface_font_rescale_alist; |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
374 |
| 25270 | 375 /* Maximum number of fonts to consider in font_list. If not an |
| 376 integer > 0, DEFAULT_FONT_LIST_LIMIT is used instead. */ | |
| 377 | |
| 378 Lisp_Object Vfont_list_limit; | |
| 379 #define DEFAULT_FONT_LIST_LIMIT 100 | |
| 380 | |
| 24995 | 381 /* The symbols `foreground-color' and `background-color' which can be |
| 382 used as part of a `face' property. This is for compatibility with | |
| 383 Emacs 20.2. */ | |
| 384 | |
| 385 Lisp_Object Qforeground_color, Qbackground_color; | |
| 386 | |
| 387 /* The symbols `face' and `mouse-face' used as text properties. */ | |
| 2342 | 388 |
|
23730
c71c3ac4b80a
(Qmouse_face): Replace definition with extern decl.
Richard M. Stallman <rms@gnu.org>
parents:
21766
diff
changeset
|
389 Lisp_Object Qface; |
| 24995 | 390 extern Lisp_Object Qmouse_face; |
| 391 | |
| 57107 | 392 /* Property for basic faces which other faces cannot inherit. */ |
| 393 | |
| 394 Lisp_Object Qface_no_inherit; | |
| 395 | |
| 24995 | 396 /* Error symbol for wrong_type_argument in load_pixmap. */ |
| 397 | |
|
25890
b10a34d40b55
(Qbitmap_spec_p): Replaces Qpixmap_spec_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25883
diff
changeset
|
398 Lisp_Object Qbitmap_spec_p; |
| 2391 | 399 |
| 24995 | 400 /* Alist of global face definitions. Each element is of the form |
| 401 (FACE . LFACE) where FACE is a symbol naming a face and LFACE | |
| 402 is a Lisp vector of face attributes. These faces are used | |
| 403 to initialize faces for new frames. */ | |
| 404 | |
| 405 Lisp_Object Vface_new_frame_defaults; | |
| 406 | |
| 407 /* The next ID to assign to Lisp faces. */ | |
| 408 | |
| 409 static int next_lface_id; | |
| 410 | |
| 411 /* A vector mapping Lisp face Id's to face names. */ | |
| 412 | |
| 413 static Lisp_Object *lface_id_to_name; | |
| 414 static int lface_id_to_name_size; | |
| 415 | |
|
30973
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
416 /* TTY color-related functions (defined in tty-colors.el). */ |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
417 |
|
45718
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
418 Lisp_Object Qtty_color_desc, Qtty_color_by_index, Qtty_color_standard_values; |
| 24995 | 419 |
|
30973
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
420 /* The name of the function used to compute colors on TTYs. */ |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
421 |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
422 Lisp_Object Qtty_color_alist; |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
423 |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
424 /* An alist of defined terminal colors and their RGB values. */ |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
425 |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
426 Lisp_Object Vtty_defined_color_alist; |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
427 |
| 24995 | 428 /* Counter for calls to clear_face_cache. If this counter reaches |
| 429 CLEAR_FONT_TABLE_COUNT, and a frame has more than | |
| 430 CLEAR_FONT_TABLE_NFONTS load, unused fonts are freed. */ | |
| 431 | |
| 432 static int clear_font_table_count; | |
| 433 #define CLEAR_FONT_TABLE_COUNT 100 | |
| 434 #define CLEAR_FONT_TABLE_NFONTS 10 | |
| 435 | |
| 436 /* Non-zero means face attributes have been changed since the last | |
| 437 redisplay. Used in redisplay_internal. */ | |
| 438 | |
| 439 int face_change_count; | |
| 440 | |
|
28529
b8ac36c58391
(tty_suppress_bold_inverse_default_colors_p): New
Gerd Moellmann <gerd@gnu.org>
parents:
28464
diff
changeset
|
441 /* Non-zero means don't display bold text if a face's foreground |
|
b8ac36c58391
(tty_suppress_bold_inverse_default_colors_p): New
Gerd Moellmann <gerd@gnu.org>
parents:
28464
diff
changeset
|
442 and background colors are the inverse of the default colors of the |
|
b8ac36c58391
(tty_suppress_bold_inverse_default_colors_p): New
Gerd Moellmann <gerd@gnu.org>
parents:
28464
diff
changeset
|
443 display. This is a kluge to suppress `bold black' foreground text |
|
b8ac36c58391
(tty_suppress_bold_inverse_default_colors_p): New
Gerd Moellmann <gerd@gnu.org>
parents:
28464
diff
changeset
|
444 which is hard to read on an LCD monitor. */ |
|
b8ac36c58391
(tty_suppress_bold_inverse_default_colors_p): New
Gerd Moellmann <gerd@gnu.org>
parents:
28464
diff
changeset
|
445 |
|
b8ac36c58391
(tty_suppress_bold_inverse_default_colors_p): New
Gerd Moellmann <gerd@gnu.org>
parents:
28464
diff
changeset
|
446 int tty_suppress_bold_inverse_default_colors_p; |
|
b8ac36c58391
(tty_suppress_bold_inverse_default_colors_p): New
Gerd Moellmann <gerd@gnu.org>
parents:
28464
diff
changeset
|
447 |
|
31449
8797df6a9fa2
(Vparam_value_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
31440
diff
changeset
|
448 /* A list of the form `((x . y))' used to avoid consing in |
|
8797df6a9fa2
(Vparam_value_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
31440
diff
changeset
|
449 Finternal_set_lisp_face_attribute. */ |
|
8797df6a9fa2
(Vparam_value_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
31440
diff
changeset
|
450 |
|
8797df6a9fa2
(Vparam_value_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
31440
diff
changeset
|
451 static Lisp_Object Vparam_value_alist; |
|
8797df6a9fa2
(Vparam_value_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
31440
diff
changeset
|
452 |
| 24995 | 453 /* The total number of colors currently allocated. */ |
| 454 | |
| 455 #if GLYPH_DEBUG | |
| 456 static int ncolors_allocated; | |
| 457 static int npixmaps_allocated; | |
| 458 static int ngcs; | |
| 459 #endif | |
| 460 | |
|
38905
70ef1eb656a6
(menu_face_changed_default): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38818
diff
changeset
|
461 /* Non-zero means the definition of the `menu' face for new frames has |
|
70ef1eb656a6
(menu_face_changed_default): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38818
diff
changeset
|
462 been changed. */ |
|
70ef1eb656a6
(menu_face_changed_default): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38818
diff
changeset
|
463 |
|
70ef1eb656a6
(menu_face_changed_default): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38818
diff
changeset
|
464 int menu_face_changed_default; |
| 24995 | 465 |
| 2336 | 466 |
| 24995 | 467 /* Function prototypes. */ |
| 468 | |
| 469 struct font_name; | |
| 470 struct table_entry; | |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
471 struct named_merge_point; |
| 24995 | 472 |
|
30973
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
473 static void map_tty_color P_ ((struct frame *, struct face *, |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
474 enum lface_attribute_index, int *)); |
|
25883
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
475 static Lisp_Object resolve_face_name P_ ((Lisp_Object)); |
|
46556
71e205b50a3e
(may_use_scalable_font_p): Argument now points to
Ken Raeburn <raeburn@raeburn.org>
parents:
46478
diff
changeset
|
476 static int may_use_scalable_font_p P_ ((const char *)); |
| 24995 | 477 static void set_font_frame_param P_ ((Lisp_Object, Lisp_Object)); |
| 478 static int better_font_p P_ ((int *, struct font_name *, struct font_name *, | |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
479 int, int)); |
| 24995 | 480 static int x_face_list_fonts P_ ((struct frame *, char *, |
|
49859
c6bacc76cfb6
* xterm.c (x_list_fonts): If maxnames is less than 0, get all font
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49600
diff
changeset
|
481 struct font_name **, int, int)); |
| 24995 | 482 static int font_scalable_p P_ ((struct font_name *)); |
| 483 static int get_lface_attributes P_ ((struct frame *, Lisp_Object, Lisp_Object *, int)); | |
| 484 static int load_pixmap P_ ((struct frame *, Lisp_Object, unsigned *, unsigned *)); | |
| 485 static unsigned char *xstrlwr P_ ((unsigned char *)); | |
| 486 static void signal_error P_ ((char *, Lisp_Object)); | |
| 487 static struct frame *frame_or_selected_frame P_ ((Lisp_Object, int)); | |
| 88907 | 488 static void load_face_font P_ ((struct frame *, struct face *)); |
| 24995 | 489 static void load_face_colors P_ ((struct frame *, struct face *, Lisp_Object *)); |
| 490 static void free_face_colors P_ ((struct frame *, struct face *)); | |
| 491 static int face_color_gray_p P_ ((struct frame *, char *)); | |
| 492 static char *build_font_name P_ ((struct font_name *)); | |
| 493 static void free_font_names P_ ((struct font_name *, int)); | |
| 494 static int sorted_font_list P_ ((struct frame *, char *, | |
| 495 int (*cmpfn) P_ ((const void *, const void *)), | |
| 496 struct font_name **)); | |
|
33372
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
497 static int font_list_1 P_ ((struct frame *, Lisp_Object, Lisp_Object, |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
498 Lisp_Object, struct font_name **)); |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
499 static int font_list P_ ((struct frame *, Lisp_Object, Lisp_Object, |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
500 Lisp_Object, struct font_name **)); |
| 88907 | 501 static int try_font_list P_ ((struct frame *, Lisp_Object, |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
502 Lisp_Object, Lisp_Object, struct font_name **)); |
|
37679
13efa6105da9
(try_alternative_families): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37433
diff
changeset
|
503 static int try_alternative_families P_ ((struct frame *f, Lisp_Object, |
|
13efa6105da9
(try_alternative_families): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37433
diff
changeset
|
504 Lisp_Object, struct font_name **)); |
| 24995 | 505 static int cmp_font_names P_ ((const void *, const void *)); |
| 88907 | 506 static struct face *realize_face P_ ((struct face_cache *, Lisp_Object *, |
| 507 int)); | |
| 508 static struct face *realize_non_ascii_face P_ ((struct frame *, int, | |
| 509 struct face *)); | |
| 510 static struct face *realize_x_face P_ ((struct face_cache *, Lisp_Object *)); | |
| 511 static struct face *realize_tty_face P_ ((struct face_cache *, Lisp_Object *)); | |
| 24995 | 512 static int realize_basic_faces P_ ((struct frame *)); |
| 513 static int realize_default_face P_ ((struct frame *)); | |
| 514 static void realize_named_face P_ ((struct frame *, Lisp_Object, int)); | |
| 515 static int lface_fully_specified_p P_ ((Lisp_Object *)); | |
| 516 static int lface_equal_p P_ ((Lisp_Object *, Lisp_Object *)); | |
| 517 static unsigned hash_string_case_insensitive P_ ((Lisp_Object)); | |
| 518 static unsigned lface_hash P_ ((Lisp_Object *)); | |
| 519 static int lface_same_font_attributes_p P_ ((Lisp_Object *, Lisp_Object *)); | |
| 520 static struct face_cache *make_face_cache P_ ((struct frame *)); | |
| 521 static void clear_face_gcs P_ ((struct face_cache *)); | |
| 522 static void free_face_cache P_ ((struct face_cache *)); | |
| 523 static int face_numeric_weight P_ ((Lisp_Object)); | |
| 524 static int face_numeric_slant P_ ((Lisp_Object)); | |
| 525 static int face_numeric_swidth P_ ((Lisp_Object)); | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
526 static int face_fontset P_ ((Lisp_Object *)); |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
527 static void merge_face_vectors P_ ((struct frame *, Lisp_Object *, Lisp_Object*, |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
528 struct named_merge_point *)); |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
529 static int merge_face_ref P_ ((struct frame *, Lisp_Object, Lisp_Object *, |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
530 int, struct named_merge_point *)); |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
531 static int set_lface_from_font_name P_ ((struct frame *, Lisp_Object, |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
532 Lisp_Object, int, int)); |
| 24995 | 533 static Lisp_Object lface_from_face_name P_ ((struct frame *, Lisp_Object, int)); |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
534 static struct face *make_realized_face P_ ((Lisp_Object *)); |
| 24995 | 535 static char *best_matching_font P_ ((struct frame *, Lisp_Object *, |
|
48384
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
536 struct font_name *, int, int, int *)); |
| 24995 | 537 static void cache_face P_ ((struct face_cache *, struct face *, unsigned)); |
| 538 static void uncache_face P_ ((struct face_cache *, struct face *)); | |
| 539 static int xlfd_numeric_slant P_ ((struct font_name *)); | |
| 540 static int xlfd_numeric_weight P_ ((struct font_name *)); | |
| 541 static int xlfd_numeric_swidth P_ ((struct font_name *)); | |
| 542 static Lisp_Object xlfd_symbolic_slant P_ ((struct font_name *)); | |
| 543 static Lisp_Object xlfd_symbolic_weight P_ ((struct font_name *)); | |
| 544 static Lisp_Object xlfd_symbolic_swidth P_ ((struct font_name *)); | |
| 545 static int xlfd_fixed_p P_ ((struct font_name *)); | |
| 546 static int xlfd_numeric_value P_ ((struct table_entry *, int, struct font_name *, | |
| 547 int, int)); | |
| 548 static Lisp_Object xlfd_symbolic_value P_ ((struct table_entry *, int, | |
|
28464
cad4cc0508a0
Fix Lisp_Object/int type confusion revealed by making Lisp_Object a union type:
Ken Raeburn <raeburn@raeburn.org>
parents:
28461
diff
changeset
|
549 struct font_name *, int, |
|
cad4cc0508a0
Fix Lisp_Object/int type confusion revealed by making Lisp_Object a union type:
Ken Raeburn <raeburn@raeburn.org>
parents:
28461
diff
changeset
|
550 Lisp_Object)); |
| 24995 | 551 static struct table_entry *xlfd_lookup_field_contents P_ ((struct table_entry *, int, |
| 552 struct font_name *, int)); | |
|
2730
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
553 |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
554 #ifdef HAVE_WINDOW_SYSTEM |
| 24995 | 555 |
| 556 static int split_font_name P_ ((struct frame *, struct font_name *, int)); | |
| 557 static int xlfd_point_size P_ ((struct frame *, struct font_name *)); | |
| 558 static void sort_fonts P_ ((struct frame *, struct font_name *, int, | |
| 559 int (*cmpfn) P_ ((const void *, const void *)))); | |
| 560 static GC x_create_gc P_ ((struct frame *, unsigned long, XGCValues *)); | |
| 561 static void x_free_gc P_ ((struct frame *, GC)); | |
|
38434
86a4e78aeae0
(clear_face_cache): Clear fonts on a display basis.
Gerd Moellmann <gerd@gnu.org>
parents:
38346
diff
changeset
|
562 static void clear_font_table P_ ((struct x_display_info *)); |
| 24995 | 563 |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
564 #ifdef WINDOWSNT |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
565 extern Lisp_Object w32_list_fonts P_ ((struct frame *, Lisp_Object, int, int)); |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
566 #endif /* WINDOWSNT */ |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
567 |
|
36942
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
568 #ifdef USE_X_TOOLKIT |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
569 static void x_update_menu_appearance P_ ((struct frame *)); |
| 39675 | 570 |
| 571 extern void free_frame_menubar P_ ((struct frame *)); | |
|
36942
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
572 #endif /* USE_X_TOOLKIT */ |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
573 |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
574 #endif /* HAVE_WINDOW_SYSTEM */ |
| 24995 | 575 |
| 576 | |
| 577 /*********************************************************************** | |
| 578 Utilities | |
| 579 ***********************************************************************/ | |
| 580 | |
| 581 #ifdef HAVE_X_WINDOWS | |
| 582 | |
|
28354
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
583 #ifdef DEBUG_X_COLORS |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
584 |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
585 /* The following is a poor mans infrastructure for debugging X color |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
586 allocation problems on displays with PseudoColor-8. Some X servers |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
587 like 3.3.5 XF86_SVGA with Matrox cards apparently don't implement |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
588 color reference counts completely so that they don't signal an |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
589 error when a color is freed whose reference count is already 0. |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
590 Other X servers do. To help me debug this, the following code |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
591 implements a simple reference counting schema of its own, for a |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
592 single display/screen. --gerd. */ |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
593 |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
594 /* Reference counts for pixel colors. */ |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
595 |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
596 int color_count[256]; |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
597 |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
598 /* Register color PIXEL as allocated. */ |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
599 |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
600 void |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
601 register_color (pixel) |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
602 unsigned long pixel; |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
603 { |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
604 xassert (pixel < 256); |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
605 ++color_count[pixel]; |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
606 } |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
607 |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
608 |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
609 /* Register color PIXEL as deallocated. */ |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
610 |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
611 void |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
612 unregister_color (pixel) |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
613 unsigned long pixel; |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
614 { |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
615 xassert (pixel < 256); |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
616 if (color_count[pixel] > 0) |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
617 --color_count[pixel]; |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
618 else |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
619 abort (); |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
620 } |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
621 |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
622 |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
623 /* Register N colors from PIXELS as deallocated. */ |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
624 |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
625 void |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
626 unregister_colors (pixels, n) |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
627 unsigned long *pixels; |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
628 int n; |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
629 { |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
630 int i; |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
631 for (i = 0; i < n; ++i) |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
632 unregister_color (pixels[i]); |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
633 } |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
634 |
|
29599
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
635 |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
636 DEFUN ("dump-colors", Fdump_colors, Sdump_colors, 0, 0, 0, |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
637 doc: /* Dump currently allocated colors to stderr. */) |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
638 () |
|
29599
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
639 { |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
640 int i, n; |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
641 |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
642 fputc ('\n', stderr); |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
643 |
|
29599
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
644 for (i = n = 0; i < sizeof color_count / sizeof color_count[0]; ++i) |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
645 if (color_count[i]) |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
646 { |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
647 fprintf (stderr, "%3d: %5d", i, color_count[i]); |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
648 ++n; |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
649 if (n % 5 == 0) |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
650 fputc ('\n', stderr); |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
651 else |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
652 fputc ('\t', stderr); |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
653 } |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
654 |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
655 if (n % 5 != 0) |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
656 fputc ('\n', stderr); |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
657 return Qnil; |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
658 } |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
659 |
|
28354
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
660 #endif /* DEBUG_X_COLORS */ |
|
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
661 |
|
31570
9eeff4863080
Remove conditional compilation on SCALABLE_FONTS.
Gerd Moellmann <gerd@gnu.org>
parents:
31522
diff
changeset
|
662 |
|
27960
25a04100858d
(x_free_colors): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
27743
diff
changeset
|
663 /* Free colors used on frame F. PIXELS is an array of NPIXELS pixel |
|
25a04100858d
(x_free_colors): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
27743
diff
changeset
|
664 color values. Interrupt input must be blocked when this function |
|
25a04100858d
(x_free_colors): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
27743
diff
changeset
|
665 is called. */ |
|
25a04100858d
(x_free_colors): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
27743
diff
changeset
|
666 |
|
25a04100858d
(x_free_colors): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
27743
diff
changeset
|
667 void |
|
25a04100858d
(x_free_colors): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
27743
diff
changeset
|
668 x_free_colors (f, pixels, npixels) |
|
25a04100858d
(x_free_colors): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
27743
diff
changeset
|
669 struct frame *f; |
|
25a04100858d
(x_free_colors): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
27743
diff
changeset
|
670 unsigned long *pixels; |
|
25a04100858d
(x_free_colors): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
27743
diff
changeset
|
671 int npixels; |
|
25a04100858d
(x_free_colors): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
27743
diff
changeset
|
672 { |
|
25a04100858d
(x_free_colors): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
27743
diff
changeset
|
673 int class = FRAME_X_DISPLAY_INFO (f)->visual->class; |
|
25a04100858d
(x_free_colors): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
27743
diff
changeset
|
674 |
|
25a04100858d
(x_free_colors): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
27743
diff
changeset
|
675 /* If display has an immutable color map, freeing colors is not |
|
25a04100858d
(x_free_colors): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
27743
diff
changeset
|
676 necessary and some servers don't allow it. So don't do it. */ |
|
25a04100858d
(x_free_colors): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
27743
diff
changeset
|
677 if (class != StaticColor && class != StaticGray && class != TrueColor) |
|
25a04100858d
(x_free_colors): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
27743
diff
changeset
|
678 { |
|
28354
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
679 #ifdef DEBUG_X_COLORS |
|
29599
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
680 unregister_colors (pixels, npixels); |
|
28354
d6ae8188fa58
(register_color, unregister_colors, unregister_colors)
Gerd Moellmann <gerd@gnu.org>
parents:
28349
diff
changeset
|
681 #endif |
|
35228
ae27a81ee8dc
(x_free_colors, x_free_dpy_colors): Do the
Gerd Moellmann <gerd@gnu.org>
parents:
35040
diff
changeset
|
682 XFreeColors (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), |
|
ae27a81ee8dc
(x_free_colors, x_free_dpy_colors): Do the
Gerd Moellmann <gerd@gnu.org>
parents:
35040
diff
changeset
|
683 pixels, npixels, 0); |
|
27960
25a04100858d
(x_free_colors): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
27743
diff
changeset
|
684 } |
|
25a04100858d
(x_free_colors): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
27743
diff
changeset
|
685 } |
|
25a04100858d
(x_free_colors): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
27743
diff
changeset
|
686 |
|
29599
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
687 |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
688 /* Free colors used on frame F. PIXELS is an array of NPIXELS pixel |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
689 color values. Interrupt input must be blocked when this function |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
690 is called. */ |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
691 |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
692 void |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
693 x_free_dpy_colors (dpy, screen, cmap, pixels, npixels) |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
694 Display *dpy; |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
695 Screen *screen; |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
696 Colormap cmap; |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
697 unsigned long *pixels; |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
698 int npixels; |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
699 { |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
700 struct x_display_info *dpyinfo = x_display_info_for_display (dpy); |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
701 int class = dpyinfo->visual->class; |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
702 |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
703 /* If display has an immutable color map, freeing colors is not |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
704 necessary and some servers don't allow it. So don't do it. */ |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
705 if (class != StaticColor && class != StaticGray && class != TrueColor) |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
706 { |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
707 #ifdef DEBUG_X_COLORS |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
708 unregister_colors (pixels, npixels); |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
709 #endif |
|
35228
ae27a81ee8dc
(x_free_colors, x_free_dpy_colors): Do the
Gerd Moellmann <gerd@gnu.org>
parents:
35040
diff
changeset
|
710 XFreeColors (dpy, cmap, pixels, npixels, 0); |
|
29599
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
711 } |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
712 } |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
713 |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
714 |
| 24995 | 715 /* Create and return a GC for use on frame F. GC values and mask |
| 716 are given by XGCV and MASK. */ | |
| 717 | |
| 718 static INLINE GC | |
| 719 x_create_gc (f, mask, xgcv) | |
|
2730
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
720 struct frame *f; |
| 24995 | 721 unsigned long mask; |
| 722 XGCValues *xgcv; | |
|
2730
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
723 { |
| 2336 | 724 GC gc; |
| 24995 | 725 BLOCK_INPUT; |
| 726 gc = XCreateGC (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), mask, xgcv); | |
| 727 UNBLOCK_INPUT; | |
| 728 IF_DEBUG (++ngcs); | |
| 729 return gc; | |
| 730 } | |
| 731 | |
| 732 | |
| 733 /* Free GC which was used on frame F. */ | |
| 734 | |
| 735 static INLINE void | |
| 736 x_free_gc (f, gc) | |
| 737 struct frame *f; | |
| 738 GC gc; | |
| 739 { | |
|
3074
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
740 BLOCK_INPUT; |
| 24995 | 741 xassert (--ngcs >= 0); |
| 742 XFreeGC (FRAME_X_DISPLAY (f), gc); | |
| 743 UNBLOCK_INPUT; | |
| 744 } | |
| 745 | |
| 746 #endif /* HAVE_X_WINDOWS */ | |
| 747 | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
748 #ifdef WINDOWSNT |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
749 /* W32 emulation of GCs */ |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
750 |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
751 static INLINE GC |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
752 x_create_gc (f, mask, xgcv) |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
753 struct frame *f; |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
754 unsigned long mask; |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
755 XGCValues *xgcv; |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
756 { |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
757 GC gc; |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
758 BLOCK_INPUT; |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
759 gc = XCreateGC (NULL, FRAME_W32_WINDOW (f), mask, xgcv); |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
760 UNBLOCK_INPUT; |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
761 IF_DEBUG (++ngcs); |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
762 return gc; |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
763 } |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
764 |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
765 |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
766 /* Free GC which was used on frame F. */ |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
767 |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
768 static INLINE void |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
769 x_free_gc (f, gc) |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
770 struct frame *f; |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
771 GC gc; |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
772 { |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
773 BLOCK_INPUT; |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
774 xassert (--ngcs >= 0); |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
775 xfree (gc); |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
776 UNBLOCK_INPUT; |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
777 } |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
778 |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
779 #endif /* WINDOWSNT */ |
| 24995 | 780 |
|
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
44705
diff
changeset
|
781 #ifdef MAC_OS |
|
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
44705
diff
changeset
|
782 /* Mac OS emulation of GCs */ |
|
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
44705
diff
changeset
|
783 |
|
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
44705
diff
changeset
|
784 extern XGCValues *XCreateGC (void *, Window, unsigned long, XGCValues *); |
|
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
44705
diff
changeset
|
785 |
|
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
44705
diff
changeset
|
786 static INLINE GC |
|
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
44705
diff
changeset
|
787 x_create_gc (f, mask, xgcv) |
|
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
44705
diff
changeset
|
788 struct frame *f; |
|
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
44705
diff
changeset
|
789 unsigned long mask; |
|
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
44705
diff
changeset
|
790 XGCValues *xgcv; |
|
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
44705
diff
changeset
|
791 { |
|
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
44705
diff
changeset
|
792 GC gc; |
|
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
44705
diff
changeset
|
793 gc = XCreateGC (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), mask, xgcv); |
|
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
44705
diff
changeset
|
794 return gc; |
|
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
44705
diff
changeset
|
795 } |
|
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
44705
diff
changeset
|
796 |
|
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
44705
diff
changeset
|
797 static INLINE void |
|
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
44705
diff
changeset
|
798 x_free_gc (f, gc) |
|
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
44705
diff
changeset
|
799 struct frame *f; |
|
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
44705
diff
changeset
|
800 GC gc; |
|
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
44705
diff
changeset
|
801 { |
|
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
44705
diff
changeset
|
802 XFreeGC (FRAME_MAC_DISPLAY (f), gc); |
|
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
44705
diff
changeset
|
803 } |
|
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
44705
diff
changeset
|
804 |
|
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
44705
diff
changeset
|
805 #endif /* MAC_OS */ |
|
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
44705
diff
changeset
|
806 |
| 24995 | 807 /* Like stricmp. Used to compare parts of font names which are in |
| 808 ISO8859-1. */ | |
| 809 | |
| 810 int | |
| 811 xstricmp (s1, s2) | |
|
46478
d6b51ec01987
(xstricmp): String pointer args now point to const.
Ken Raeburn <raeburn@raeburn.org>
parents:
46370
diff
changeset
|
812 const unsigned char *s1, *s2; |
| 24995 | 813 { |
| 814 while (*s1 && *s2) | |
| 815 { | |
| 816 unsigned char c1 = tolower (*s1); | |
| 817 unsigned char c2 = tolower (*s2); | |
| 818 if (c1 != c2) | |
| 819 return c1 < c2 ? -1 : 1; | |
| 820 ++s1, ++s2; | |
| 821 } | |
| 822 | |
| 823 if (*s1 == 0) | |
| 824 return *s2 == 0 ? 0 : -1; | |
| 825 return 1; | |
| 826 } | |
| 827 | |
| 828 | |
| 829 /* Like strlwr, which might not always be available. */ | |
| 830 | |
| 831 static unsigned char * | |
| 832 xstrlwr (s) | |
| 833 unsigned char *s; | |
| 834 { | |
| 835 unsigned char *p = s; | |
| 836 | |
| 837 for (p = s; *p; ++p) | |
| 838 *p = tolower (*p); | |
| 839 | |
| 840 return s; | |
| 841 } | |
| 842 | |
| 843 | |
| 844 /* Signal `error' with message S, and additional argument ARG. */ | |
| 845 | |
| 846 static void | |
| 847 signal_error (s, arg) | |
| 848 char *s; | |
| 849 Lisp_Object arg; | |
| 850 { | |
| 851 Fsignal (Qerror, Fcons (build_string (s), Fcons (arg, Qnil))); | |
| 852 } | |
| 853 | |
| 854 | |
|
25678
1878f7ae0df5
(frame_or_selected_frame): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25661
diff
changeset
|
855 /* If FRAME is nil, return a pointer to the selected frame. |
|
1878f7ae0df5
(frame_or_selected_frame): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25661
diff
changeset
|
856 Otherwise, check that FRAME is a live frame, and return a pointer |
|
1878f7ae0df5
(frame_or_selected_frame): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25661
diff
changeset
|
857 to it. NPARAM is the parameter number of FRAME, for |
|
1878f7ae0df5
(frame_or_selected_frame): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25661
diff
changeset
|
858 CHECK_LIVE_FRAME. This is here because it's a frequent pattern in |
|
1878f7ae0df5
(frame_or_selected_frame): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25661
diff
changeset
|
859 Lisp function definitions. */ |
| 24995 | 860 |
| 861 static INLINE struct frame * | |
| 862 frame_or_selected_frame (frame, nparam) | |
| 863 Lisp_Object frame; | |
| 864 int nparam; | |
| 865 { | |
|
25678
1878f7ae0df5
(frame_or_selected_frame): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25661
diff
changeset
|
866 if (NILP (frame)) |
|
1878f7ae0df5
(frame_or_selected_frame): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25661
diff
changeset
|
867 frame = selected_frame; |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
868 |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
869 CHECK_LIVE_FRAME (frame); |
|
25678
1878f7ae0df5
(frame_or_selected_frame): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25661
diff
changeset
|
870 return XFRAME (frame); |
| 24995 | 871 } |
| 872 | |
| 873 | |
| 874 /*********************************************************************** | |
| 875 Frames and faces | |
| 876 ***********************************************************************/ | |
| 877 | |
| 878 /* Initialize face cache and basic faces for frame F. */ | |
|
9529
8e610355cb29
Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents:
9326
diff
changeset
|
879 |
|
8e610355cb29
Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents:
9326
diff
changeset
|
880 void |
| 24995 | 881 init_frame_faces (f) |
| 882 struct frame *f; | |
|
9529
8e610355cb29
Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents:
9326
diff
changeset
|
883 { |
| 24995 | 884 /* Make a face cache, if F doesn't have one. */ |
| 885 if (FRAME_FACE_CACHE (f) == NULL) | |
| 886 FRAME_FACE_CACHE (f) = make_face_cache (f); | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
887 |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
888 #ifdef HAVE_WINDOW_SYSTEM |
| 24995 | 889 /* Make the image cache. */ |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
890 if (FRAME_WINDOW_P (f)) |
|
9529
8e610355cb29
Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents:
9326
diff
changeset
|
891 { |
| 24995 | 892 if (FRAME_X_IMAGE_CACHE (f) == NULL) |
| 893 FRAME_X_IMAGE_CACHE (f) = make_image_cache (); | |
| 894 ++FRAME_X_IMAGE_CACHE (f)->refcount; | |
| 895 } | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
896 #endif /* HAVE_WINDOW_SYSTEM */ |
| 24995 | 897 |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
898 /* Realize basic faces. Must have enough information in frame |
| 24995 | 899 parameters to realize basic faces at this point. */ |
| 900 #ifdef HAVE_X_WINDOWS | |
| 901 if (!FRAME_X_P (f) || FRAME_X_WINDOW (f)) | |
| 902 #endif | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
903 #ifdef WINDOWSNT |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
904 if (!FRAME_WINDOW_P (f) || FRAME_W32_WINDOW (f)) |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
905 #endif |
| 45848 | 906 #ifdef MAC_OS |
| 907 if (!FRAME_MAC_P (f) || FRAME_MAC_WINDOW (f)) | |
| 908 #endif | |
| 24995 | 909 if (!realize_basic_faces (f)) |
| 910 abort (); | |
| 911 } | |
| 912 | |
| 913 | |
| 914 /* Free face cache of frame F. Called from Fdelete_frame. */ | |
| 915 | |
| 916 void | |
| 917 free_frame_faces (f) | |
| 918 struct frame *f; | |
| 919 { | |
| 920 struct face_cache *face_cache = FRAME_FACE_CACHE (f); | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
921 |
| 24995 | 922 if (face_cache) |
| 923 { | |
| 924 free_face_cache (face_cache); | |
| 925 FRAME_FACE_CACHE (f) = NULL; | |
| 926 } | |
| 927 | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
928 #ifdef HAVE_WINDOW_SYSTEM |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
929 if (FRAME_WINDOW_P (f)) |
| 24995 | 930 { |
| 931 struct image_cache *image_cache = FRAME_X_IMAGE_CACHE (f); | |
| 932 if (image_cache) | |
|
9529
8e610355cb29
Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents:
9326
diff
changeset
|
933 { |
| 24995 | 934 --image_cache->refcount; |
| 935 if (image_cache->refcount == 0) | |
| 936 free_image_cache (f); | |
| 937 } | |
| 938 } | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
939 #endif /* HAVE_WINDOW_SYSTEM */ |
| 24995 | 940 } |
| 941 | |
| 942 | |
|
25592
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
943 /* Clear face caches, and recompute basic faces for frame F. Call |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
944 this after changing frame parameters on which those faces depend, |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
945 or when realized faces have been freed due to changing attributes |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
946 of named faces. */ |
| 24995 | 947 |
| 948 void | |
| 949 recompute_basic_faces (f) | |
| 950 struct frame *f; | |
| 951 { | |
| 952 if (FRAME_FACE_CACHE (f)) | |
| 953 { | |
|
25592
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
954 clear_face_cache (0); |
|
26601
e23e3120d84f
(set_lface_from_font_name): Fix previous change.
Gerd Moellmann <gerd@gnu.org>
parents:
26594
diff
changeset
|
955 if (!realize_basic_faces (f)) |
|
e23e3120d84f
(set_lface_from_font_name): Fix previous change.
Gerd Moellmann <gerd@gnu.org>
parents:
26594
diff
changeset
|
956 abort (); |
| 24995 | 957 } |
| 958 } | |
| 959 | |
| 960 | |
| 961 /* Clear the face caches of all frames. CLEAR_FONTS_P non-zero means | |
| 962 try to free unused fonts, too. */ | |
| 963 | |
| 964 void | |
| 965 clear_face_cache (clear_fonts_p) | |
| 966 int clear_fonts_p; | |
| 967 { | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
968 #ifdef HAVE_WINDOW_SYSTEM |
| 24995 | 969 Lisp_Object tail, frame; |
| 970 struct frame *f; | |
| 971 | |
| 972 if (clear_fonts_p | |
| 973 || ++clear_font_table_count == CLEAR_FONT_TABLE_COUNT) | |
| 974 { | |
|
38434
86a4e78aeae0
(clear_face_cache): Clear fonts on a display basis.
Gerd Moellmann <gerd@gnu.org>
parents:
38346
diff
changeset
|
975 struct x_display_info *dpyinfo; |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48384
diff
changeset
|
976 |
|
38434
86a4e78aeae0
(clear_face_cache): Clear fonts on a display basis.
Gerd Moellmann <gerd@gnu.org>
parents:
38346
diff
changeset
|
977 /* Fonts are common for frames on one display, i.e. on |
|
86a4e78aeae0
(clear_face_cache): Clear fonts on a display basis.
Gerd Moellmann <gerd@gnu.org>
parents:
38346
diff
changeset
|
978 one X screen. */ |
|
86a4e78aeae0
(clear_face_cache): Clear fonts on a display basis.
Gerd Moellmann <gerd@gnu.org>
parents:
38346
diff
changeset
|
979 for (dpyinfo = x_display_list; dpyinfo; dpyinfo = dpyinfo->next) |
|
86a4e78aeae0
(clear_face_cache): Clear fonts on a display basis.
Gerd Moellmann <gerd@gnu.org>
parents:
38346
diff
changeset
|
980 if (dpyinfo->n_fonts > CLEAR_FONT_TABLE_NFONTS) |
|
86a4e78aeae0
(clear_face_cache): Clear fonts on a display basis.
Gerd Moellmann <gerd@gnu.org>
parents:
38346
diff
changeset
|
981 clear_font_table (dpyinfo); |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48384
diff
changeset
|
982 |
| 24995 | 983 /* From time to time see if we can unload some fonts. This also |
| 984 frees all realized faces on all frames. Fonts needed by | |
| 985 faces will be loaded again when faces are realized again. */ | |
| 986 clear_font_table_count = 0; | |
| 987 | |
| 988 FOR_EACH_FRAME (tail, frame) | |
| 989 { | |
|
38434
86a4e78aeae0
(clear_face_cache): Clear fonts on a display basis.
Gerd Moellmann <gerd@gnu.org>
parents:
38346
diff
changeset
|
990 struct frame *f = XFRAME (frame); |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
991 if (FRAME_WINDOW_P (f) |
| 24995 | 992 && FRAME_X_DISPLAY_INFO (f)->n_fonts > CLEAR_FONT_TABLE_NFONTS) |
|
38434
86a4e78aeae0
(clear_face_cache): Clear fonts on a display basis.
Gerd Moellmann <gerd@gnu.org>
parents:
38346
diff
changeset
|
993 free_all_realized_faces (frame); |
|
9529
8e610355cb29
Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents:
9326
diff
changeset
|
994 } |
|
8e610355cb29
Eliminate the "display faces"; store GCs in the "computed faces".
Richard M. Stallman <rms@gnu.org>
parents:
9326
diff
changeset
|
995 } |
| 24995 | 996 else |
|
13460
5513606156bc
(unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents:
13363
diff
changeset
|
997 { |
| 24995 | 998 /* Clear GCs of realized faces. */ |
| 999 FOR_EACH_FRAME (tail, frame) | |
|
13460
5513606156bc
(unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents:
13363
diff
changeset
|
1000 { |
| 24995 | 1001 f = XFRAME (frame); |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
1002 if (FRAME_WINDOW_P (f)) |
| 24995 | 1003 { |
| 1004 clear_face_gcs (FRAME_FACE_CACHE (f)); | |
| 1005 clear_image_cache (f, 0); | |
| 1006 } | |
|
13460
5513606156bc
(unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents:
13363
diff
changeset
|
1007 } |
|
5513606156bc
(unload_font): Invalidate computed faces.
Richard M. Stallman <rms@gnu.org>
parents:
13363
diff
changeset
|
1008 } |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
1009 #endif /* HAVE_WINDOW_SYSTEM */ |
|
2730
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
1010 } |
|
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
1011 |
| 24995 | 1012 |
| 1013 DEFUN ("clear-face-cache", Fclear_face_cache, Sclear_face_cache, 0, 1, 0, | |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
1014 doc: /* Clear face caches on all frames. |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
1015 Optional THOROUGHLY non-nil means try to free unused fonts, too. */) |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
1016 (thoroughly) |
|
35843
c032770ba567
(Fclear_face_cache): Rename the `thorougly' argument
Eli Zaretskii <eliz@gnu.org>
parents:
35443
diff
changeset
|
1017 Lisp_Object thoroughly; |
|
c032770ba567
(Fclear_face_cache): Rename the `thorougly' argument
Eli Zaretskii <eliz@gnu.org>
parents:
35443
diff
changeset
|
1018 { |
|
c032770ba567
(Fclear_face_cache): Rename the `thorougly' argument
Eli Zaretskii <eliz@gnu.org>
parents:
35443
diff
changeset
|
1019 clear_face_cache (!NILP (thoroughly)); |
|
30973
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
1020 ++face_change_count; |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
1021 ++windows_or_buffers_changed; |
| 24995 | 1022 return Qnil; |
|
2730
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
1023 } |
|
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
1024 |
| 24995 | 1025 |
| 1026 | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
1027 #ifdef HAVE_WINDOW_SYSTEM |
| 24995 | 1028 |
| 1029 | |
| 38435 | 1030 /* Remove fonts from the font table of DPYINFO except for the default |
| 1031 ASCII fonts of frames on that display. Called from clear_face_cache | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
1032 from time to time. */ |
| 24995 | 1033 |
| 1034 static void | |
|
38434
86a4e78aeae0
(clear_face_cache): Clear fonts on a display basis.
Gerd Moellmann <gerd@gnu.org>
parents:
38346
diff
changeset
|
1035 clear_font_table (dpyinfo) |
|
86a4e78aeae0
(clear_face_cache): Clear fonts on a display basis.
Gerd Moellmann <gerd@gnu.org>
parents:
38346
diff
changeset
|
1036 struct x_display_info *dpyinfo; |
|
86a4e78aeae0
(clear_face_cache): Clear fonts on a display basis.
Gerd Moellmann <gerd@gnu.org>
parents:
38346
diff
changeset
|
1037 { |
| 24995 | 1038 int i; |
| 1039 | |
|
38434
86a4e78aeae0
(clear_face_cache): Clear fonts on a display basis.
Gerd Moellmann <gerd@gnu.org>
parents:
38346
diff
changeset
|
1040 /* Free those fonts that are not used by frames on DPYINFO. */ |
| 24995 | 1041 for (i = 0; i < dpyinfo->n_fonts; ++i) |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
1042 { |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
1043 struct font_info *font_info = dpyinfo->font_table + i; |
|
38434
86a4e78aeae0
(clear_face_cache): Clear fonts on a display basis.
Gerd Moellmann <gerd@gnu.org>
parents:
38346
diff
changeset
|
1044 Lisp_Object tail, frame; |
|
86a4e78aeae0
(clear_face_cache): Clear fonts on a display basis.
Gerd Moellmann <gerd@gnu.org>
parents:
38346
diff
changeset
|
1045 |
|
86a4e78aeae0
(clear_face_cache): Clear fonts on a display basis.
Gerd Moellmann <gerd@gnu.org>
parents:
38346
diff
changeset
|
1046 /* Check if slot is already free. */ |
|
86a4e78aeae0
(clear_face_cache): Clear fonts on a display basis.
Gerd Moellmann <gerd@gnu.org>
parents:
38346
diff
changeset
|
1047 if (font_info->name == NULL) |
|
86a4e78aeae0
(clear_face_cache): Clear fonts on a display basis.
Gerd Moellmann <gerd@gnu.org>
parents:
38346
diff
changeset
|
1048 continue; |
|
86a4e78aeae0
(clear_face_cache): Clear fonts on a display basis.
Gerd Moellmann <gerd@gnu.org>
parents:
38346
diff
changeset
|
1049 |
|
44705
413dd322c77d
(clear_font_table): Don't free the default font of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43270
diff
changeset
|
1050 /* Don't free a default font of some frame. */ |
|
38434
86a4e78aeae0
(clear_face_cache): Clear fonts on a display basis.
Gerd Moellmann <gerd@gnu.org>
parents:
38346
diff
changeset
|
1051 FOR_EACH_FRAME (tail, frame) |
|
86a4e78aeae0
(clear_face_cache): Clear fonts on a display basis.
Gerd Moellmann <gerd@gnu.org>
parents:
38346
diff
changeset
|
1052 { |
|
86a4e78aeae0
(clear_face_cache): Clear fonts on a display basis.
Gerd Moellmann <gerd@gnu.org>
parents:
38346
diff
changeset
|
1053 struct frame *f = XFRAME (frame); |
|
86a4e78aeae0
(clear_face_cache): Clear fonts on a display basis.
Gerd Moellmann <gerd@gnu.org>
parents:
38346
diff
changeset
|
1054 if (FRAME_WINDOW_P (f) |
|
86a4e78aeae0
(clear_face_cache): Clear fonts on a display basis.
Gerd Moellmann <gerd@gnu.org>
parents:
38346
diff
changeset
|
1055 && font_info->font == FRAME_FONT (f)) |
|
86a4e78aeae0
(clear_face_cache): Clear fonts on a display basis.
Gerd Moellmann <gerd@gnu.org>
parents:
38346
diff
changeset
|
1056 break; |
|
86a4e78aeae0
(clear_face_cache): Clear fonts on a display basis.
Gerd Moellmann <gerd@gnu.org>
parents:
38346
diff
changeset
|
1057 } |
|
86a4e78aeae0
(clear_face_cache): Clear fonts on a display basis.
Gerd Moellmann <gerd@gnu.org>
parents:
38346
diff
changeset
|
1058 |
|
86a4e78aeae0
(clear_face_cache): Clear fonts on a display basis.
Gerd Moellmann <gerd@gnu.org>
parents:
38346
diff
changeset
|
1059 if (!NILP (tail)) |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
1060 continue; |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
1061 |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
1062 /* Free names. */ |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
1063 if (font_info->full_name != font_info->name) |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
1064 xfree (font_info->full_name); |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
1065 xfree (font_info->name); |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
1066 |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
1067 /* Free the font. */ |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
1068 BLOCK_INPUT; |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
1069 #ifdef HAVE_X_WINDOWS |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
1070 XFreeFont (dpyinfo->display, font_info->font); |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
1071 #endif |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
1072 #ifdef WINDOWSNT |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
1073 w32_unload_font (dpyinfo, font_info->font); |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
1074 #endif |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
1075 UNBLOCK_INPUT; |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
1076 |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
1077 /* Mark font table slot free. */ |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
1078 font_info->font = NULL; |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
1079 font_info->name = font_info->full_name = NULL; |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
1080 } |
|
9564
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1081 } |
|
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1082 |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
1083 #endif /* HAVE_WINDOW_SYSTEM */ |
| 24995 | 1084 |
| 1085 | |
| 1086 | |
| 1087 /*********************************************************************** | |
| 1088 X Pixmaps | |
| 1089 ***********************************************************************/ | |
| 1090 | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
1091 #ifdef HAVE_WINDOW_SYSTEM |
| 24995 | 1092 |
|
25890
b10a34d40b55
(Qbitmap_spec_p): Replaces Qpixmap_spec_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25883
diff
changeset
|
1093 DEFUN ("bitmap-spec-p", Fbitmap_spec_p, Sbitmap_spec_p, 1, 1, 0, |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
1094 doc: /* Value is non-nil if OBJECT is a valid bitmap specification. |
|
39914
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
1095 A bitmap specification is either a string, a file name, or a list |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
1096 \(WIDTH HEIGHT DATA) where WIDTH is the pixel width of the bitmap, |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
1097 HEIGHT is its height, and DATA is a string containing the bits of |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
1098 the pixmap. Bits are stored row by row, each row occupies |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
1099 \(WIDTH + 7)/8 bytes. */) |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
1100 (object) |
|
14090
24b93860d392
(Fpixmap_spec_p): Harmonize arguments with documentation.
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
1101 Lisp_Object object; |
|
9564
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1102 { |
|
25883
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1103 int pixmap_p = 0; |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
1104 |
|
25883
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1105 if (STRINGP (object)) |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1106 /* If OBJECT is a string, it's a file name. */ |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1107 pixmap_p = 1; |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1108 else if (CONSP (object)) |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1109 { |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1110 /* Otherwise OBJECT must be (WIDTH HEIGHT DATA), WIDTH and |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1111 HEIGHT must be integers > 0, and DATA must be string large |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1112 enough to hold a bitmap of the specified size. */ |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1113 Lisp_Object width, height, data; |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1114 |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1115 height = width = data = Qnil; |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
1116 |
|
25883
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1117 if (CONSP (object)) |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1118 { |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1119 width = XCAR (object); |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1120 object = XCDR (object); |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1121 if (CONSP (object)) |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1122 { |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1123 height = XCAR (object); |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1124 object = XCDR (object); |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1125 if (CONSP (object)) |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1126 data = XCAR (object); |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1127 } |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1128 } |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1129 |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1130 if (NATNUMP (width) && NATNUMP (height) && STRINGP (data)) |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1131 { |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1132 int bytes_per_row = ((XFASTINT (width) + BITS_PER_CHAR - 1) |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1133 / BITS_PER_CHAR); |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
1134 if (SBYTES (data) >= bytes_per_row * XINT (height)) |
|
25883
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1135 pixmap_p = 1; |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1136 } |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1137 } |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1138 |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
1139 return pixmap_p ? Qt : Qnil; |
|
9564
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1140 } |
|
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1141 |
| 24995 | 1142 |
| 1143 /* Load a bitmap according to NAME (which is either a file name or a | |
| 1144 pixmap spec) for use on frame F. Value is the bitmap_id (see | |
| 1145 xfns.c). If NAME is nil, return with a bitmap id of zero. If | |
| 1146 bitmap cannot be loaded, display a message saying so, and return | |
| 1147 zero. Store the bitmap width in *W_PTR and its height in *H_PTR, | |
| 1148 if these pointers are not null. */ | |
| 1149 | |
| 1150 static int | |
|
9564
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1151 load_pixmap (f, name, w_ptr, h_ptr) |
|
9902
32ed712a45a3
(load_pixmap): Handle bitmap_id < 0. F is a FRAME_PTR.
Richard M. Stallman <rms@gnu.org>
parents:
9671
diff
changeset
|
1152 FRAME_PTR f; |
|
9564
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1153 Lisp_Object name; |
|
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1154 unsigned int *w_ptr, *h_ptr; |
|
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1155 { |
|
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1156 int bitmap_id; |
|
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1157 Lisp_Object tem; |
|
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1158 |
|
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1159 if (NILP (name)) |
| 24995 | 1160 return 0; |
|
9564
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1161 |
|
25890
b10a34d40b55
(Qbitmap_spec_p): Replaces Qpixmap_spec_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25883
diff
changeset
|
1162 tem = Fbitmap_spec_p (name); |
|
9564
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1163 if (NILP (tem)) |
|
25890
b10a34d40b55
(Qbitmap_spec_p): Replaces Qpixmap_spec_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25883
diff
changeset
|
1164 wrong_type_argument (Qbitmap_spec_p, name); |
|
9564
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1165 |
|
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1166 BLOCK_INPUT; |
|
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1167 if (CONSP (name)) |
|
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1168 { |
|
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1169 /* Decode a bitmap spec into a bitmap. */ |
|
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1170 |
|
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1171 int h, w; |
|
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1172 Lisp_Object bits; |
|
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1173 |
|
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1174 w = XINT (Fcar (name)); |
|
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1175 h = XINT (Fcar (Fcdr (name))); |
|
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1176 bits = Fcar (Fcdr (Fcdr (name))); |
|
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1177 |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
1178 bitmap_id = x_create_bitmap_from_data (f, SDATA (bits), |
|
9564
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1179 w, h); |
|
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1180 } |
|
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1181 else |
|
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1182 { |
|
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1183 /* It must be a string -- a file name. */ |
|
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1184 bitmap_id = x_create_bitmap_from_file (f, name); |
|
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1185 } |
|
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1186 UNBLOCK_INPUT; |
|
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1187 |
|
9902
32ed712a45a3
(load_pixmap): Handle bitmap_id < 0. F is a FRAME_PTR.
Richard M. Stallman <rms@gnu.org>
parents:
9671
diff
changeset
|
1188 if (bitmap_id < 0) |
| 24995 | 1189 { |
|
25799
1c370ec939da
(load_pixmap): Call add_to_log without frame parameter.
Gerd Moellmann <gerd@gnu.org>
parents:
25678
diff
changeset
|
1190 add_to_log ("Invalid or undefined bitmap %s", name, Qnil); |
| 24995 | 1191 bitmap_id = 0; |
| 1192 | |
| 1193 if (w_ptr) | |
| 1194 *w_ptr = 0; | |
| 1195 if (h_ptr) | |
| 1196 *h_ptr = 0; | |
| 1197 } | |
| 1198 else | |
| 1199 { | |
| 1200 #if GLYPH_DEBUG | |
| 1201 ++npixmaps_allocated; | |
| 1202 #endif | |
| 1203 if (w_ptr) | |
| 1204 *w_ptr = x_bitmap_width (f, bitmap_id); | |
| 1205 | |
| 1206 if (h_ptr) | |
| 1207 *h_ptr = x_bitmap_height (f, bitmap_id); | |
| 1208 } | |
|
9564
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1209 |
|
1bfb920ab23e
(intern_face): Set the fill_style.
Richard M. Stallman <rms@gnu.org>
parents:
9529
diff
changeset
|
1210 return bitmap_id; |
|
2730
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
1211 } |
| 9572 | 1212 |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
1213 #endif /* HAVE_WINDOW_SYSTEM */ |
| 24995 | 1214 |
| 9572 | 1215 |
| 2336 | 1216 |
| 24995 | 1217 /*********************************************************************** |
| 1218 Fonts | |
| 1219 ***********************************************************************/ | |
| 1220 | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
1221 #ifdef HAVE_WINDOW_SYSTEM |
| 24995 | 1222 |
| 88907 | 1223 /* Load font of face FACE which is used on frame F to display ASCII |
|
89047
3b6234eb229c
(QCfontset): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88939
diff
changeset
|
1224 characters. The name of the font to load is determined by lface. */ |
|
6784
d41c216ccd27
(frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents:
6768
diff
changeset
|
1225 |
|
3074
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
1226 static void |
| 88907 | 1227 load_face_font (f, face) |
| 24995 | 1228 struct frame *f; |
| 1229 struct face *face; | |
| 1230 { | |
| 1231 struct font_info *font_info = NULL; | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
1232 char *font_name; |
|
48384
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
1233 int needs_overstrike; |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
1234 |
| 24995 | 1235 face->font_info_id = -1; |
| 1236 face->font = NULL; | |
| 88907 | 1237 face->font_name = NULL; |
| 1238 | |
| 89483 | 1239 font_name = choose_face_font (f, face->lface, Qnil, &needs_overstrike); |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
1240 if (!font_name) |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
1241 return; |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
1242 |
| 24995 | 1243 BLOCK_INPUT; |
|
88394
b954eee715da
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
43270
diff
changeset
|
1244 font_info = FS_LOAD_FONT (f, font_name); |
| 24995 | 1245 UNBLOCK_INPUT; |
| 1246 | |
| 1247 if (font_info) | |
| 1248 { | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
1249 face->font_info_id = font_info->font_idx; |
| 24995 | 1250 face->font = font_info->font; |
| 1251 face->font_name = font_info->full_name; | |
|
48384
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
1252 face->overstrike = needs_overstrike; |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
1253 if (face->gc) |
| 24995 | 1254 { |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
1255 x_free_gc (f, face->gc); |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
1256 face->gc = 0; |
| 24995 | 1257 } |
| 1258 } | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
1259 else |
|
25799
1c370ec939da
(load_pixmap): Call add_to_log without frame parameter.
Gerd Moellmann <gerd@gnu.org>
parents:
25678
diff
changeset
|
1260 add_to_log ("Unable to load font %s", |
|
25301
2042c4a224ad
(add_to_log): Renamed from display_message.
Gerd Moellmann <gerd@gnu.org>
parents:
25270
diff
changeset
|
1261 build_string (font_name), Qnil); |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
1262 xfree (font_name); |
| 24995 | 1263 } |
| 1264 | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
1265 #endif /* HAVE_WINDOW_SYSTEM */ |
| 24995 | 1266 |
| 1267 | |
| 1268 | |
| 1269 /*********************************************************************** | |
| 1270 X Colors | |
| 1271 ***********************************************************************/ | |
| 1272 | |
|
45718
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1273 /* Parse RGB_LIST, and fill in the RGB fields of COLOR. |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1274 RGB_LIST should contain (at least) 3 lisp integers. |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1275 Return 0 if there's a problem with RGB_LIST, otherwise return 1. */ |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1276 |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1277 static int |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1278 parse_rgb_list (rgb_list, color) |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1279 Lisp_Object rgb_list; |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1280 XColor *color; |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1281 { |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1282 #define PARSE_RGB_LIST_FIELD(field) \ |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1283 if (CONSP (rgb_list) && INTEGERP (XCAR (rgb_list))) \ |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1284 { \ |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1285 color->field = XINT (XCAR (rgb_list)); \ |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1286 rgb_list = XCDR (rgb_list); \ |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1287 } \ |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1288 else \ |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1289 return 0; |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1290 |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1291 PARSE_RGB_LIST_FIELD (red); |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1292 PARSE_RGB_LIST_FIELD (green); |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1293 PARSE_RGB_LIST_FIELD (blue); |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1294 |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1295 return 1; |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1296 } |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1297 |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1298 |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1299 /* Lookup on frame F the color described by the lisp string COLOR. |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1300 The resulting tty color is returned in TTY_COLOR; if STD_COLOR is |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1301 non-zero, then the `standard' definition of the same color is |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1302 returned in it. */ |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1303 |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1304 static int |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1305 tty_lookup_color (f, color, tty_color, std_color) |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1306 struct frame *f; |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1307 Lisp_Object color; |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1308 XColor *tty_color, *std_color; |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1309 { |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1310 Lisp_Object frame, color_desc; |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1311 |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1312 if (!STRINGP (color) || NILP (Ffboundp (Qtty_color_desc))) |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1313 return 0; |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1314 |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1315 XSETFRAME (frame, f); |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1316 |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1317 color_desc = call2 (Qtty_color_desc, color, frame); |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1318 if (CONSP (color_desc) && CONSP (XCDR (color_desc))) |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1319 { |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1320 Lisp_Object rgb; |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1321 |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1322 if (! INTEGERP (XCAR (XCDR (color_desc)))) |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1323 return 0; |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1324 |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1325 tty_color->pixel = XINT (XCAR (XCDR (color_desc))); |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1326 |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1327 rgb = XCDR (XCDR (color_desc)); |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1328 if (! parse_rgb_list (rgb, tty_color)) |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1329 return 0; |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1330 |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1331 /* Should we fill in STD_COLOR too? */ |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1332 if (std_color) |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1333 { |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1334 /* Default STD_COLOR to the same as TTY_COLOR. */ |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1335 *std_color = *tty_color; |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1336 |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1337 /* Do a quick check to see if the returned descriptor is |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1338 actually _exactly_ equal to COLOR, otherwise we have to |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1339 lookup STD_COLOR separately. If it's impossible to lookup |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1340 a standard color, we just give up and use TTY_COLOR. */ |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1341 if ((!STRINGP (XCAR (color_desc)) |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1342 || NILP (Fstring_equal (color, XCAR (color_desc)))) |
|
45746
8f026a28517c
(tty_lookup_color): Type bool/Lisp_Object mismatch fixed.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
45718
diff
changeset
|
1343 && !NILP (Ffboundp (Qtty_color_standard_values))) |
|
45718
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1344 { |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1345 /* Look up STD_COLOR separately. */ |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1346 rgb = call1 (Qtty_color_standard_values, color); |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1347 if (! parse_rgb_list (rgb, std_color)) |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1348 return 0; |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1349 } |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1350 } |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1351 |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1352 return 1; |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1353 } |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1354 else if (NILP (Fsymbol_value (intern ("tty-defined-color-alist")))) |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1355 /* We were called early during startup, and the colors are not |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1356 yet set up in tty-defined-color-alist. Don't return a failure |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1357 indication, since this produces the annoying "Unable to |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1358 load color" messages in the *Messages* buffer. */ |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1359 return 1; |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1360 else |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1361 /* tty-color-desc seems to have returned a bad value. */ |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1362 return 0; |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1363 } |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1364 |
|
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1365 /* A version of defined_color for non-X frames. */ |
|
29599
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1366 |
|
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1367 int |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1368 tty_defined_color (f, color_name, color_def, alloc) |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1369 struct frame *f; |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1370 char *color_name; |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1371 XColor *color_def; |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1372 int alloc; |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1373 { |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1374 int status = 1; |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1375 |
|
45718
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1376 /* Defaults. */ |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48384
diff
changeset
|
1377 color_def->pixel = FACE_TTY_DEFAULT_COLOR; |
|
45718
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1378 color_def->red = 0; |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1379 color_def->blue = 0; |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1380 color_def->green = 0; |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1381 |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1382 if (*color_name) |
|
89554
15da46f6f0ac
(face_numeric_value): Declare dim size_t.
Dave Love <fx@gnu.org>
parents:
89483
diff
changeset
|
1383 status = tty_lookup_color (f, build_string (color_name), color_def, NULL); |
|
45718
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1384 |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1385 if (color_def->pixel == FACE_TTY_DEFAULT_COLOR && *color_name) |
|
26902
264b83a3a688
Changes for separate unspecified foreground and background colors
Eli Zaretskii <eliz@gnu.org>
parents:
26875
diff
changeset
|
1386 { |
|
264b83a3a688
Changes for separate unspecified foreground and background colors
Eli Zaretskii <eliz@gnu.org>
parents:
26875
diff
changeset
|
1387 if (strcmp (color_name, "unspecified-fg") == 0) |
|
45718
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1388 color_def->pixel = FACE_TTY_DEFAULT_FG_COLOR; |
|
26902
264b83a3a688
Changes for separate unspecified foreground and background colors
Eli Zaretskii <eliz@gnu.org>
parents:
26875
diff
changeset
|
1389 else if (strcmp (color_name, "unspecified-bg") == 0) |
|
45718
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1390 color_def->pixel = FACE_TTY_DEFAULT_BG_COLOR; |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1391 } |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1392 |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
1393 if (color_def->pixel != FACE_TTY_DEFAULT_COLOR) |
|
27743
2e020ab026b8
(tty_defined_color): Don't return faulire indication
Eli Zaretskii <eliz@gnu.org>
parents:
27695
diff
changeset
|
1394 status = 1; |
|
2e020ab026b8
(tty_defined_color): Don't return faulire indication
Eli Zaretskii <eliz@gnu.org>
parents:
27695
diff
changeset
|
1395 |
|
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1396 return status; |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1397 } |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1398 |
|
29599
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1399 |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1400 /* Decide if color named COLOR_NAME is valid for the display |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1401 associated with the frame F; if so, return the rgb values in |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1402 COLOR_DEF. If ALLOC is nonzero, allocate a new colormap cell. |
|
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1403 |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1404 This does the right thing for any type of frame. */ |
|
29599
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1405 |
|
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1406 int |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1407 defined_color (f, color_name, color_def, alloc) |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1408 struct frame *f; |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1409 char *color_name; |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1410 XColor *color_def; |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1411 int alloc; |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1412 { |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1413 if (!FRAME_WINDOW_P (f)) |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1414 return tty_defined_color (f, color_name, color_def, alloc); |
| 24995 | 1415 #ifdef HAVE_X_WINDOWS |
|
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1416 else if (FRAME_X_P (f)) |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1417 return x_defined_color (f, color_name, color_def, alloc); |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1418 #endif |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1419 #ifdef WINDOWSNT |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1420 else if (FRAME_W32_P (f)) |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1421 return w32_defined_color (f, color_name, color_def, alloc); |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1422 #endif |
|
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
44705
diff
changeset
|
1423 #ifdef MAC_OS |
|
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1424 else if (FRAME_MAC_P (f)) |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1425 return mac_defined_color (f, color_name, color_def, alloc); |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1426 #endif |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1427 else |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1428 abort (); |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1429 } |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1430 |
|
29599
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1431 |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1432 /* Given the index IDX of a tty color on frame F, return its name, a |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1433 Lisp string. */ |
|
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1434 |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1435 Lisp_Object |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1436 tty_color_name (f, idx) |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1437 struct frame *f; |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1438 int idx; |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1439 { |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1440 if (idx >= 0 && !NILP (Ffboundp (Qtty_color_by_index))) |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1441 { |
|
27088
23bd823f11f4
(tty_defined_color): Pass frame to tty-color-desc. The
Eli Zaretskii <eliz@gnu.org>
parents:
26976
diff
changeset
|
1442 Lisp_Object frame; |
|
23bd823f11f4
(tty_defined_color): Pass frame to tty-color-desc. The
Eli Zaretskii <eliz@gnu.org>
parents:
26976
diff
changeset
|
1443 Lisp_Object coldesc; |
|
23bd823f11f4
(tty_defined_color): Pass frame to tty-color-desc. The
Eli Zaretskii <eliz@gnu.org>
parents:
26976
diff
changeset
|
1444 |
|
23bd823f11f4
(tty_defined_color): Pass frame to tty-color-desc. The
Eli Zaretskii <eliz@gnu.org>
parents:
26976
diff
changeset
|
1445 XSETFRAME (frame, f); |
|
23bd823f11f4
(tty_defined_color): Pass frame to tty-color-desc. The
Eli Zaretskii <eliz@gnu.org>
parents:
26976
diff
changeset
|
1446 coldesc = call2 (Qtty_color_by_index, make_number (idx), frame); |
|
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1447 |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1448 if (!NILP (coldesc)) |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1449 return XCAR (coldesc); |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1450 } |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1451 #ifdef MSDOS |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1452 /* We can have an MSDOG frame under -nw for a short window of |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1453 opportunity before internal_terminal_init is called. DTRT. */ |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1454 if (FRAME_MSDOS_P (f) && !inhibit_window_system) |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1455 return msdos_stdcolor_name (idx); |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1456 #endif |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1457 |
|
27114
4efa5e54e9a9
(Qunspecified_fg, Qunspecified_bg): Remove.
Eli Zaretskii <eliz@gnu.org>
parents:
27100
diff
changeset
|
1458 if (idx == FACE_TTY_DEFAULT_FG_COLOR) |
|
4efa5e54e9a9
(Qunspecified_fg, Qunspecified_bg): Remove.
Eli Zaretskii <eliz@gnu.org>
parents:
27100
diff
changeset
|
1459 return build_string (unspecified_fg); |
|
4efa5e54e9a9
(Qunspecified_fg, Qunspecified_bg): Remove.
Eli Zaretskii <eliz@gnu.org>
parents:
27100
diff
changeset
|
1460 if (idx == FACE_TTY_DEFAULT_BG_COLOR) |
|
4efa5e54e9a9
(Qunspecified_fg, Qunspecified_bg): Remove.
Eli Zaretskii <eliz@gnu.org>
parents:
27100
diff
changeset
|
1461 return build_string (unspecified_bg); |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
1462 |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
1463 #ifdef WINDOWSNT |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
1464 return vga_stdcolor_name (idx); |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
1465 #endif |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
1466 |
|
27114
4efa5e54e9a9
(Qunspecified_fg, Qunspecified_bg): Remove.
Eli Zaretskii <eliz@gnu.org>
parents:
27100
diff
changeset
|
1467 return Qunspecified; |
|
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1468 } |
| 24995 | 1469 |
|
29599
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1470 |
| 24995 | 1471 /* Return non-zero if COLOR_NAME is a shade of gray (or white or |
| 1472 black) on frame F. The algorithm is taken from 20.2 faces.el. */ | |
| 1473 | |
| 1474 static int | |
| 1475 face_color_gray_p (f, color_name) | |
| 1476 struct frame *f; | |
| 1477 char *color_name; | |
| 1478 { | |
| 1479 XColor color; | |
| 1480 int gray_p; | |
| 1481 | |
| 1482 if (defined_color (f, color_name, &color, 0)) | |
| 1483 gray_p = ((abs (color.red - color.green) | |
| 1484 < max (color.red, color.green) / 20) | |
| 1485 && (abs (color.green - color.blue) | |
| 1486 < max (color.green, color.blue) / 20) | |
| 1487 && (abs (color.blue - color.red) | |
| 1488 < max (color.blue, color.red) / 20)); | |
| 1489 else | |
| 1490 gray_p = 0; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
1491 |
| 24995 | 1492 return gray_p; |
| 1493 } | |
| 1494 | |
| 1495 | |
| 1496 /* Return non-zero if color COLOR_NAME can be displayed on frame F. | |
| 1497 BACKGROUND_P non-zero means the color will be used as background | |
| 1498 color. */ | |
| 1499 | |
| 1500 static int | |
| 1501 face_color_supported_p (f, color_name, background_p) | |
| 1502 struct frame *f; | |
| 1503 char *color_name; | |
| 1504 int background_p; | |
| 1505 { | |
| 1506 Lisp_Object frame; | |
|
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1507 XColor not_used; |
| 24995 | 1508 |
| 1509 XSETFRAME (frame, f); | |
|
54766
b87089cc7e4c
(face_color_supported_p): Fix compilation without X11.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53901
diff
changeset
|
1510 return |
|
b87089cc7e4c
(face_color_supported_p): Fix compilation without X11.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53901
diff
changeset
|
1511 #ifdef HAVE_X_WINDOWS |
|
b87089cc7e4c
(face_color_supported_p): Fix compilation without X11.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53901
diff
changeset
|
1512 FRAME_WINDOW_P (f) |
|
b87089cc7e4c
(face_color_supported_p): Fix compilation without X11.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53901
diff
changeset
|
1513 ? (!NILP (Fxw_display_color_p (frame)) |
|
b87089cc7e4c
(face_color_supported_p): Fix compilation without X11.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53901
diff
changeset
|
1514 || xstricmp (color_name, "black") == 0 |
|
b87089cc7e4c
(face_color_supported_p): Fix compilation without X11.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53901
diff
changeset
|
1515 || xstricmp (color_name, "white") == 0 |
|
b87089cc7e4c
(face_color_supported_p): Fix compilation without X11.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53901
diff
changeset
|
1516 || (background_p |
|
b87089cc7e4c
(face_color_supported_p): Fix compilation without X11.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53901
diff
changeset
|
1517 && face_color_gray_p (f, color_name)) |
|
b87089cc7e4c
(face_color_supported_p): Fix compilation without X11.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53901
diff
changeset
|
1518 || (!NILP (Fx_display_grayscale_p (frame)) |
|
b87089cc7e4c
(face_color_supported_p): Fix compilation without X11.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53901
diff
changeset
|
1519 && face_color_gray_p (f, color_name))) |
|
b87089cc7e4c
(face_color_supported_p): Fix compilation without X11.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53901
diff
changeset
|
1520 : |
|
b87089cc7e4c
(face_color_supported_p): Fix compilation without X11.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53901
diff
changeset
|
1521 #endif |
|
b87089cc7e4c
(face_color_supported_p): Fix compilation without X11.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
53901
diff
changeset
|
1522 tty_defined_color (f, color_name, ¬_used, 0); |
|
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1523 } |
| 24995 | 1524 |
| 1525 | |
|
27100
9a0d8503806e
(Fcolor_gray_p): Renamed from face-color-gray-p.
Eli Zaretskii <eliz@gnu.org>
parents:
27088
diff
changeset
|
1526 DEFUN ("color-gray-p", Fcolor_gray_p, Scolor_gray_p, 1, 2, 0, |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
1527 doc: /* Return non-nil if COLOR is a shade of gray (or white or black). |
|
39914
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
1528 FRAME specifies the frame and thus the display for interpreting COLOR. |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
1529 If FRAME is nil or omitted, use the selected frame. */) |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
1530 (color, frame) |
| 24995 | 1531 Lisp_Object color, frame; |
| 1532 { | |
|
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1533 struct frame *f; |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1534 |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
1535 CHECK_STRING (color); |
|
53267
bec1d17789a6
(Fcolor_gray_p): Fix omission bug:
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
52401
diff
changeset
|
1536 if (NILP (frame)) |
|
bec1d17789a6
(Fcolor_gray_p): Fix omission bug:
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
52401
diff
changeset
|
1537 frame = selected_frame; |
|
bec1d17789a6
(Fcolor_gray_p): Fix omission bug:
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
52401
diff
changeset
|
1538 else |
|
bec1d17789a6
(Fcolor_gray_p): Fix omission bug:
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
52401
diff
changeset
|
1539 CHECK_FRAME (frame); |
|
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1540 f = XFRAME (frame); |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
1541 return face_color_gray_p (f, SDATA (color)) ? Qt : Qnil; |
| 24995 | 1542 } |
| 1543 | |
| 1544 | |
|
27100
9a0d8503806e
(Fcolor_gray_p): Renamed from face-color-gray-p.
Eli Zaretskii <eliz@gnu.org>
parents:
27088
diff
changeset
|
1545 DEFUN ("color-supported-p", Fcolor_supported_p, |
|
47471
8ed65bf4ee3d
(Fcolor_supported_p): Just one arg is required.
Richard M. Stallman <rms@gnu.org>
parents:
46556
diff
changeset
|
1546 Scolor_supported_p, 1, 3, 0, |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
1547 doc: /* Return non-nil if COLOR can be displayed on FRAME. |
|
39914
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
1548 BACKGROUND-P non-nil means COLOR is used as a background. |
|
56518
b058a7674dcd
(Fcolor_supported_p): Doc fix.
Luc Teirlinck <teirllm@auburn.edu>
parents:
56296
diff
changeset
|
1549 Otherwise, this function tells whether it can be used as a foreground. |
|
39914
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
1550 If FRAME is nil or omitted, use the selected frame. |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
1551 COLOR must be a valid color name. */) |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
1552 (color, frame, background_p) |
| 24995 | 1553 Lisp_Object frame, color, background_p; |
| 1554 { | |
|
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1555 struct frame *f; |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1556 |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
1557 CHECK_STRING (color); |
|
53267
bec1d17789a6
(Fcolor_gray_p): Fix omission bug:
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
52401
diff
changeset
|
1558 if (NILP (frame)) |
|
bec1d17789a6
(Fcolor_gray_p): Fix omission bug:
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
52401
diff
changeset
|
1559 frame = selected_frame; |
|
bec1d17789a6
(Fcolor_gray_p): Fix omission bug:
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
52401
diff
changeset
|
1560 else |
|
bec1d17789a6
(Fcolor_gray_p): Fix omission bug:
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
52401
diff
changeset
|
1561 CHECK_FRAME (frame); |
|
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1562 f = XFRAME (frame); |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
1563 if (face_color_supported_p (f, SDATA (color), !NILP (background_p))) |
| 24995 | 1564 return Qt; |
| 1565 return Qnil; | |
| 1566 } | |
| 1567 | |
|
29599
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1568 |
| 24995 | 1569 /* Load color with name NAME for use by face FACE on frame F. |
| 1570 TARGET_INDEX must be one of LFACE_FOREGROUND_INDEX, | |
| 1571 LFACE_BACKGROUND_INDEX, LFACE_UNDERLINE_INDEX, LFACE_OVERLINE_INDEX, | |
| 1572 LFACE_STRIKE_THROUGH_INDEX, or LFACE_BOX_INDEX. Value is the | |
| 1573 pixel color. If color cannot be loaded, display a message, and | |
| 1574 return the foreground, background or underline color of F, but | |
| 1575 record that fact in flags of the face so that we don't try to free | |
| 1576 these colors. */ | |
| 1577 | |
|
25114
be5d3e21fbd7
(load_color): Remove static from definition and remove
Eli Zaretskii <eliz@gnu.org>
parents:
25092
diff
changeset
|
1578 unsigned long |
| 24995 | 1579 load_color (f, face, name, target_index) |
| 1580 struct frame *f; | |
| 1581 struct face *face; | |
| 1582 Lisp_Object name; | |
| 1583 enum lface_attribute_index target_index; | |
| 1584 { | |
| 1585 XColor color; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
1586 |
| 24995 | 1587 xassert (STRINGP (name)); |
| 1588 xassert (target_index == LFACE_FOREGROUND_INDEX | |
| 1589 || target_index == LFACE_BACKGROUND_INDEX | |
| 1590 || target_index == LFACE_UNDERLINE_INDEX | |
| 1591 || target_index == LFACE_OVERLINE_INDEX | |
| 1592 || target_index == LFACE_STRIKE_THROUGH_INDEX | |
| 1593 || target_index == LFACE_BOX_INDEX); | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
1594 |
| 24995 | 1595 /* if the color map is full, defined_color will return a best match |
| 1596 to the values in an existing cell. */ | |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
1597 if (!defined_color (f, SDATA (name), &color, 1)) |
| 24995 | 1598 { |
|
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
1599 add_to_log ("Unable to load color \"%s\"", name, Qnil); |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
1600 |
| 24995 | 1601 switch (target_index) |
| 1602 { | |
| 1603 case LFACE_FOREGROUND_INDEX: | |
| 1604 face->foreground_defaulted_p = 1; | |
| 1605 color.pixel = FRAME_FOREGROUND_PIXEL (f); | |
| 1606 break; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
1607 |
| 24995 | 1608 case LFACE_BACKGROUND_INDEX: |
| 1609 face->background_defaulted_p = 1; | |
| 1610 color.pixel = FRAME_BACKGROUND_PIXEL (f); | |
| 1611 break; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
1612 |
| 24995 | 1613 case LFACE_UNDERLINE_INDEX: |
| 1614 face->underline_defaulted_p = 1; | |
| 1615 color.pixel = FRAME_FOREGROUND_PIXEL (f); | |
| 1616 break; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
1617 |
| 24995 | 1618 case LFACE_OVERLINE_INDEX: |
| 1619 face->overline_color_defaulted_p = 1; | |
| 1620 color.pixel = FRAME_FOREGROUND_PIXEL (f); | |
| 1621 break; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
1622 |
| 24995 | 1623 case LFACE_STRIKE_THROUGH_INDEX: |
| 1624 face->strike_through_color_defaulted_p = 1; | |
| 1625 color.pixel = FRAME_FOREGROUND_PIXEL (f); | |
| 1626 break; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
1627 |
| 24995 | 1628 case LFACE_BOX_INDEX: |
| 1629 face->box_color_defaulted_p = 1; | |
| 1630 color.pixel = FRAME_FOREGROUND_PIXEL (f); | |
| 1631 break; | |
| 1632 | |
| 1633 default: | |
| 1634 abort (); | |
| 1635 } | |
| 1636 } | |
| 1637 #if GLYPH_DEBUG | |
| 1638 else | |
| 1639 ++ncolors_allocated; | |
| 1640 #endif | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
1641 |
| 24995 | 1642 return color.pixel; |
| 1643 } | |
| 1644 | |
|
29599
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1645 |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
1646 #ifdef HAVE_WINDOW_SYSTEM |
| 24995 | 1647 |
| 1648 /* Load colors for face FACE which is used on frame F. Colors are | |
| 1649 specified by slots LFACE_BACKGROUND_INDEX and LFACE_FOREGROUND_INDEX | |
| 1650 of ATTRS. If the background color specified is not supported on F, | |
| 1651 try to emulate gray colors with a stipple from Vface_default_stipple. */ | |
| 1652 | |
| 1653 static void | |
| 1654 load_face_colors (f, face, attrs) | |
| 1655 struct frame *f; | |
| 1656 struct face *face; | |
| 1657 Lisp_Object *attrs; | |
| 1658 { | |
| 1659 Lisp_Object fg, bg; | |
| 1660 | |
| 1661 bg = attrs[LFACE_BACKGROUND_INDEX]; | |
| 1662 fg = attrs[LFACE_FOREGROUND_INDEX]; | |
| 1663 | |
| 1664 /* Swap colors if face is inverse-video. */ | |
| 1665 if (EQ (attrs[LFACE_INVERSE_INDEX], Qt)) | |
| 1666 { | |
| 1667 Lisp_Object tmp; | |
| 1668 tmp = fg; | |
| 1669 fg = bg; | |
| 1670 bg = tmp; | |
| 1671 } | |
| 1672 | |
| 1673 /* Check for support for foreground, not for background because | |
| 1674 face_color_supported_p is smart enough to know that grays are | |
| 1675 "supported" as background because we are supposed to use stipple | |
| 1676 for them. */ | |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
1677 if (!face_color_supported_p (f, SDATA (bg), 0) |
|
25890
b10a34d40b55
(Qbitmap_spec_p): Replaces Qpixmap_spec_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25883
diff
changeset
|
1678 && !NILP (Fbitmap_spec_p (Vface_default_stipple))) |
| 24995 | 1679 { |
| 1680 x_destroy_bitmap (f, face->stipple); | |
| 1681 face->stipple = load_pixmap (f, Vface_default_stipple, | |
| 1682 &face->pixmap_w, &face->pixmap_h); | |
| 1683 } | |
|
25092
79a5a567bdb0
(prepare_face_for_display): Use FillOpaqueStippled instead of
Gerd Moellmann <gerd@gnu.org>
parents:
25062
diff
changeset
|
1684 |
|
79a5a567bdb0
(prepare_face_for_display): Use FillOpaqueStippled instead of
Gerd Moellmann <gerd@gnu.org>
parents:
25062
diff
changeset
|
1685 face->background = load_color (f, face, bg, LFACE_BACKGROUND_INDEX); |
| 24995 | 1686 face->foreground = load_color (f, face, fg, LFACE_FOREGROUND_INDEX); |
| 1687 } | |
| 1688 | |
| 1689 | |
| 1690 /* Free color PIXEL on frame F. */ | |
| 1691 | |
| 1692 void | |
| 1693 unload_color (f, pixel) | |
| 1694 struct frame *f; | |
| 1695 unsigned long pixel; | |
| 1696 { | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
1697 #ifdef HAVE_X_WINDOWS |
|
38346
a86234ceb517
(unload_color): Do nothing if PIXEL is -1.
Gerd Moellmann <gerd@gnu.org>
parents:
37798
diff
changeset
|
1698 if (pixel != -1) |
|
a86234ceb517
(unload_color): Do nothing if PIXEL is -1.
Gerd Moellmann <gerd@gnu.org>
parents:
37798
diff
changeset
|
1699 { |
|
a86234ceb517
(unload_color): Do nothing if PIXEL is -1.
Gerd Moellmann <gerd@gnu.org>
parents:
37798
diff
changeset
|
1700 BLOCK_INPUT; |
|
a86234ceb517
(unload_color): Do nothing if PIXEL is -1.
Gerd Moellmann <gerd@gnu.org>
parents:
37798
diff
changeset
|
1701 x_free_colors (f, &pixel, 1); |
|
a86234ceb517
(unload_color): Do nothing if PIXEL is -1.
Gerd Moellmann <gerd@gnu.org>
parents:
37798
diff
changeset
|
1702 UNBLOCK_INPUT; |
|
a86234ceb517
(unload_color): Do nothing if PIXEL is -1.
Gerd Moellmann <gerd@gnu.org>
parents:
37798
diff
changeset
|
1703 } |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
1704 #endif |
| 24995 | 1705 } |
| 1706 | |
| 1707 | |
| 1708 /* Free colors allocated for FACE. */ | |
| 1709 | |
| 1710 static void | |
| 1711 free_face_colors (f, face) | |
| 1712 struct frame *f; | |
|
3074
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
1713 struct face *face; |
|
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
1714 { |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
1715 #ifdef HAVE_X_WINDOWS |
|
40555
dfc4450c2329
(realize_x_face): If C is not a single-byte character,
Gerd Moellmann <gerd@gnu.org>
parents:
40532
diff
changeset
|
1716 if (face->colors_copied_bitwise_p) |
|
dfc4450c2329
(realize_x_face): If C is not a single-byte character,
Gerd Moellmann <gerd@gnu.org>
parents:
40532
diff
changeset
|
1717 return; |
|
dfc4450c2329
(realize_x_face): If C is not a single-byte character,
Gerd Moellmann <gerd@gnu.org>
parents:
40532
diff
changeset
|
1718 |
|
29599
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1719 BLOCK_INPUT; |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
1720 |
|
29599
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1721 if (!face->foreground_defaulted_p) |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1722 { |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1723 x_free_colors (f, &face->foreground, 1); |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1724 IF_DEBUG (--ncolors_allocated); |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1725 } |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
1726 |
|
29599
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1727 if (!face->background_defaulted_p) |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1728 { |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1729 x_free_colors (f, &face->background, 1); |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1730 IF_DEBUG (--ncolors_allocated); |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1731 } |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1732 |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1733 if (face->underline_p |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1734 && !face->underline_defaulted_p) |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1735 { |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1736 x_free_colors (f, &face->underline_color, 1); |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1737 IF_DEBUG (--ncolors_allocated); |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1738 } |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1739 |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1740 if (face->overline_p |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1741 && !face->overline_color_defaulted_p) |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1742 { |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1743 x_free_colors (f, &face->overline_color, 1); |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1744 IF_DEBUG (--ncolors_allocated); |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1745 } |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1746 |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1747 if (face->strike_through_p |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1748 && !face->strike_through_color_defaulted_p) |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1749 { |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1750 x_free_colors (f, &face->strike_through_color, 1); |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1751 IF_DEBUG (--ncolors_allocated); |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1752 } |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1753 |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1754 if (face->box != FACE_NO_BOX |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1755 && !face->box_color_defaulted_p) |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1756 { |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1757 x_free_colors (f, &face->box_color, 1); |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1758 IF_DEBUG (--ncolors_allocated); |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1759 } |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1760 |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1761 UNBLOCK_INPUT; |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
1762 #endif /* HAVE_X_WINDOWS */ |
| 24995 | 1763 } |
|
29599
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
1764 |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
1765 #endif /* HAVE_WINDOW_SYSTEM */ |
| 24995 | 1766 |
| 1767 | |
| 1768 | |
| 1769 /*********************************************************************** | |
| 1770 XLFD Font Names | |
| 1771 ***********************************************************************/ | |
| 1772 | |
| 1773 /* An enumerator for each field of an XLFD font name. */ | |
| 1774 | |
| 1775 enum xlfd_field | |
| 1776 { | |
| 1777 XLFD_FOUNDRY, | |
| 1778 XLFD_FAMILY, | |
| 1779 XLFD_WEIGHT, | |
| 1780 XLFD_SLANT, | |
| 1781 XLFD_SWIDTH, | |
| 1782 XLFD_ADSTYLE, | |
| 1783 XLFD_PIXEL_SIZE, | |
| 1784 XLFD_POINT_SIZE, | |
| 1785 XLFD_RESX, | |
| 1786 XLFD_RESY, | |
| 1787 XLFD_SPACING, | |
| 1788 XLFD_AVGWIDTH, | |
| 1789 XLFD_REGISTRY, | |
| 1790 XLFD_ENCODING, | |
| 1791 XLFD_LAST | |
| 1792 }; | |
| 1793 | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
1794 /* An enumerator for each possible slant value of a font. Taken from |
| 24995 | 1795 the XLFD specification. */ |
| 1796 | |
| 1797 enum xlfd_slant | |
| 1798 { | |
| 1799 XLFD_SLANT_UNKNOWN, | |
| 1800 XLFD_SLANT_ROMAN, | |
| 1801 XLFD_SLANT_ITALIC, | |
| 1802 XLFD_SLANT_OBLIQUE, | |
| 1803 XLFD_SLANT_REVERSE_ITALIC, | |
| 1804 XLFD_SLANT_REVERSE_OBLIQUE, | |
| 1805 XLFD_SLANT_OTHER | |
| 1806 }; | |
| 1807 | |
| 1808 /* Relative font weight according to XLFD documentation. */ | |
| 1809 | |
| 1810 enum xlfd_weight | |
| 1811 { | |
| 1812 XLFD_WEIGHT_UNKNOWN, | |
| 1813 XLFD_WEIGHT_ULTRA_LIGHT, /* 10 */ | |
| 1814 XLFD_WEIGHT_EXTRA_LIGHT, /* 20 */ | |
| 1815 XLFD_WEIGHT_LIGHT, /* 30 */ | |
| 1816 XLFD_WEIGHT_SEMI_LIGHT, /* 40: SemiLight, Book, ... */ | |
| 1817 XLFD_WEIGHT_MEDIUM, /* 50: Medium, Normal, Regular, ... */ | |
| 1818 XLFD_WEIGHT_SEMI_BOLD, /* 60: SemiBold, DemiBold, ... */ | |
| 1819 XLFD_WEIGHT_BOLD, /* 70: Bold, ... */ | |
| 1820 XLFD_WEIGHT_EXTRA_BOLD, /* 80: ExtraBold, Heavy, ... */ | |
| 1821 XLFD_WEIGHT_ULTRA_BOLD /* 90: UltraBold, Black, ... */ | |
| 1822 }; | |
| 1823 | |
| 1824 /* Relative proportionate width. */ | |
| 1825 | |
| 1826 enum xlfd_swidth | |
| 1827 { | |
| 1828 XLFD_SWIDTH_UNKNOWN, | |
| 1829 XLFD_SWIDTH_ULTRA_CONDENSED, /* 10 */ | |
| 1830 XLFD_SWIDTH_EXTRA_CONDENSED, /* 20 */ | |
| 1831 XLFD_SWIDTH_CONDENSED, /* 30: Condensed, Narrow, Compressed, ... */ | |
| 1832 XLFD_SWIDTH_SEMI_CONDENSED, /* 40: semicondensed */ | |
| 1833 XLFD_SWIDTH_MEDIUM, /* 50: Medium, Normal, Regular, ... */ | |
| 1834 XLFD_SWIDTH_SEMI_EXPANDED, /* 60: SemiExpanded, DemiExpanded, ... */ | |
| 1835 XLFD_SWIDTH_EXPANDED, /* 70: Expanded... */ | |
| 1836 XLFD_SWIDTH_EXTRA_EXPANDED, /* 80: ExtraExpanded, Wide... */ | |
| 1837 XLFD_SWIDTH_ULTRA_EXPANDED /* 90: UltraExpanded... */ | |
| 1838 }; | |
| 1839 | |
| 1840 /* Structure used for tables mapping XLFD weight, slant, and width | |
| 1841 names to numeric and symbolic values. */ | |
| 1842 | |
| 1843 struct table_entry | |
| 1844 { | |
| 1845 char *name; | |
| 1846 int numeric; | |
| 1847 Lisp_Object *symbol; | |
| 1848 }; | |
| 1849 | |
| 1850 /* Table of XLFD slant names and their numeric and symbolic | |
| 1851 representations. This table must be sorted by slant names in | |
| 1852 ascending order. */ | |
| 1853 | |
| 1854 static struct table_entry slant_table[] = | |
| 1855 { | |
| 1856 {"i", XLFD_SLANT_ITALIC, &Qitalic}, | |
| 1857 {"o", XLFD_SLANT_OBLIQUE, &Qoblique}, | |
| 1858 {"ot", XLFD_SLANT_OTHER, &Qitalic}, | |
| 1859 {"r", XLFD_SLANT_ROMAN, &Qnormal}, | |
| 1860 {"ri", XLFD_SLANT_REVERSE_ITALIC, &Qreverse_italic}, | |
| 1861 {"ro", XLFD_SLANT_REVERSE_OBLIQUE, &Qreverse_oblique} | |
| 1862 }; | |
| 1863 | |
| 1864 /* Table of XLFD weight names. This table must be sorted by weight | |
| 1865 names in ascending order. */ | |
| 1866 | |
| 1867 static struct table_entry weight_table[] = | |
| 1868 { | |
| 1869 {"black", XLFD_WEIGHT_ULTRA_BOLD, &Qultra_bold}, | |
| 1870 {"bold", XLFD_WEIGHT_BOLD, &Qbold}, | |
| 1871 {"book", XLFD_WEIGHT_SEMI_LIGHT, &Qsemi_light}, | |
|
33529
2e6d343c238d
(weight_table): Add `demi' with the same meaning as
Gerd Moellmann <gerd@gnu.org>
parents:
33372
diff
changeset
|
1872 {"demi", XLFD_WEIGHT_SEMI_BOLD, &Qsemi_bold}, |
| 24995 | 1873 {"demibold", XLFD_WEIGHT_SEMI_BOLD, &Qsemi_bold}, |
| 1874 {"extralight", XLFD_WEIGHT_EXTRA_LIGHT, &Qextra_light}, | |
| 1875 {"extrabold", XLFD_WEIGHT_EXTRA_BOLD, &Qextra_bold}, | |
| 1876 {"heavy", XLFD_WEIGHT_EXTRA_BOLD, &Qextra_bold}, | |
| 1877 {"light", XLFD_WEIGHT_LIGHT, &Qlight}, | |
| 1878 {"medium", XLFD_WEIGHT_MEDIUM, &Qnormal}, | |
| 1879 {"normal", XLFD_WEIGHT_MEDIUM, &Qnormal}, | |
| 1880 {"regular", XLFD_WEIGHT_MEDIUM, &Qnormal}, | |
| 1881 {"semibold", XLFD_WEIGHT_SEMI_BOLD, &Qsemi_bold}, | |
| 1882 {"semilight", XLFD_WEIGHT_SEMI_LIGHT, &Qsemi_light}, | |
| 1883 {"ultralight", XLFD_WEIGHT_ULTRA_LIGHT, &Qultra_light}, | |
| 1884 {"ultrabold", XLFD_WEIGHT_ULTRA_BOLD, &Qultra_bold} | |
| 1885 }; | |
| 1886 | |
| 1887 /* Table of XLFD width names. This table must be sorted by width | |
| 1888 names in ascending order. */ | |
| 1889 | |
| 1890 static struct table_entry swidth_table[] = | |
| 1891 { | |
| 1892 {"compressed", XLFD_SWIDTH_CONDENSED, &Qcondensed}, | |
| 1893 {"condensed", XLFD_SWIDTH_CONDENSED, &Qcondensed}, | |
| 1894 {"demiexpanded", XLFD_SWIDTH_SEMI_EXPANDED, &Qsemi_expanded}, | |
| 1895 {"expanded", XLFD_SWIDTH_EXPANDED, &Qexpanded}, | |
| 1896 {"extracondensed", XLFD_SWIDTH_EXTRA_CONDENSED, &Qextra_condensed}, | |
| 1897 {"extraexpanded", XLFD_SWIDTH_EXTRA_EXPANDED, &Qextra_expanded}, | |
| 1898 {"medium", XLFD_SWIDTH_MEDIUM, &Qnormal}, | |
| 1899 {"narrow", XLFD_SWIDTH_CONDENSED, &Qcondensed}, | |
| 1900 {"normal", XLFD_SWIDTH_MEDIUM, &Qnormal}, | |
| 1901 {"regular", XLFD_SWIDTH_MEDIUM, &Qnormal}, | |
| 1902 {"semicondensed", XLFD_SWIDTH_SEMI_CONDENSED, &Qsemi_condensed}, | |
| 1903 {"semiexpanded", XLFD_SWIDTH_SEMI_EXPANDED, &Qsemi_expanded}, | |
| 1904 {"ultracondensed", XLFD_SWIDTH_ULTRA_CONDENSED, &Qultra_condensed}, | |
| 1905 {"ultraexpanded", XLFD_SWIDTH_ULTRA_EXPANDED, &Qultra_expanded}, | |
| 1906 {"wide", XLFD_SWIDTH_EXTRA_EXPANDED, &Qextra_expanded} | |
| 1907 }; | |
| 1908 | |
| 1909 /* Structure used to hold the result of splitting font names in XLFD | |
| 1910 format into their fields. */ | |
| 1911 | |
| 1912 struct font_name | |
| 1913 { | |
| 1914 /* The original name which is modified destructively by | |
| 1915 split_font_name. The pointer is kept here to be able to free it | |
| 1916 if it was allocated from the heap. */ | |
| 1917 char *name; | |
| 1918 | |
| 1919 /* Font name fields. Each vector element points into `name' above. | |
| 1920 Fields are NUL-terminated. */ | |
| 1921 char *fields[XLFD_LAST]; | |
| 1922 | |
| 1923 /* Numeric values for those fields that interest us. See | |
| 1924 split_font_name for which these are. */ | |
| 1925 int numeric[XLFD_LAST]; | |
|
34160
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
1926 |
|
50515
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
1927 /* If the original name matches one of Vface_font_rescale_alist, |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
1928 the value is the corresponding rescale ratio. Otherwise, the |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
1929 value is 1.0. */ |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
1930 double rescale_ratio; |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
1931 |
|
34160
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
1932 /* Lower value mean higher priority. */ |
|
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
1933 int registry_priority; |
| 24995 | 1934 }; |
| 1935 | |
| 1936 /* The frame in effect when sorting font names. Set temporarily in | |
| 1937 sort_fonts so that it is available in font comparison functions. */ | |
| 1938 | |
| 1939 static struct frame *font_frame; | |
| 1940 | |
| 1941 /* Order by which font selection chooses fonts. The default values | |
| 1942 mean `first, find a best match for the font width, then for the | |
| 1943 font height, then for weight, then for slant.' This variable can be | |
| 1944 set via set-face-font-sort-order. */ | |
| 1945 | |
|
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
44705
diff
changeset
|
1946 #ifdef MAC_OS |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
1947 static int font_sort_order[4] = { |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
1948 XLFD_SWIDTH, XLFD_POINT_SIZE, XLFD_WEIGHT, XLFD_SLANT |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
1949 }; |
|
32752
923b8d6d8277
Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
32176
diff
changeset
|
1950 #else |
| 24995 | 1951 static int font_sort_order[4]; |
|
32752
923b8d6d8277
Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
32176
diff
changeset
|
1952 #endif |
| 24995 | 1953 |
| 1954 /* Look up FONT.fields[FIELD_INDEX] in TABLE which has DIM entries. | |
| 1955 TABLE must be sorted by TABLE[i]->name in ascending order. Value | |
| 1956 is a pointer to the matching table entry or null if no table entry | |
| 1957 matches. */ | |
| 1958 | |
| 1959 static struct table_entry * | |
| 1960 xlfd_lookup_field_contents (table, dim, font, field_index) | |
| 1961 struct table_entry *table; | |
| 1962 int dim; | |
| 1963 struct font_name *font; | |
| 1964 int field_index; | |
| 1965 { | |
| 1966 /* Function split_font_name converts fields to lower-case, so there | |
| 1967 is no need to use xstrlwr or xstricmp here. */ | |
| 1968 char *s = font->fields[field_index]; | |
| 1969 int low, mid, high, cmp; | |
| 1970 | |
| 1971 low = 0; | |
| 1972 high = dim - 1; | |
| 1973 | |
| 1974 while (low <= high) | |
| 1975 { | |
| 1976 mid = (low + high) / 2; | |
| 1977 cmp = strcmp (table[mid].name, s); | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
1978 |
| 24995 | 1979 if (cmp < 0) |
| 1980 low = mid + 1; | |
| 1981 else if (cmp > 0) | |
| 1982 high = mid - 1; | |
| 1983 else | |
| 1984 return table + mid; | |
| 1985 } | |
| 1986 | |
| 1987 return NULL; | |
| 1988 } | |
| 1989 | |
| 1990 | |
| 1991 /* Return a numeric representation for font name field | |
| 1992 FONT.fields[FIELD_INDEX]. The field is looked up in TABLE which | |
| 1993 has DIM entries. Value is the numeric value found or DFLT if no | |
| 1994 table entry matches. This function is used to translate weight, | |
| 1995 slant, and swidth names of XLFD font names to numeric values. */ | |
| 1996 | |
| 1997 static INLINE int | |
| 1998 xlfd_numeric_value (table, dim, font, field_index, dflt) | |
| 1999 struct table_entry *table; | |
| 2000 int dim; | |
| 2001 struct font_name *font; | |
| 2002 int field_index; | |
| 2003 int dflt; | |
| 2004 { | |
| 2005 struct table_entry *p; | |
| 2006 p = xlfd_lookup_field_contents (table, dim, font, field_index); | |
| 2007 return p ? p->numeric : dflt; | |
| 2008 } | |
| 2009 | |
| 2010 | |
| 2011 /* Return a symbolic representation for font name field | |
| 2012 FONT.fields[FIELD_INDEX]. The field is looked up in TABLE which | |
| 2013 has DIM entries. Value is the symbolic value found or DFLT if no | |
| 2014 table entry matches. This function is used to translate weight, | |
| 2015 slant, and swidth names of XLFD font names to symbols. */ | |
| 2016 | |
| 2017 static INLINE Lisp_Object | |
| 2018 xlfd_symbolic_value (table, dim, font, field_index, dflt) | |
| 2019 struct table_entry *table; | |
| 2020 int dim; | |
| 2021 struct font_name *font; | |
| 2022 int field_index; | |
|
28464
cad4cc0508a0
Fix Lisp_Object/int type confusion revealed by making Lisp_Object a union type:
Ken Raeburn <raeburn@raeburn.org>
parents:
28461
diff
changeset
|
2023 Lisp_Object dflt; |
| 24995 | 2024 { |
| 2025 struct table_entry *p; | |
| 2026 p = xlfd_lookup_field_contents (table, dim, font, field_index); | |
| 2027 return p ? *p->symbol : dflt; | |
| 2028 } | |
| 2029 | |
| 2030 | |
| 2031 /* Return a numeric value for the slant of the font given by FONT. */ | |
| 2032 | |
| 2033 static INLINE int | |
| 2034 xlfd_numeric_slant (font) | |
| 2035 struct font_name *font; | |
| 2036 { | |
| 2037 return xlfd_numeric_value (slant_table, DIM (slant_table), | |
| 2038 font, XLFD_SLANT, XLFD_SLANT_ROMAN); | |
| 2039 } | |
| 2040 | |
| 2041 | |
| 2042 /* Return a symbol representing the weight of the font given by FONT. */ | |
| 2043 | |
| 2044 static INLINE Lisp_Object | |
| 2045 xlfd_symbolic_slant (font) | |
| 2046 struct font_name *font; | |
| 2047 { | |
| 2048 return xlfd_symbolic_value (slant_table, DIM (slant_table), | |
| 2049 font, XLFD_SLANT, Qnormal); | |
| 2050 } | |
| 2051 | |
| 2052 | |
| 2053 /* Return a numeric value for the weight of the font given by FONT. */ | |
| 2054 | |
| 2055 static INLINE int | |
| 2056 xlfd_numeric_weight (font) | |
| 2057 struct font_name *font; | |
| 2058 { | |
| 2059 return xlfd_numeric_value (weight_table, DIM (weight_table), | |
| 2060 font, XLFD_WEIGHT, XLFD_WEIGHT_MEDIUM); | |
| 2061 } | |
| 2062 | |
| 2063 | |
| 2064 /* Return a symbol representing the slant of the font given by FONT. */ | |
| 2065 | |
| 2066 static INLINE Lisp_Object | |
| 2067 xlfd_symbolic_weight (font) | |
| 2068 struct font_name *font; | |
| 2069 { | |
| 2070 return xlfd_symbolic_value (weight_table, DIM (weight_table), | |
| 2071 font, XLFD_WEIGHT, Qnormal); | |
| 2072 } | |
| 2073 | |
| 2074 | |
| 2075 /* Return a numeric value for the swidth of the font whose XLFD font | |
| 2076 name fields are found in FONT. */ | |
| 2077 | |
| 2078 static INLINE int | |
| 2079 xlfd_numeric_swidth (font) | |
| 2080 struct font_name *font; | |
| 2081 { | |
| 2082 return xlfd_numeric_value (swidth_table, DIM (swidth_table), | |
| 2083 font, XLFD_SWIDTH, XLFD_SWIDTH_MEDIUM); | |
| 2084 } | |
| 2085 | |
| 2086 | |
| 2087 /* Return a symbolic value for the swidth of FONT. */ | |
| 2088 | |
| 2089 static INLINE Lisp_Object | |
| 2090 xlfd_symbolic_swidth (font) | |
| 2091 struct font_name *font; | |
| 2092 { | |
| 2093 return xlfd_symbolic_value (swidth_table, DIM (swidth_table), | |
| 2094 font, XLFD_SWIDTH, Qnormal); | |
| 2095 } | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
2096 |
| 24995 | 2097 |
| 2098 /* Look up the entry of SYMBOL in the vector TABLE which has DIM | |
| 2099 entries. Value is a pointer to the matching table entry or null if | |
| 2100 no element of TABLE contains SYMBOL. */ | |
| 2101 | |
| 2102 static struct table_entry * | |
| 2103 face_value (table, dim, symbol) | |
| 2104 struct table_entry *table; | |
| 2105 int dim; | |
| 2106 Lisp_Object symbol; | |
| 2107 { | |
| 2108 int i; | |
| 2109 | |
| 2110 xassert (SYMBOLP (symbol)); | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
2111 |
| 24995 | 2112 for (i = 0; i < dim; ++i) |
| 2113 if (EQ (*table[i].symbol, symbol)) | |
| 2114 break; | |
| 2115 | |
| 2116 return i < dim ? table + i : NULL; | |
| 2117 } | |
| 2118 | |
| 2119 | |
| 2120 /* Return a numeric value for SYMBOL in the vector TABLE which has DIM | |
| 2121 entries. Value is -1 if SYMBOL is not found in TABLE. */ | |
| 2122 | |
| 2123 static INLINE int | |
| 2124 face_numeric_value (table, dim, symbol) | |
| 2125 struct table_entry *table; | |
|
89554
15da46f6f0ac
(face_numeric_value): Declare dim size_t.
Dave Love <fx@gnu.org>
parents:
89483
diff
changeset
|
2126 size_t dim; |
| 24995 | 2127 Lisp_Object symbol; |
| 2128 { | |
| 2129 struct table_entry *p = face_value (table, dim, symbol); | |
| 2130 return p ? p->numeric : -1; | |
| 2131 } | |
| 2132 | |
| 2133 | |
| 2134 /* Return a numeric value representing the weight specified by Lisp | |
| 2135 symbol WEIGHT. Value is one of the enumerators of enum | |
| 2136 xlfd_weight. */ | |
| 2137 | |
| 2138 static INLINE int | |
| 2139 face_numeric_weight (weight) | |
| 2140 Lisp_Object weight; | |
| 2141 { | |
| 2142 return face_numeric_value (weight_table, DIM (weight_table), weight); | |
| 2143 } | |
| 2144 | |
| 2145 | |
| 2146 /* Return a numeric value representing the slant specified by Lisp | |
| 2147 symbol SLANT. Value is one of the enumerators of enum xlfd_slant. */ | |
| 2148 | |
| 2149 static INLINE int | |
| 2150 face_numeric_slant (slant) | |
| 2151 Lisp_Object slant; | |
| 2152 { | |
| 2153 return face_numeric_value (slant_table, DIM (slant_table), slant); | |
| 2154 } | |
| 2155 | |
| 2156 | |
| 2157 /* Return a numeric value representing the swidth specified by Lisp | |
| 2158 symbol WIDTH. Value is one of the enumerators of enum xlfd_swidth. */ | |
| 2159 | |
| 2160 static int | |
| 2161 face_numeric_swidth (width) | |
| 2162 Lisp_Object width; | |
| 2163 { | |
| 2164 return face_numeric_value (swidth_table, DIM (swidth_table), width); | |
| 2165 } | |
| 2166 | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
2167 #ifdef HAVE_WINDOW_SYSTEM |
| 24995 | 2168 |
|
88394
b954eee715da
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
43270
diff
changeset
|
2169 Lisp_Object |
|
89348
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2170 split_font_name_into_vector (fontname) |
| 88907 | 2171 Lisp_Object fontname; |
| 2172 { | |
| 2173 struct font_name font; | |
|
89348
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2174 Lisp_Object vec; |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2175 int i; |
| 88907 | 2176 |
| 2177 font.name = LSTRDUPA (fontname); | |
| 2178 if (! split_font_name (NULL, &font, 0)) | |
| 2179 return Qnil; | |
|
89348
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2180 vec = Fmake_vector (make_number (XLFD_LAST), Qnil); |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2181 for (i = 0; i < XLFD_LAST; i++) |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2182 if (font.fields[i][0] != '*') |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2183 ASET (vec, i, build_string (font.fields[i])); |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2184 return vec; |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2185 } |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2186 |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2187 Lisp_Object |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2188 build_font_name_from_vector (vec) |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2189 Lisp_Object vec; |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2190 { |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2191 struct font_name font; |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2192 Lisp_Object fontname; |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2193 char *p; |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2194 int i; |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2195 |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2196 for (i = 0; i < XLFD_LAST; i++) |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2197 { |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2198 font.fields[i] = (NILP (AREF (vec, i)) |
| 89483 | 2199 ? "*" : (char *) SDATA (AREF (vec, i))); |
|
89348
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2200 if ((i == XLFD_FAMILY || i == XLFD_REGISTRY) |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2201 && (p = strchr (font.fields[i], '-'))) |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2202 { |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2203 char *p1 = STRDUPA (font.fields[i]); |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2204 |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2205 p1[p - font.fields[i]] = '\0'; |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2206 if (i == XLFD_FAMILY) |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2207 { |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2208 font.fields[XLFD_FOUNDRY] = p1; |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2209 font.fields[XLFD_FAMILY] = p + 1; |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2210 } |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2211 else |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2212 { |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2213 font.fields[XLFD_REGISTRY] = p1; |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2214 font.fields[XLFD_ENCODING] = p + 1; |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2215 break; |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2216 } |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2217 } |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2218 } |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2219 |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2220 p = build_font_name (&font); |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2221 fontname = build_string (p); |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2222 xfree (p); |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2223 return fontname; |
| 88907 | 2224 } |
| 24995 | 2225 |
| 2226 /* Return non-zero if FONT is the name of a fixed-pitch font. */ | |
| 2227 | |
| 2228 static INLINE int | |
| 2229 xlfd_fixed_p (font) | |
| 2230 struct font_name *font; | |
| 2231 { | |
| 2232 /* Function split_font_name converts fields to lower-case, so there | |
| 2233 is no need to use tolower here. */ | |
| 2234 return *font->fields[XLFD_SPACING] != 'p'; | |
| 2235 } | |
| 2236 | |
| 2237 | |
| 2238 /* Return the point size of FONT on frame F, measured in 1/10 pt. | |
| 2239 | |
| 2240 The actual height of the font when displayed on F depends on the | |
| 2241 resolution of both the font and frame. For example, a 10pt font | |
| 2242 designed for a 100dpi display will display larger than 10pt on a | |
| 2243 75dpi display. (It's not unusual to use fonts not designed for the | |
| 2244 display one is using. For example, some intlfonts are available in | |
| 2245 72dpi versions, only.) | |
| 2246 | |
| 2247 Value is the real point size of FONT on frame F, or 0 if it cannot | |
|
89875
10387ba10fe5
(xlfd_point_size): Set font->numeric[XLFD_PIXEL_SIZE].
Kenichi Handa <handa@m17n.org>
parents:
89844
diff
changeset
|
2248 be determined. |
|
10387ba10fe5
(xlfd_point_size): Set font->numeric[XLFD_PIXEL_SIZE].
Kenichi Handa <handa@m17n.org>
parents:
89844
diff
changeset
|
2249 |
|
10387ba10fe5
(xlfd_point_size): Set font->numeric[XLFD_PIXEL_SIZE].
Kenichi Handa <handa@m17n.org>
parents:
89844
diff
changeset
|
2250 By side effect, set FONT->numeric[XLFD_PIXEL_SIZE]. */ |
| 24995 | 2251 |
| 2252 static INLINE int | |
| 2253 xlfd_point_size (f, font) | |
| 2254 struct frame *f; | |
| 2255 struct font_name *font; | |
| 2256 { | |
| 2257 double resy = FRAME_X_DISPLAY_INFO (f)->resy; | |
|
37714
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2258 char *pixel_field = font->fields[XLFD_PIXEL_SIZE]; |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2259 double pixel; |
| 24995 | 2260 int real_pt; |
| 2261 | |
|
37714
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2262 if (*pixel_field == '[') |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2263 { |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2264 /* The pixel size field is `[A B C D]' which specifies |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2265 a transformation matrix. |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2266 |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2267 A B 0 |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2268 C D 0 |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2269 0 0 1 |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2270 |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2271 by which all glyphs of the font are transformed. The spec |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2272 says that s scalar value N for the pixel size is equivalent |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2273 to A = N * resx/resy, B = C = 0, D = N. */ |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2274 char *start = pixel_field + 1, *end; |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2275 double matrix[4]; |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2276 int i; |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2277 |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2278 for (i = 0; i < 4; ++i) |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2279 { |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2280 matrix[i] = strtod (start, &end); |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2281 start = end; |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2282 } |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2283 |
|
37798
d4b4c850abc0
(xlfd_point_size): Don't divide pixel size from
Gerd Moellmann <gerd@gnu.org>
parents:
37756
diff
changeset
|
2284 pixel = matrix[3]; |
|
37714
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2285 } |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2286 else |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2287 pixel = atoi (pixel_field); |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48384
diff
changeset
|
2288 |
|
89875
10387ba10fe5
(xlfd_point_size): Set font->numeric[XLFD_PIXEL_SIZE].
Kenichi Handa <handa@m17n.org>
parents:
89844
diff
changeset
|
2289 font->numeric[XLFD_PIXEL_SIZE] = pixel; |
|
37714
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2290 if (pixel == 0) |
| 24995 | 2291 real_pt = 0; |
| 2292 else | |
|
37714
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2293 real_pt = PT_PER_INCH * 10.0 * pixel / resy + 0.5; |
| 24995 | 2294 |
| 2295 return real_pt; | |
| 2296 } | |
| 2297 | |
| 2298 | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
2299 /* Return point size of PIXEL dots while considering Y-resultion (DPI) |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
2300 of frame F. This function is used to guess a point size of font |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
2301 when only the pixel height of the font is available. */ |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
2302 |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
2303 static INLINE int |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
2304 pixel_point_size (f, pixel) |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
2305 struct frame *f; |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
2306 int pixel; |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
2307 { |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
2308 double resy = FRAME_X_DISPLAY_INFO (f)->resy; |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
2309 double real_pt; |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
2310 int int_pt; |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
2311 |
| 34882 | 2312 /* As one inch is PT_PER_INCH points, PT_PER_INCH/RESY gives the |
| 2313 point size of one dot. */ | |
| 2314 real_pt = pixel * PT_PER_INCH / resy; | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
2315 int_pt = real_pt + 0.5; |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
2316 |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
2317 return int_pt; |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
2318 } |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
2319 |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
2320 |
|
50515
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
2321 /* Return a rescaling ratio of a font of NAME. */ |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
2322 |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
2323 static double |
|
51401
bcf91e20f6a2
(font_rescale_ratio): Fix for K&R.
Dave Love <fx@gnu.org>
parents:
51315
diff
changeset
|
2324 font_rescale_ratio (name) |
|
bcf91e20f6a2
(font_rescale_ratio): Fix for K&R.
Dave Love <fx@gnu.org>
parents:
51315
diff
changeset
|
2325 char *name; |
|
50515
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
2326 { |
|
53267
bec1d17789a6
(Fcolor_gray_p): Fix omission bug:
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
52401
diff
changeset
|
2327 Lisp_Object tail, elt; |
|
50515
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
2328 |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
2329 for (tail = Vface_font_rescale_alist; CONSP (tail); tail = XCDR (tail)) |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
2330 { |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
2331 elt = XCAR (tail); |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
2332 if (STRINGP (XCAR (elt)) && FLOATP (XCDR (elt)) |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
2333 && fast_c_string_match_ignore_case (XCAR (elt), name) >= 0) |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
2334 return XFLOAT_DATA (XCDR (elt)); |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
2335 } |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
2336 return 1.0; |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
2337 } |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
2338 |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
2339 |
| 24995 | 2340 /* Split XLFD font name FONT->name destructively into NUL-terminated, |
| 2341 lower-case fields in FONT->fields. NUMERIC_P non-zero means | |
| 2342 compute numeric values for fields XLFD_POINT_SIZE, XLFD_SWIDTH, | |
| 2343 XLFD_RESY, XLFD_SLANT, and XLFD_WEIGHT in FONT->numeric. Value is | |
| 2344 zero if the font name doesn't have the format we expect. The | |
| 2345 expected format is a font name that starts with a `-' and has | |
|
37714
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2346 XLFD_LAST fields separated by `-'. */ |
| 24995 | 2347 |
| 2348 static int | |
| 2349 split_font_name (f, font, numeric_p) | |
| 2350 struct frame *f; | |
| 2351 struct font_name *font; | |
| 2352 int numeric_p; | |
| 2353 { | |
| 2354 int i = 0; | |
| 2355 int success_p; | |
|
50515
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
2356 double rescale_ratio; |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
2357 |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
2358 if (numeric_p) |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
2359 /* This must be done before splitting the font name. */ |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
2360 rescale_ratio = font_rescale_ratio (font->name); |
| 24995 | 2361 |
| 2362 if (*font->name == '-') | |
| 2363 { | |
| 2364 char *p = xstrlwr (font->name) + 1; | |
| 2365 | |
|
37716
018b29727e8d
(split_font_name): Make sure to leave the loop
Gerd Moellmann <gerd@gnu.org>
parents:
37714
diff
changeset
|
2366 while (i < XLFD_LAST) |
| 24995 | 2367 { |
| 2368 font->fields[i] = p; | |
|
37716
018b29727e8d
(split_font_name): Make sure to leave the loop
Gerd Moellmann <gerd@gnu.org>
parents:
37714
diff
changeset
|
2369 ++i; |
|
37714
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2370 |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2371 /* Pixel and point size may be of the form `[....]'. For |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2372 BNF, see XLFD spec, chapter 4. Negative values are |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2373 indicated by tilde characters which we replace with |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2374 `-' characters, here. */ |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2375 if (*p == '[' |
|
37736
d6f944b128c4
(split_font_name): Handle `[...]' for the right
Gerd Moellmann <gerd@gnu.org>
parents:
37724
diff
changeset
|
2376 && (i - 1 == XLFD_PIXEL_SIZE |
|
d6f944b128c4
(split_font_name): Handle `[...]' for the right
Gerd Moellmann <gerd@gnu.org>
parents:
37724
diff
changeset
|
2377 || i - 1 == XLFD_POINT_SIZE)) |
|
37714
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2378 { |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2379 char *start, *end; |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2380 int j; |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48384
diff
changeset
|
2381 |
|
37714
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2382 for (++p; *p && *p != ']'; ++p) |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2383 if (*p == '~') |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2384 *p = '-'; |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2385 |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2386 /* Check that the matrix contains 4 floating point |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2387 numbers. */ |
|
37756
2cea00ea4d76
(split_font_name): Use the right field when
Gerd Moellmann <gerd@gnu.org>
parents:
37736
diff
changeset
|
2388 for (j = 0, start = font->fields[i - 1] + 1; |
|
37714
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2389 j < 4; |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2390 ++j, start = end) |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2391 if (strtod (start, &end) == 0 && start == end) |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2392 break; |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2393 |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2394 if (j < 4) |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2395 break; |
|
cf79e6de9752
(split_font_name): Handle matrix transformations
Gerd Moellmann <gerd@gnu.org>
parents:
37700
diff
changeset
|
2396 } |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
2397 |
| 24995 | 2398 while (*p && *p != '-') |
| 2399 ++p; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
2400 |
| 24995 | 2401 if (*p != '-') |
| 2402 break; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
2403 |
| 24995 | 2404 *p++ = 0; |
| 2405 } | |
| 2406 } | |
| 2407 | |
| 2408 success_p = i == XLFD_LAST; | |
| 2409 | |
| 2410 /* If requested, and font name was in the expected format, | |
| 2411 compute numeric values for some fields. */ | |
| 2412 if (numeric_p && success_p) | |
| 2413 { | |
| 2414 font->numeric[XLFD_POINT_SIZE] = xlfd_point_size (f, font); | |
| 2415 font->numeric[XLFD_RESY] = atoi (font->fields[XLFD_RESY]); | |
| 2416 font->numeric[XLFD_SLANT] = xlfd_numeric_slant (font); | |
| 2417 font->numeric[XLFD_WEIGHT] = xlfd_numeric_weight (font); | |
| 2418 font->numeric[XLFD_SWIDTH] = xlfd_numeric_swidth (font); | |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
2419 font->numeric[XLFD_AVGWIDTH] = atoi (font->fields[XLFD_AVGWIDTH]); |
|
50515
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
2420 font->rescale_ratio = rescale_ratio; |
| 24995 | 2421 } |
| 2422 | |
|
34160
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
2423 /* Initialize it to zero. It will be overridden by font_list while |
|
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
2424 trying alternate registries. */ |
|
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
2425 font->registry_priority = 0; |
|
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
2426 |
| 24995 | 2427 return success_p; |
| 2428 } | |
| 2429 | |
| 2430 | |
| 2431 /* Build an XLFD font name from font name fields in FONT. Value is a | |
| 2432 pointer to the font name, which is allocated via xmalloc. */ | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
2433 |
| 24995 | 2434 static char * |
| 2435 build_font_name (font) | |
| 2436 struct font_name *font; | |
| 2437 { | |
| 2438 int i; | |
| 2439 int size = 100; | |
| 2440 char *font_name = (char *) xmalloc (size); | |
| 2441 int total_length = 0; | |
| 2442 | |
| 2443 for (i = 0; i < XLFD_LAST; ++i) | |
| 2444 { | |
| 2445 /* Add 1 because of the leading `-'. */ | |
| 2446 int len = strlen (font->fields[i]) + 1; | |
| 2447 | |
| 2448 /* Reallocate font_name if necessary. Add 1 for the final | |
| 2449 NUL-byte. */ | |
| 2450 if (total_length + len + 1 >= size) | |
| 2451 { | |
| 2452 int new_size = max (2 * size, size + len + 1); | |
| 2453 int sz = new_size * sizeof *font_name; | |
| 2454 font_name = (char *) xrealloc (font_name, sz); | |
| 2455 size = new_size; | |
| 2456 } | |
| 2457 | |
| 2458 font_name[total_length] = '-'; | |
| 2459 bcopy (font->fields[i], font_name + total_length + 1, len - 1); | |
| 2460 total_length += len; | |
| 2461 } | |
| 2462 | |
| 2463 font_name[total_length] = 0; | |
| 2464 return font_name; | |
| 2465 } | |
| 2466 | |
| 2467 | |
| 2468 /* Free an array FONTS of N font_name structures. This frees FONTS | |
| 2469 itself and all `name' fields in its elements. */ | |
| 2470 | |
| 2471 static INLINE void | |
| 2472 free_font_names (fonts, n) | |
| 2473 struct font_name *fonts; | |
| 2474 int n; | |
| 2475 { | |
| 2476 while (n) | |
| 2477 xfree (fonts[--n].name); | |
| 2478 xfree (fonts); | |
| 2479 } | |
| 2480 | |
| 2481 | |
| 2482 /* Sort vector FONTS of font_name structures which contains NFONTS | |
| 2483 elements using qsort and comparison function CMPFN. F is the frame | |
| 2484 on which the fonts will be used. The global variable font_frame | |
| 2485 is temporarily set to F to make it available in CMPFN. */ | |
| 2486 | |
| 2487 static INLINE void | |
| 2488 sort_fonts (f, fonts, nfonts, cmpfn) | |
| 2489 struct frame *f; | |
| 2490 struct font_name *fonts; | |
| 2491 int nfonts; | |
| 2492 int (*cmpfn) P_ ((const void *, const void *)); | |
| 2493 { | |
| 2494 font_frame = f; | |
| 2495 qsort (fonts, nfonts, sizeof *fonts, cmpfn); | |
| 2496 font_frame = NULL; | |
|
3074
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
2497 } |
|
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
2498 |
| 24995 | 2499 |
| 2500 /* Get fonts matching PATTERN on frame F. If F is null, use the first | |
| 2501 display in x_display_list. FONTS is a pointer to a vector of | |
| 2502 NFONTS font_name structures. TRY_ALTERNATIVES_P non-zero means try | |
| 2503 alternative patterns from Valternate_fontname_alist if no fonts are | |
|
37186
e47810283f6b
(best_matching_font): Remove unused parameter PATTERN.
Gerd Moellmann <gerd@gnu.org>
parents:
37036
diff
changeset
|
2504 found matching PATTERN. |
| 24995 | 2505 |
| 2506 For all fonts found, set FONTS[i].name to the name of the font, | |
| 2507 allocated via xmalloc, and split font names into fields. Ignore | |
|
35371
dc0d772c9d3d
(x_face_list_fonts): Don't BLOCK_INPUT around the
Gerd Moellmann <gerd@gnu.org>
parents:
35369
diff
changeset
|
2508 fonts that we can't parse. Value is the number of fonts found. */ |
| 24995 | 2509 |
| 2510 static int | |
|
49859
c6bacc76cfb6
* xterm.c (x_list_fonts): If maxnames is less than 0, get all font
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49600
diff
changeset
|
2511 x_face_list_fonts (f, pattern, pfonts, nfonts, try_alternatives_p) |
| 24995 | 2512 struct frame *f; |
| 2513 char *pattern; | |
|
49859
c6bacc76cfb6
* xterm.c (x_list_fonts): If maxnames is less than 0, get all font
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49600
diff
changeset
|
2514 struct font_name **pfonts; |
| 24995 | 2515 int nfonts, try_alternatives_p; |
|
37186
e47810283f6b
(best_matching_font): Remove unused parameter PATTERN.
Gerd Moellmann <gerd@gnu.org>
parents:
37036
diff
changeset
|
2516 { |
|
e47810283f6b
(best_matching_font): Remove unused parameter PATTERN.
Gerd Moellmann <gerd@gnu.org>
parents:
37036
diff
changeset
|
2517 int n, nignored; |
|
35369
aca9ba55cfcc
(x_face_list_fonts): Call x_list_fonts with SIZE -1,
Gerd Moellmann <gerd@gnu.org>
parents:
35228
diff
changeset
|
2518 |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
2519 /* NTEMACS_TODO : currently this uses w32_list_fonts, but it may be |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
2520 better to do it the other way around. */ |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
2521 Lisp_Object lfonts; |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
2522 Lisp_Object lpattern, tem; |
|
49859
c6bacc76cfb6
* xterm.c (x_list_fonts): If maxnames is less than 0, get all font
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49600
diff
changeset
|
2523 struct font_name *fonts = 0; |
|
c6bacc76cfb6
* xterm.c (x_list_fonts): If maxnames is less than 0, get all font
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49600
diff
changeset
|
2524 int num_fonts = nfonts; |
|
c6bacc76cfb6
* xterm.c (x_list_fonts): If maxnames is less than 0, get all font
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49600
diff
changeset
|
2525 |
|
c6bacc76cfb6
* xterm.c (x_list_fonts): If maxnames is less than 0, get all font
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49600
diff
changeset
|
2526 *pfonts = 0; |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
2527 lpattern = build_string (pattern); |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
2528 |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
2529 /* Get the list of fonts matching PATTERN. */ |
|
35371
dc0d772c9d3d
(x_face_list_fonts): Don't BLOCK_INPUT around the
Gerd Moellmann <gerd@gnu.org>
parents:
35369
diff
changeset
|
2530 #ifdef WINDOWSNT |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
2531 BLOCK_INPUT; |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
2532 lfonts = w32_list_fonts (f, lpattern, 0, nfonts); |
|
35371
dc0d772c9d3d
(x_face_list_fonts): Don't BLOCK_INPUT around the
Gerd Moellmann <gerd@gnu.org>
parents:
35369
diff
changeset
|
2533 UNBLOCK_INPUT; |
|
35369
aca9ba55cfcc
(x_face_list_fonts): Call x_list_fonts with SIZE -1,
Gerd Moellmann <gerd@gnu.org>
parents:
35228
diff
changeset
|
2534 #else |
|
37186
e47810283f6b
(best_matching_font): Remove unused parameter PATTERN.
Gerd Moellmann <gerd@gnu.org>
parents:
37036
diff
changeset
|
2535 lfonts = x_list_fonts (f, lpattern, -1, nfonts); |
|
32752
923b8d6d8277
Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
32176
diff
changeset
|
2536 #endif |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
2537 |
|
49859
c6bacc76cfb6
* xterm.c (x_list_fonts): If maxnames is less than 0, get all font
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49600
diff
changeset
|
2538 if (nfonts < 0 && CONSP (lfonts)) |
|
49914
b4b6ede28a6f
(x_face_list_fonts): Fix int/Lisp_Object mixup.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
49864
diff
changeset
|
2539 num_fonts = XFASTINT (Flength (lfonts)); |
|
53267
bec1d17789a6
(Fcolor_gray_p): Fix omission bug:
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
52401
diff
changeset
|
2540 |
|
35369
aca9ba55cfcc
(x_face_list_fonts): Call x_list_fonts with SIZE -1,
Gerd Moellmann <gerd@gnu.org>
parents:
35228
diff
changeset
|
2541 /* Make a copy of the font names we got from X, and |
|
aca9ba55cfcc
(x_face_list_fonts): Call x_list_fonts with SIZE -1,
Gerd Moellmann <gerd@gnu.org>
parents:
35228
diff
changeset
|
2542 split them into fields. */ |
|
37186
e47810283f6b
(best_matching_font): Remove unused parameter PATTERN.
Gerd Moellmann <gerd@gnu.org>
parents:
37036
diff
changeset
|
2543 n = nignored = 0; |
|
49859
c6bacc76cfb6
* xterm.c (x_list_fonts): If maxnames is less than 0, get all font
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49600
diff
changeset
|
2544 for (tem = lfonts; CONSP (tem) && n < num_fonts; tem = XCDR (tem)) |
|
35369
aca9ba55cfcc
(x_face_list_fonts): Call x_list_fonts with SIZE -1,
Gerd Moellmann <gerd@gnu.org>
parents:
35228
diff
changeset
|
2545 { |
|
aca9ba55cfcc
(x_face_list_fonts): Call x_list_fonts with SIZE -1,
Gerd Moellmann <gerd@gnu.org>
parents:
35228
diff
changeset
|
2546 Lisp_Object elt, tail; |
|
46556
71e205b50a3e
(may_use_scalable_font_p): Argument now points to
Ken Raeburn <raeburn@raeburn.org>
parents:
46478
diff
changeset
|
2547 const char *name = SDATA (XCAR (tem)); |
|
35369
aca9ba55cfcc
(x_face_list_fonts): Call x_list_fonts with SIZE -1,
Gerd Moellmann <gerd@gnu.org>
parents:
35228
diff
changeset
|
2548 |
|
37186
e47810283f6b
(best_matching_font): Remove unused parameter PATTERN.
Gerd Moellmann <gerd@gnu.org>
parents:
37036
diff
changeset
|
2549 /* Ignore fonts matching a pattern from face-ignored-fonts. */ |
|
35369
aca9ba55cfcc
(x_face_list_fonts): Call x_list_fonts with SIZE -1,
Gerd Moellmann <gerd@gnu.org>
parents:
35228
diff
changeset
|
2550 for (tail = Vface_ignored_fonts; CONSP (tail); tail = XCDR (tail)) |
| 24995 | 2551 { |
|
35369
aca9ba55cfcc
(x_face_list_fonts): Call x_list_fonts with SIZE -1,
Gerd Moellmann <gerd@gnu.org>
parents:
35228
diff
changeset
|
2552 elt = XCAR (tail); |
|
aca9ba55cfcc
(x_face_list_fonts): Call x_list_fonts with SIZE -1,
Gerd Moellmann <gerd@gnu.org>
parents:
35228
diff
changeset
|
2553 if (STRINGP (elt) |
|
aca9ba55cfcc
(x_face_list_fonts): Call x_list_fonts with SIZE -1,
Gerd Moellmann <gerd@gnu.org>
parents:
35228
diff
changeset
|
2554 && fast_c_string_match_ignore_case (elt, name) >= 0) |
|
aca9ba55cfcc
(x_face_list_fonts): Call x_list_fonts with SIZE -1,
Gerd Moellmann <gerd@gnu.org>
parents:
35228
diff
changeset
|
2555 break; |
|
aca9ba55cfcc
(x_face_list_fonts): Call x_list_fonts with SIZE -1,
Gerd Moellmann <gerd@gnu.org>
parents:
35228
diff
changeset
|
2556 } |
|
aca9ba55cfcc
(x_face_list_fonts): Call x_list_fonts with SIZE -1,
Gerd Moellmann <gerd@gnu.org>
parents:
35228
diff
changeset
|
2557 if (!NILP (tail)) |
|
37186
e47810283f6b
(best_matching_font): Remove unused parameter PATTERN.
Gerd Moellmann <gerd@gnu.org>
parents:
37036
diff
changeset
|
2558 { |
|
e47810283f6b
(best_matching_font): Remove unused parameter PATTERN.
Gerd Moellmann <gerd@gnu.org>
parents:
37036
diff
changeset
|
2559 ++nignored; |
|
e47810283f6b
(best_matching_font): Remove unused parameter PATTERN.
Gerd Moellmann <gerd@gnu.org>
parents:
37036
diff
changeset
|
2560 continue; |
|
e47810283f6b
(best_matching_font): Remove unused parameter PATTERN.
Gerd Moellmann <gerd@gnu.org>
parents:
37036
diff
changeset
|
2561 } |
|
35369
aca9ba55cfcc
(x_face_list_fonts): Call x_list_fonts with SIZE -1,
Gerd Moellmann <gerd@gnu.org>
parents:
35228
diff
changeset
|
2562 |
|
49859
c6bacc76cfb6
* xterm.c (x_list_fonts): If maxnames is less than 0, get all font
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49600
diff
changeset
|
2563 if (! fonts) |
|
c6bacc76cfb6
* xterm.c (x_list_fonts): If maxnames is less than 0, get all font
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49600
diff
changeset
|
2564 { |
|
c6bacc76cfb6
* xterm.c (x_list_fonts): If maxnames is less than 0, get all font
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49600
diff
changeset
|
2565 *pfonts = (struct font_name *) xmalloc (num_fonts * sizeof **pfonts); |
|
c6bacc76cfb6
* xterm.c (x_list_fonts): If maxnames is less than 0, get all font
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49600
diff
changeset
|
2566 fonts = *pfonts; |
|
c6bacc76cfb6
* xterm.c (x_list_fonts): If maxnames is less than 0, get all font
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49600
diff
changeset
|
2567 } |
|
c6bacc76cfb6
* xterm.c (x_list_fonts): If maxnames is less than 0, get all font
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49600
diff
changeset
|
2568 |
|
35369
aca9ba55cfcc
(x_face_list_fonts): Call x_list_fonts with SIZE -1,
Gerd Moellmann <gerd@gnu.org>
parents:
35228
diff
changeset
|
2569 /* Make a copy of the font name. */ |
|
aca9ba55cfcc
(x_face_list_fonts): Call x_list_fonts with SIZE -1,
Gerd Moellmann <gerd@gnu.org>
parents:
35228
diff
changeset
|
2570 fonts[n].name = xstrdup (name); |
|
aca9ba55cfcc
(x_face_list_fonts): Call x_list_fonts with SIZE -1,
Gerd Moellmann <gerd@gnu.org>
parents:
35228
diff
changeset
|
2571 |
|
37186
e47810283f6b
(best_matching_font): Remove unused parameter PATTERN.
Gerd Moellmann <gerd@gnu.org>
parents:
37036
diff
changeset
|
2572 if (split_font_name (f, fonts + n, 1)) |
|
35369
aca9ba55cfcc
(x_face_list_fonts): Call x_list_fonts with SIZE -1,
Gerd Moellmann <gerd@gnu.org>
parents:
35228
diff
changeset
|
2573 { |
|
37186
e47810283f6b
(best_matching_font): Remove unused parameter PATTERN.
Gerd Moellmann <gerd@gnu.org>
parents:
37036
diff
changeset
|
2574 if (font_scalable_p (fonts + n) |
|
e47810283f6b
(best_matching_font): Remove unused parameter PATTERN.
Gerd Moellmann <gerd@gnu.org>
parents:
37036
diff
changeset
|
2575 && !may_use_scalable_font_p (name)) |
|
e47810283f6b
(best_matching_font): Remove unused parameter PATTERN.
Gerd Moellmann <gerd@gnu.org>
parents:
37036
diff
changeset
|
2576 { |
|
e47810283f6b
(best_matching_font): Remove unused parameter PATTERN.
Gerd Moellmann <gerd@gnu.org>
parents:
37036
diff
changeset
|
2577 ++nignored; |
|
e47810283f6b
(best_matching_font): Remove unused parameter PATTERN.
Gerd Moellmann <gerd@gnu.org>
parents:
37036
diff
changeset
|
2578 xfree (fonts[n].name); |
|
e47810283f6b
(best_matching_font): Remove unused parameter PATTERN.
Gerd Moellmann <gerd@gnu.org>
parents:
37036
diff
changeset
|
2579 } |
| 24995 | 2580 else |
|
35369
aca9ba55cfcc
(x_face_list_fonts): Call x_list_fonts with SIZE -1,
Gerd Moellmann <gerd@gnu.org>
parents:
35228
diff
changeset
|
2581 ++n; |
| 24995 | 2582 } |
|
35369
aca9ba55cfcc
(x_face_list_fonts): Call x_list_fonts with SIZE -1,
Gerd Moellmann <gerd@gnu.org>
parents:
35228
diff
changeset
|
2583 else |
|
37186
e47810283f6b
(best_matching_font): Remove unused parameter PATTERN.
Gerd Moellmann <gerd@gnu.org>
parents:
37036
diff
changeset
|
2584 xfree (fonts[n].name); |
|
e47810283f6b
(best_matching_font): Remove unused parameter PATTERN.
Gerd Moellmann <gerd@gnu.org>
parents:
37036
diff
changeset
|
2585 } |
|
e47810283f6b
(best_matching_font): Remove unused parameter PATTERN.
Gerd Moellmann <gerd@gnu.org>
parents:
37036
diff
changeset
|
2586 |
| 24995 | 2587 /* If no fonts found, try patterns from Valternate_fontname_alist. */ |
| 2588 if (n == 0 && try_alternatives_p) | |
| 2589 { | |
| 2590 Lisp_Object list = Valternate_fontname_alist; | |
| 2591 | |
|
49863
6d5c33f4dd05
* xfaces.c (x_face_list_fonts): Set *pfonts to 0 if no fonts found.
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49859
diff
changeset
|
2592 if (*pfonts) |
|
6d5c33f4dd05
* xfaces.c (x_face_list_fonts): Set *pfonts to 0 if no fonts found.
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49859
diff
changeset
|
2593 { |
|
6d5c33f4dd05
* xfaces.c (x_face_list_fonts): Set *pfonts to 0 if no fonts found.
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49859
diff
changeset
|
2594 xfree (*pfonts); |
|
6d5c33f4dd05
* xfaces.c (x_face_list_fonts): Set *pfonts to 0 if no fonts found.
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49859
diff
changeset
|
2595 *pfonts = 0; |
|
6d5c33f4dd05
* xfaces.c (x_face_list_fonts): Set *pfonts to 0 if no fonts found.
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49859
diff
changeset
|
2596 } |
|
6d5c33f4dd05
* xfaces.c (x_face_list_fonts): Set *pfonts to 0 if no fonts found.
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49859
diff
changeset
|
2597 |
| 24995 | 2598 while (CONSP (list)) |
| 2599 { | |
| 2600 Lisp_Object entry = XCAR (list); | |
| 2601 if (CONSP (entry) | |
| 2602 && STRINGP (XCAR (entry)) | |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
2603 && strcmp (SDATA (XCAR (entry)), pattern) == 0) |
| 24995 | 2604 break; |
| 2605 list = XCDR (list); | |
| 2606 } | |
| 2607 | |
| 2608 if (CONSP (list)) | |
| 2609 { | |
| 2610 Lisp_Object patterns = XCAR (list); | |
| 2611 Lisp_Object name; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
2612 |
| 24995 | 2613 while (CONSP (patterns) |
| 2614 /* If list is screwed up, give up. */ | |
| 2615 && (name = XCAR (patterns), | |
| 2616 STRINGP (name)) | |
| 2617 /* Ignore patterns equal to PATTERN because we tried that | |
| 2618 already with no success. */ | |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
2619 && (strcmp (SDATA (name), pattern) == 0 |
|
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
2620 || (n = x_face_list_fonts (f, SDATA (name), |
|
49859
c6bacc76cfb6
* xterm.c (x_list_fonts): If maxnames is less than 0, get all font
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49600
diff
changeset
|
2621 pfonts, nfonts, 0), |
| 24995 | 2622 n == 0))) |
| 2623 patterns = XCDR (patterns); | |
| 2624 } | |
| 2625 } | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
2626 |
| 24995 | 2627 return n; |
| 2628 } | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
2629 |
| 24995 | 2630 |
|
53354
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2631 /* Check if a font matching pattern_offset_t on frame F is available |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2632 or not. PATTERN may be a cons (FAMILY . REGISTRY), in which case, |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2633 a font name pattern is generated from FAMILY and REGISTRY. */ |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2634 |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2635 int |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2636 face_font_available_p (f, pattern) |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2637 struct frame *f; |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2638 Lisp_Object pattern; |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2639 { |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2640 Lisp_Object fonts; |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2641 |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2642 if (! STRINGP (pattern)) |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2643 { |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2644 Lisp_Object family, registry; |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2645 char *family_str, *registry_str, *pattern_str; |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2646 |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2647 CHECK_CONS (pattern); |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2648 family = XCAR (pattern); |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2649 if (NILP (family)) |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2650 family_str = "*"; |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2651 else |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2652 { |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2653 CHECK_STRING (family); |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2654 family_str = (char *) SDATA (family); |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2655 } |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2656 registry = XCDR (pattern); |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2657 if (NILP (registry)) |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2658 registry_str = "*"; |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2659 else |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2660 { |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2661 CHECK_STRING (registry); |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2662 registry_str = (char *) SDATA (registry); |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2663 } |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2664 |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2665 pattern_str = (char *) alloca (strlen (family_str) |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2666 + strlen (registry_str) |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2667 + 10); |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2668 strcpy (pattern_str, index (family_str, '-') ? "-" : "-*-"); |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2669 strcat (pattern_str, family_str); |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2670 strcat (pattern_str, "-*-"); |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2671 strcat (pattern_str, registry_str); |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2672 if (!index (registry_str, '-')) |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2673 { |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2674 if (registry_str[strlen (registry_str) - 1] == '*') |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2675 strcat (pattern_str, "-*"); |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2676 else |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2677 strcat (pattern_str, "*-*"); |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2678 } |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2679 pattern = build_string (pattern_str); |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2680 } |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2681 |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2682 /* Get the list of fonts matching PATTERN. */ |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2683 #ifdef WINDOWSNT |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2684 BLOCK_INPUT; |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2685 fonts = w32_list_fonts (f, pattern, 0, 1); |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2686 UNBLOCK_INPUT; |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2687 #else |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2688 fonts = x_list_fonts (f, pattern, -1, 1); |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2689 #endif |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2690 return XINT (Flength (fonts)); |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2691 } |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2692 |
|
605475ba45e3
(face_font_available_p): New function.
Kenichi Handa <handa@m17n.org>
parents:
53334
diff
changeset
|
2693 |
| 24995 | 2694 /* Determine fonts matching PATTERN on frame F. Sort resulting fonts |
| 2695 using comparison function CMPFN. Value is the number of fonts | |
| 2696 found. If value is non-zero, *FONTS is set to a vector of | |
| 2697 font_name structures allocated from the heap containing matching | |
| 2698 fonts. Each element of *FONTS contains a name member that is also | |
| 2699 allocated from the heap. Font names in these structures are split | |
| 2700 into fields. Use free_font_names to free such an array. */ | |
| 2701 | |
| 2702 static int | |
| 2703 sorted_font_list (f, pattern, cmpfn, fonts) | |
| 2704 struct frame *f; | |
| 2705 char *pattern; | |
| 2706 int (*cmpfn) P_ ((const void *, const void *)); | |
| 2707 struct font_name **fonts; | |
| 2708 { | |
| 2709 int nfonts; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
2710 |
| 24995 | 2711 /* Get the list of fonts matching pattern. 100 should suffice. */ |
| 25270 | 2712 nfonts = DEFAULT_FONT_LIST_LIMIT; |
|
49859
c6bacc76cfb6
* xterm.c (x_list_fonts): If maxnames is less than 0, get all font
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49600
diff
changeset
|
2713 if (INTEGERP (Vfont_list_limit)) |
|
c6bacc76cfb6
* xterm.c (x_list_fonts): If maxnames is less than 0, get all font
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49600
diff
changeset
|
2714 nfonts = XINT (Vfont_list_limit); |
|
c6bacc76cfb6
* xterm.c (x_list_fonts): If maxnames is less than 0, get all font
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49600
diff
changeset
|
2715 |
|
c6bacc76cfb6
* xterm.c (x_list_fonts): If maxnames is less than 0, get all font
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49600
diff
changeset
|
2716 *fonts = NULL; |
|
c6bacc76cfb6
* xterm.c (x_list_fonts): If maxnames is less than 0, get all font
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49600
diff
changeset
|
2717 nfonts = x_face_list_fonts (f, pattern, fonts, nfonts, 1); |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
2718 |
|
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
2719 /* Sort the resulting array and return it in *FONTS. If no |
| 24995 | 2720 fonts were found, make sure to set *FONTS to null. */ |
| 2721 if (nfonts) | |
| 2722 sort_fonts (f, *fonts, nfonts, cmpfn); | |
|
49859
c6bacc76cfb6
* xterm.c (x_list_fonts): If maxnames is less than 0, get all font
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49600
diff
changeset
|
2723 else if (*fonts) |
| 24995 | 2724 { |
| 2725 xfree (*fonts); | |
| 2726 *fonts = NULL; | |
| 2727 } | |
| 2728 | |
| 2729 return nfonts; | |
| 2730 } | |
| 2731 | |
| 2732 | |
| 2733 /* Compare two font_name structures *A and *B. Value is analogous to | |
| 2734 strcmp. Sort order is given by the global variable | |
| 2735 font_sort_order. Font names are sorted so that, everything else | |
| 2736 being equal, fonts with a resolution closer to that of the frame on | |
| 2737 which they are used are listed first. The global variable | |
| 2738 font_frame is the frame on which we operate. */ | |
| 2739 | |
| 2740 static int | |
| 2741 cmp_font_names (a, b) | |
| 2742 const void *a, *b; | |
| 2743 { | |
| 2744 struct font_name *x = (struct font_name *) a; | |
| 2745 struct font_name *y = (struct font_name *) b; | |
| 2746 int cmp; | |
| 2747 | |
| 2748 /* All strings have been converted to lower-case by split_font_name, | |
| 2749 so we can use strcmp here. */ | |
| 2750 cmp = strcmp (x->fields[XLFD_FAMILY], y->fields[XLFD_FAMILY]); | |
| 2751 if (cmp == 0) | |
| 2752 { | |
| 2753 int i; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
2754 |
| 24995 | 2755 for (i = 0; i < DIM (font_sort_order) && cmp == 0; ++i) |
| 2756 { | |
| 2757 int j = font_sort_order[i]; | |
| 2758 cmp = x->numeric[j] - y->numeric[j]; | |
| 2759 } | |
| 2760 | |
| 2761 if (cmp == 0) | |
| 2762 { | |
| 2763 /* Everything else being equal, we prefer fonts with an | |
| 2764 y-resolution closer to that of the frame. */ | |
| 2765 int resy = FRAME_X_DISPLAY_INFO (font_frame)->resy; | |
| 2766 int x_resy = x->numeric[XLFD_RESY]; | |
| 2767 int y_resy = y->numeric[XLFD_RESY]; | |
| 2768 cmp = abs (resy - x_resy) - abs (resy - y_resy); | |
| 2769 } | |
| 2770 } | |
| 2771 | |
| 2772 return cmp; | |
| 2773 } | |
| 2774 | |
| 2775 | |
| 89483 | 2776 /* Get a sorted list of fonts matching PATTERN on frame F. If PATTERN |
| 2777 is nil, list fonts matching FAMILY and REGISTRY. FAMILY is a | |
| 2778 family name string or nil. REGISTRY is a registry name string. | |
| 2779 Set *FONTS to a vector of font_name structures allocated from the | |
| 2780 heap containing the fonts found. Value is the number of fonts | |
| 2781 found. */ | |
| 24995 | 2782 |
| 2783 static int | |
|
33372
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
2784 font_list_1 (f, pattern, family, registry, fonts) |
| 24995 | 2785 struct frame *f; |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
2786 Lisp_Object pattern, family, registry; |
| 24995 | 2787 struct font_name **fonts; |
| 2788 { | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
2789 char *pattern_str, *family_str, *registry_str; |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
2790 |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
2791 if (NILP (pattern)) |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
2792 { |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
2793 family_str = (NILP (family) ? "*" : (char *) SDATA (family)); |
|
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
2794 registry_str = (NILP (registry) ? "*" : (char *) SDATA (registry)); |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
2795 |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
2796 pattern_str = (char *) alloca (strlen (family_str) |
|
29768
6f3f0ca4a359
(font_list): Handle the case that REGISTRY doesn't contain information
Kenichi Handa <handa@m17n.org>
parents:
29711
diff
changeset
|
2797 + strlen (registry_str) |
|
6f3f0ca4a359
(font_list): Handle the case that REGISTRY doesn't contain information
Kenichi Handa <handa@m17n.org>
parents:
29711
diff
changeset
|
2798 + 10); |
|
6f3f0ca4a359
(font_list): Handle the case that REGISTRY doesn't contain information
Kenichi Handa <handa@m17n.org>
parents:
29711
diff
changeset
|
2799 strcpy (pattern_str, index (family_str, '-') ? "-" : "-*-"); |
|
6f3f0ca4a359
(font_list): Handle the case that REGISTRY doesn't contain information
Kenichi Handa <handa@m17n.org>
parents:
29711
diff
changeset
|
2800 strcat (pattern_str, family_str); |
|
6f3f0ca4a359
(font_list): Handle the case that REGISTRY doesn't contain information
Kenichi Handa <handa@m17n.org>
parents:
29711
diff
changeset
|
2801 strcat (pattern_str, "-*-"); |
|
6f3f0ca4a359
(font_list): Handle the case that REGISTRY doesn't contain information
Kenichi Handa <handa@m17n.org>
parents:
29711
diff
changeset
|
2802 strcat (pattern_str, registry_str); |
|
6f3f0ca4a359
(font_list): Handle the case that REGISTRY doesn't contain information
Kenichi Handa <handa@m17n.org>
parents:
29711
diff
changeset
|
2803 if (!index (registry_str, '-')) |
|
6f3f0ca4a359
(font_list): Handle the case that REGISTRY doesn't contain information
Kenichi Handa <handa@m17n.org>
parents:
29711
diff
changeset
|
2804 { |
|
6f3f0ca4a359
(font_list): Handle the case that REGISTRY doesn't contain information
Kenichi Handa <handa@m17n.org>
parents:
29711
diff
changeset
|
2805 if (registry_str[strlen (registry_str) - 1] == '*') |
|
6f3f0ca4a359
(font_list): Handle the case that REGISTRY doesn't contain information
Kenichi Handa <handa@m17n.org>
parents:
29711
diff
changeset
|
2806 strcat (pattern_str, "-*"); |
|
6f3f0ca4a359
(font_list): Handle the case that REGISTRY doesn't contain information
Kenichi Handa <handa@m17n.org>
parents:
29711
diff
changeset
|
2807 else |
|
6f3f0ca4a359
(font_list): Handle the case that REGISTRY doesn't contain information
Kenichi Handa <handa@m17n.org>
parents:
29711
diff
changeset
|
2808 strcat (pattern_str, "*-*"); |
|
6f3f0ca4a359
(font_list): Handle the case that REGISTRY doesn't contain information
Kenichi Handa <handa@m17n.org>
parents:
29711
diff
changeset
|
2809 } |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
2810 } |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
2811 else |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
2812 pattern_str = (char *) SDATA (pattern); |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
2813 |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
2814 return sorted_font_list (f, pattern_str, cmp_font_names, fonts); |
| 24995 | 2815 } |
| 2816 | |
| 2817 | |
|
34160
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
2818 /* Concatenate font list FONTS1 and FONTS2. FONTS1 and FONTS2 |
|
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
2819 contains NFONTS1 fonts and NFONTS2 fonts respectively. Return a |
|
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
2820 pointer to a newly allocated font list. FONTS1 and FONTS2 are |
|
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
2821 freed. */ |
|
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
2822 |
|
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
2823 static struct font_name * |
|
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
2824 concat_font_list (fonts1, nfonts1, fonts2, nfonts2) |
|
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
2825 struct font_name *fonts1, *fonts2; |
|
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
2826 int nfonts1, nfonts2; |
|
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
2827 { |
|
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
2828 int new_nfonts = nfonts1 + nfonts2; |
|
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
2829 struct font_name *new_fonts; |
|
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
2830 |
|
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
2831 new_fonts = (struct font_name *) xmalloc (sizeof *new_fonts * new_nfonts); |
|
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
2832 bcopy (fonts1, new_fonts, sizeof *new_fonts * nfonts1); |
|
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
2833 bcopy (fonts2, new_fonts + nfonts1, sizeof *new_fonts * nfonts2); |
|
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
2834 xfree (fonts1); |
|
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
2835 xfree (fonts2); |
|
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
2836 return new_fonts; |
|
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
2837 } |
|
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
2838 |
|
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
2839 |
|
33372
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
2840 /* Get a sorted list of fonts of family FAMILY on frame F. |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
2841 |
| 88907 | 2842 If PATTERN is non-nil, list fonts matching that pattern. |
|
33372
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
2843 |
|
89348
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2844 If REGISTRY is non-nil, it is a list of registry (and encoding) |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2845 names. Return fonts with those registries and the alternative |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2846 registries from Vface_alternative_font_registry_alist. |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48384
diff
changeset
|
2847 |
|
33372
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
2848 If REGISTRY is nil return fonts of any registry. |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
2849 |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
2850 Set *FONTS to a vector of font_name structures allocated from the |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
2851 heap containing the fonts found. Value is the number of fonts |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
2852 found. */ |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
2853 |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
2854 static int |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
2855 font_list (f, pattern, family, registry, fonts) |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
2856 struct frame *f; |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
2857 Lisp_Object pattern, family, registry; |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
2858 struct font_name **fonts; |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
2859 { |
|
89348
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2860 int nfonts; |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2861 int reg_prio; |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2862 int i; |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2863 |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2864 if (NILP (registry)) |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2865 return font_list_1 (f, pattern, family, registry, fonts); |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2866 |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2867 for (reg_prio = 0, nfonts = 0; CONSP (registry); registry = XCDR (registry)) |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2868 { |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2869 Lisp_Object elt, alter; |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2870 int nfonts2; |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2871 struct font_name *fonts2; |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2872 |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2873 elt = XCAR (registry); |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2874 alter = Fassoc (elt, Vface_alternative_font_registry_alist); |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2875 if (NILP (alter)) |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2876 alter = Fcons (elt, Qnil); |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2877 for (; CONSP (alter); alter = XCDR (alter), reg_prio++) |
|
33372
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
2878 { |
|
89348
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2879 nfonts2 = font_list_1 (f, pattern, family, XCAR (alter), &fonts2); |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2880 if (nfonts2 > 0) |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2881 { |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2882 if (reg_prio > 0) |
|
34160
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
2883 for (i = 0; i < nfonts2; i++) |
|
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
2884 fonts2[i].registry_priority = reg_prio; |
|
89348
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2885 if (nfonts > 0) |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2886 *fonts = concat_font_list (*fonts, nfonts, fonts2, nfonts2); |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2887 else |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2888 *fonts = fonts2; |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2889 nfonts += nfonts2; |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
2890 } |
|
33372
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
2891 } |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
2892 } |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
2893 |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
2894 return nfonts; |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
2895 } |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
2896 |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
2897 |
| 24995 | 2898 /* Remove elements from LIST whose cars are `equal'. Called from |
|
25661
a6e2ae7964fb
(Fx_family_fonts): Replaces Fx_font_list.
Gerd Moellmann <gerd@gnu.org>
parents:
25592
diff
changeset
|
2899 x-family-fonts and x-font-family-list to remove duplicate font |
| 24995 | 2900 entries. */ |
| 2901 | |
| 2902 static void | |
| 2903 remove_duplicates (list) | |
| 2904 Lisp_Object list; | |
| 2905 { | |
| 2906 Lisp_Object tail = list; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
2907 |
| 24995 | 2908 while (!NILP (tail) && !NILP (XCDR (tail))) |
| 2909 { | |
| 2910 Lisp_Object next = XCDR (tail); | |
| 2911 if (!NILP (Fequal (XCAR (next), XCAR (tail)))) | |
|
39973
579177964efa
Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
Ken Raeburn <raeburn@raeburn.org>
parents:
39914
diff
changeset
|
2912 XSETCDR (tail, XCDR (next)); |
| 24995 | 2913 else |
| 2914 tail = XCDR (tail); | |
| 2915 } | |
| 2916 } | |
| 2917 | |
| 2918 | |
|
25661
a6e2ae7964fb
(Fx_family_fonts): Replaces Fx_font_list.
Gerd Moellmann <gerd@gnu.org>
parents:
25592
diff
changeset
|
2919 DEFUN ("x-family-fonts", Fx_family_fonts, Sx_family_fonts, 0, 2, 0, |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
2920 doc: /* Return a list of available fonts of family FAMILY on FRAME. |
|
39914
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
2921 If FAMILY is omitted or nil, list all families. |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
2922 Otherwise, FAMILY must be a string, possibly containing wildcards |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
2923 `?' and `*'. |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
2924 If FRAME is omitted or nil, use the selected frame. |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
2925 Each element of the result is a vector [FAMILY WIDTH POINT-SIZE WEIGHT |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
2926 SLANT FIXED-P FULL REGISTRY-AND-ENCODING]. |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
2927 FAMILY is the font family name. POINT-SIZE is the size of the |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
2928 font in 1/10 pt. WIDTH, WEIGHT, and SLANT are symbols describing the |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
2929 width, weight and slant of the font. These symbols are the same as for |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
2930 face attributes. FIXED-P is non-nil if the font is fixed-pitch. |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
2931 FULL is the full name of the font, and REGISTRY-AND-ENCODING is a string |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
2932 giving the registry and encoding of the font. |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
2933 The result list is sorted according to the current setting of |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
2934 the face font sort order. */) |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
2935 (family, frame) |
| 24995 | 2936 Lisp_Object family, frame; |
| 2937 { | |
| 2938 struct frame *f = check_x_frame (frame); | |
| 2939 struct font_name *fonts; | |
| 2940 int i, nfonts; | |
| 2941 Lisp_Object result; | |
| 2942 struct gcpro gcpro1; | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
2943 |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
2944 if (!NILP (family)) |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
2945 CHECK_STRING (family); |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
2946 |
| 24995 | 2947 result = Qnil; |
| 2948 GCPRO1 (result); | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
2949 nfonts = font_list (f, Qnil, family, Qnil, &fonts); |
| 24995 | 2950 for (i = nfonts - 1; i >= 0; --i) |
| 2951 { | |
| 25270 | 2952 Lisp_Object v = Fmake_vector (make_number (8), Qnil); |
| 2953 char *tem; | |
| 24995 | 2954 |
| 2955 ASET (v, 0, build_string (fonts[i].fields[XLFD_FAMILY])); | |
| 2956 ASET (v, 1, xlfd_symbolic_swidth (fonts + i)); | |
| 2957 ASET (v, 2, make_number (xlfd_point_size (f, fonts + i))); | |
| 2958 ASET (v, 3, xlfd_symbolic_weight (fonts + i)); | |
| 2959 ASET (v, 4, xlfd_symbolic_slant (fonts + i)); | |
| 2960 ASET (v, 5, xlfd_fixed_p (fonts + i) ? Qt : Qnil); | |
| 25270 | 2961 tem = build_font_name (fonts + i); |
| 2962 ASET (v, 6, build_string (tem)); | |
| 2963 sprintf (tem, "%s-%s", fonts[i].fields[XLFD_REGISTRY], | |
| 2964 fonts[i].fields[XLFD_ENCODING]); | |
| 2965 ASET (v, 7, build_string (tem)); | |
| 2966 xfree (tem); | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
2967 |
| 24995 | 2968 result = Fcons (v, result); |
| 2969 } | |
| 2970 | |
| 2971 remove_duplicates (result); | |
| 2972 free_font_names (fonts, nfonts); | |
| 2973 UNGCPRO; | |
| 2974 return result; | |
| 2975 } | |
| 2976 | |
| 2977 | |
| 2978 DEFUN ("x-font-family-list", Fx_font_family_list, Sx_font_family_list, | |
| 2979 0, 1, 0, | |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
2980 doc: /* Return a list of available font families on FRAME. |
|
39914
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
2981 If FRAME is omitted or nil, use the selected frame. |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
2982 Value is a list of conses (FAMILY . FIXED-P) where FAMILY |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
2983 is a font family, and FIXED-P is non-nil if fonts of that family |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
2984 are fixed-pitch. */) |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
2985 (frame) |
| 24995 | 2986 Lisp_Object frame; |
| 2987 { | |
| 2988 struct frame *f = check_x_frame (frame); | |
| 2989 int nfonts, i; | |
| 2990 struct font_name *fonts; | |
| 2991 Lisp_Object result; | |
| 2992 struct gcpro gcpro1; | |
|
46293
1fb8f75062c6
Use macro SPECPDL_INDEX.
Juanma Barranquero <lekktu@gmail.com>
parents:
46285
diff
changeset
|
2993 int count = SPECPDL_INDEX (); |
|
49859
c6bacc76cfb6
* xterm.c (x_list_fonts): If maxnames is less than 0, get all font
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49600
diff
changeset
|
2994 |
|
c6bacc76cfb6
* xterm.c (x_list_fonts): If maxnames is less than 0, get all font
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49600
diff
changeset
|
2995 /* Let's consider all fonts. */ |
|
c6bacc76cfb6
* xterm.c (x_list_fonts): If maxnames is less than 0, get all font
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49600
diff
changeset
|
2996 specbind (intern ("font-list-limit"), make_number (-1)); |
|
c6bacc76cfb6
* xterm.c (x_list_fonts): If maxnames is less than 0, get all font
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49600
diff
changeset
|
2997 nfonts = font_list (f, Qnil, Qnil, Qnil, &fonts); |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
2998 |
| 24995 | 2999 result = Qnil; |
| 3000 GCPRO1 (result); | |
| 3001 for (i = nfonts - 1; i >= 0; --i) | |
| 3002 result = Fcons (Fcons (build_string (fonts[i].fields[XLFD_FAMILY]), | |
| 3003 xlfd_fixed_p (fonts + i) ? Qt : Qnil), | |
| 3004 result); | |
| 3005 | |
| 3006 remove_duplicates (result); | |
| 3007 free_font_names (fonts, nfonts); | |
| 3008 UNGCPRO; | |
| 25270 | 3009 return unbind_to (count, result); |
| 24995 | 3010 } |
| 3011 | |
| 3012 | |
| 3013 DEFUN ("x-list-fonts", Fx_list_fonts, Sx_list_fonts, 1, 5, 0, | |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
3014 doc: /* Return a list of the names of available fonts matching PATTERN. |
|
39914
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
3015 If optional arguments FACE and FRAME are specified, return only fonts |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
3016 the same size as FACE on FRAME. |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
3017 PATTERN is a string, perhaps with wildcard characters; |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
3018 the * character matches any substring, and |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
3019 the ? character matches any single character. |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
3020 PATTERN is case-insensitive. |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
3021 FACE is a face name--a symbol. |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
3022 |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
3023 The return value is a list of strings, suitable as arguments to |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
3024 set-face-font. |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
3025 |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
3026 Fonts Emacs can't use may or may not be excluded |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
3027 even if they match PATTERN and FACE. |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
3028 The optional fourth argument MAXIMUM sets a limit on how many |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
3029 fonts to match. The first MAXIMUM fonts are reported. |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
3030 The optional fifth argument WIDTH, if specified, is a number of columns |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
3031 occupied by a character of a font. In that case, return only fonts |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
3032 the WIDTH times as wide as FACE on FRAME. */) |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
3033 (pattern, face, frame, maximum, width) |
| 24995 | 3034 Lisp_Object pattern, face, frame, maximum, width; |
| 3035 { | |
| 3036 struct frame *f; | |
| 3037 int size; | |
| 3038 int maxnames; | |
| 3039 | |
| 3040 check_x (); | |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
3041 CHECK_STRING (pattern); |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
3042 |
| 24995 | 3043 if (NILP (maximum)) |
|
49859
c6bacc76cfb6
* xterm.c (x_list_fonts): If maxnames is less than 0, get all font
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
49600
diff
changeset
|
3044 maxnames = -1; |
| 24995 | 3045 else |
| 3046 { | |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
3047 CHECK_NATNUM (maximum); |
| 24995 | 3048 maxnames = XINT (maximum); |
| 3049 } | |
| 3050 | |
| 3051 if (!NILP (width)) | |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
3052 CHECK_NUMBER (width); |
| 24995 | 3053 |
| 3054 /* We can't simply call check_x_frame because this function may be | |
| 3055 called before any frame is created. */ | |
| 3056 f = frame_or_selected_frame (frame, 2); | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
3057 if (!FRAME_WINDOW_P (f)) |
| 24995 | 3058 { |
| 3059 /* Perhaps we have not yet created any frame. */ | |
| 3060 f = NULL; | |
| 3061 face = Qnil; | |
| 3062 } | |
| 3063 | |
| 3064 /* Determine the width standard for comparison with the fonts we find. */ | |
| 3065 | |
| 3066 if (NILP (face)) | |
| 3067 size = 0; | |
| 3068 else | |
| 3069 { | |
| 3070 /* This is of limited utility since it works with character | |
| 3071 widths. Keep it for compatibility. --gerd. */ | |
|
90054
f2ebccfa87d4
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-74
Miles Bader <miles@gnu.org>
diff
changeset
|
3072 int face_id = lookup_named_face (f, face, 0); |
|
33275
8c453c73a11b
(lookup_named_face): If default face isn't realized,
Gerd Moellmann <gerd@gnu.org>
parents:
33082
diff
changeset
|
3073 struct face *face = (face_id < 0 |
|
8c453c73a11b
(lookup_named_face): If default face isn't realized,
Gerd Moellmann <gerd@gnu.org>
parents:
33082
diff
changeset
|
3074 ? NULL |
|
8c453c73a11b
(lookup_named_face): If default face isn't realized,
Gerd Moellmann <gerd@gnu.org>
parents:
33082
diff
changeset
|
3075 : FACE_FROM_ID (f, face_id)); |
|
8c453c73a11b
(lookup_named_face): If default face isn't realized,
Gerd Moellmann <gerd@gnu.org>
parents:
33082
diff
changeset
|
3076 |
|
51210
491ca5acf5b3
[WINDOWSNT]: Move redefinition of FONT_WIDTH macro to
Kim F. Storm <storm@cua.dk>
parents:
51092
diff
changeset
|
3077 #ifdef WINDOWSNT |
|
491ca5acf5b3
[WINDOWSNT]: Move redefinition of FONT_WIDTH macro to
Kim F. Storm <storm@cua.dk>
parents:
51092
diff
changeset
|
3078 /* For historic reasons, FONT_WIDTH refers to average width on W32, |
|
491ca5acf5b3
[WINDOWSNT]: Move redefinition of FONT_WIDTH macro to
Kim F. Storm <storm@cua.dk>
parents:
51092
diff
changeset
|
3079 not maximum as on X. Redefine here. */ |
|
491ca5acf5b3
[WINDOWSNT]: Move redefinition of FONT_WIDTH macro to
Kim F. Storm <storm@cua.dk>
parents:
51092
diff
changeset
|
3080 #undef FONT_WIDTH |
|
491ca5acf5b3
[WINDOWSNT]: Move redefinition of FONT_WIDTH macro to
Kim F. Storm <storm@cua.dk>
parents:
51092
diff
changeset
|
3081 #define FONT_WIDTH FONT_MAX_WIDTH |
|
491ca5acf5b3
[WINDOWSNT]: Move redefinition of FONT_WIDTH macro to
Kim F. Storm <storm@cua.dk>
parents:
51092
diff
changeset
|
3082 #endif |
|
491ca5acf5b3
[WINDOWSNT]: Move redefinition of FONT_WIDTH macro to
Kim F. Storm <storm@cua.dk>
parents:
51092
diff
changeset
|
3083 |
|
33275
8c453c73a11b
(lookup_named_face): If default face isn't realized,
Gerd Moellmann <gerd@gnu.org>
parents:
33082
diff
changeset
|
3084 if (face && face->font) |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
3085 size = FONT_WIDTH (face->font); |
| 24995 | 3086 else |
|
51210
491ca5acf5b3
[WINDOWSNT]: Move redefinition of FONT_WIDTH macro to
Kim F. Storm <storm@cua.dk>
parents:
51092
diff
changeset
|
3087 size = FONT_WIDTH (FRAME_FONT (f)); /* FRAME_COLUMN_WIDTH (f) */ |
| 24995 | 3088 |
| 3089 if (!NILP (width)) | |
| 3090 size *= XINT (width); | |
| 3091 } | |
| 3092 | |
| 3093 { | |
| 3094 Lisp_Object args[2]; | |
| 3095 | |
| 3096 args[0] = x_list_fonts (f, pattern, size, maxnames); | |
| 3097 if (f == NULL) | |
| 3098 /* We don't have to check fontsets. */ | |
| 3099 return args[0]; | |
| 3100 args[1] = list_fontsets (f, pattern, size); | |
| 3101 return Fnconc (2, args); | |
| 3102 } | |
| 3103 } | |
| 3104 | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
3105 #endif /* HAVE_WINDOW_SYSTEM */ |
| 24995 | 3106 |
| 3107 | |
| 3108 | |
| 3109 /*********************************************************************** | |
| 3110 Lisp Faces | |
| 3111 ***********************************************************************/ | |
| 3112 | |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3113 /* Access face attributes of face LFACE, a Lisp vector. */ |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3114 |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3115 #define LFACE_FAMILY(LFACE) AREF ((LFACE), LFACE_FAMILY_INDEX) |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3116 #define LFACE_HEIGHT(LFACE) AREF ((LFACE), LFACE_HEIGHT_INDEX) |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3117 #define LFACE_WEIGHT(LFACE) AREF ((LFACE), LFACE_WEIGHT_INDEX) |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3118 #define LFACE_SLANT(LFACE) AREF ((LFACE), LFACE_SLANT_INDEX) |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3119 #define LFACE_UNDERLINE(LFACE) AREF ((LFACE), LFACE_UNDERLINE_INDEX) |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3120 #define LFACE_INVERSE(LFACE) AREF ((LFACE), LFACE_INVERSE_INDEX) |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3121 #define LFACE_FOREGROUND(LFACE) AREF ((LFACE), LFACE_FOREGROUND_INDEX) |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3122 #define LFACE_BACKGROUND(LFACE) AREF ((LFACE), LFACE_BACKGROUND_INDEX) |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3123 #define LFACE_STIPPLE(LFACE) AREF ((LFACE), LFACE_STIPPLE_INDEX) |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3124 #define LFACE_SWIDTH(LFACE) AREF ((LFACE), LFACE_SWIDTH_INDEX) |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3125 #define LFACE_OVERLINE(LFACE) AREF ((LFACE), LFACE_OVERLINE_INDEX) |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3126 #define LFACE_STRIKE_THROUGH(LFACE) AREF ((LFACE), LFACE_STRIKE_THROUGH_INDEX) |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3127 #define LFACE_BOX(LFACE) AREF ((LFACE), LFACE_BOX_INDEX) |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3128 #define LFACE_FONT(LFACE) AREF ((LFACE), LFACE_FONT_INDEX) |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3129 #define LFACE_INHERIT(LFACE) AREF ((LFACE), LFACE_INHERIT_INDEX) |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3130 #define LFACE_AVGWIDTH(LFACE) AREF ((LFACE), LFACE_AVGWIDTH_INDEX) |
|
89047
3b6234eb229c
(QCfontset): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88939
diff
changeset
|
3131 #define LFACE_FONTSET(LFACE) AREF ((LFACE), LFACE_FONTSET_INDEX) |
| 24995 | 3132 |
| 3133 /* Non-zero if LFACE is a Lisp face. A Lisp face is a vector of size | |
| 3134 LFACE_VECTOR_SIZE which has the symbol `face' in slot 0. */ | |
| 3135 | |
| 3136 #define LFACEP(LFACE) \ | |
| 3137 (VECTORP (LFACE) \ | |
| 3138 && XVECTOR (LFACE)->size == LFACE_VECTOR_SIZE \ | |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3139 && EQ (AREF (LFACE, 0), Qface)) |
| 24995 | 3140 |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
3141 |
| 24995 | 3142 #if GLYPH_DEBUG |
| 3143 | |
| 3144 /* Check consistency of Lisp face attribute vector ATTRS. */ | |
| 3145 | |
| 3146 static void | |
| 3147 check_lface_attrs (attrs) | |
| 3148 Lisp_Object *attrs; | |
| 3149 { | |
| 3150 xassert (UNSPECIFIEDP (attrs[LFACE_FAMILY_INDEX]) | |
| 3151 || STRINGP (attrs[LFACE_FAMILY_INDEX])); | |
| 3152 xassert (UNSPECIFIEDP (attrs[LFACE_SWIDTH_INDEX]) | |
| 3153 || SYMBOLP (attrs[LFACE_SWIDTH_INDEX])); | |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3154 xassert (UNSPECIFIEDP (attrs[LFACE_AVGWIDTH_INDEX]) |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3155 || INTEGERP (attrs[LFACE_AVGWIDTH_INDEX])); |
| 24995 | 3156 xassert (UNSPECIFIEDP (attrs[LFACE_HEIGHT_INDEX]) |
| 31178 | 3157 || INTEGERP (attrs[LFACE_HEIGHT_INDEX]) |
| 3158 || FLOATP (attrs[LFACE_HEIGHT_INDEX]) | |
| 3159 || FUNCTIONP (attrs[LFACE_HEIGHT_INDEX])); | |
| 24995 | 3160 xassert (UNSPECIFIEDP (attrs[LFACE_WEIGHT_INDEX]) |
| 3161 || SYMBOLP (attrs[LFACE_WEIGHT_INDEX])); | |
| 3162 xassert (UNSPECIFIEDP (attrs[LFACE_SLANT_INDEX]) | |
| 3163 || SYMBOLP (attrs[LFACE_SLANT_INDEX])); | |
| 3164 xassert (UNSPECIFIEDP (attrs[LFACE_UNDERLINE_INDEX]) | |
| 3165 || SYMBOLP (attrs[LFACE_UNDERLINE_INDEX]) | |
| 3166 || STRINGP (attrs[LFACE_UNDERLINE_INDEX])); | |
| 3167 xassert (UNSPECIFIEDP (attrs[LFACE_OVERLINE_INDEX]) | |
| 3168 || SYMBOLP (attrs[LFACE_OVERLINE_INDEX]) | |
| 3169 || STRINGP (attrs[LFACE_OVERLINE_INDEX])); | |
| 3170 xassert (UNSPECIFIEDP (attrs[LFACE_STRIKE_THROUGH_INDEX]) | |
| 3171 || SYMBOLP (attrs[LFACE_STRIKE_THROUGH_INDEX]) | |
| 3172 || STRINGP (attrs[LFACE_STRIKE_THROUGH_INDEX])); | |
| 3173 xassert (UNSPECIFIEDP (attrs[LFACE_BOX_INDEX]) | |
| 3174 || SYMBOLP (attrs[LFACE_BOX_INDEX]) | |
| 3175 || STRINGP (attrs[LFACE_BOX_INDEX]) | |
| 3176 || INTEGERP (attrs[LFACE_BOX_INDEX]) | |
| 3177 || CONSP (attrs[LFACE_BOX_INDEX])); | |
| 3178 xassert (UNSPECIFIEDP (attrs[LFACE_INVERSE_INDEX]) | |
| 3179 || SYMBOLP (attrs[LFACE_INVERSE_INDEX])); | |
| 3180 xassert (UNSPECIFIEDP (attrs[LFACE_FOREGROUND_INDEX]) | |
| 3181 || STRINGP (attrs[LFACE_FOREGROUND_INDEX])); | |
| 3182 xassert (UNSPECIFIEDP (attrs[LFACE_BACKGROUND_INDEX]) | |
| 3183 || STRINGP (attrs[LFACE_BACKGROUND_INDEX])); | |
| 31178 | 3184 xassert (UNSPECIFIEDP (attrs[LFACE_INHERIT_INDEX]) |
| 3185 || NILP (attrs[LFACE_INHERIT_INDEX]) | |
| 3186 || SYMBOLP (attrs[LFACE_INHERIT_INDEX]) | |
| 3187 || CONSP (attrs[LFACE_INHERIT_INDEX])); | |
| 24995 | 3188 #ifdef HAVE_WINDOW_SYSTEM |
| 3189 xassert (UNSPECIFIEDP (attrs[LFACE_STIPPLE_INDEX]) | |
| 3190 || SYMBOLP (attrs[LFACE_STIPPLE_INDEX]) | |
|
25890
b10a34d40b55
(Qbitmap_spec_p): Replaces Qpixmap_spec_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25883
diff
changeset
|
3191 || !NILP (Fbitmap_spec_p (attrs[LFACE_STIPPLE_INDEX]))); |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3192 xassert (UNSPECIFIEDP (attrs[LFACE_FONT_INDEX]) |
|
28237
2f636fd2f714
(check_lface_attrs) [GLYPH_DEBUG]: Fix syntax error.
Gerd Moellmann <gerd@gnu.org>
parents:
28230
diff
changeset
|
3193 || NILP (attrs[LFACE_FONT_INDEX]) |
|
2f636fd2f714
(check_lface_attrs) [GLYPH_DEBUG]: Fix syntax error.
Gerd Moellmann <gerd@gnu.org>
parents:
28230
diff
changeset
|
3194 || STRINGP (attrs[LFACE_FONT_INDEX])); |
|
89047
3b6234eb229c
(QCfontset): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88939
diff
changeset
|
3195 xassert (UNSPECIFIEDP (attrs[LFACE_FONTSET_INDEX]) |
|
3b6234eb229c
(QCfontset): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88939
diff
changeset
|
3196 || STRINGP (attrs[LFACE_FONTSET_INDEX])); |
| 24995 | 3197 #endif |
| 3198 } | |
| 3199 | |
| 3200 | |
| 3201 /* Check consistency of attributes of Lisp face LFACE (a Lisp vector). */ | |
| 3202 | |
| 3203 static void | |
| 3204 check_lface (lface) | |
| 3205 Lisp_Object lface; | |
| 3206 { | |
| 3207 if (!NILP (lface)) | |
| 3208 { | |
| 3209 xassert (LFACEP (lface)); | |
| 3210 check_lface_attrs (XVECTOR (lface)->contents); | |
| 3211 } | |
| 3212 } | |
| 3213 | |
| 3214 #else /* GLYPH_DEBUG == 0 */ | |
| 3215 | |
| 3216 #define check_lface_attrs(attrs) (void) 0 | |
| 3217 #define check_lface(lface) (void) 0 | |
| 3218 | |
| 3219 #endif /* GLYPH_DEBUG == 0 */ | |
| 3220 | |
| 3221 | |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3222 |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3223 /* Face-merge cycle checking. */ |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3224 |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3225 /* A `named merge point' is simply a point during face-merging where we |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3226 look up a face by name. We keep a stack of which named lookups we're |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3227 currently processing so that we can easily detect cycles, using a |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3228 linked- list of struct named_merge_point structures, typically |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3229 allocated on the stack frame of the named lookup functions which are |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3230 active (so no consing is required). */ |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3231 struct named_merge_point |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3232 { |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3233 Lisp_Object face_name; |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3234 struct named_merge_point *prev; |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3235 }; |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3236 |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3237 |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3238 /* If a face merging cycle is detected for FACE_NAME, return 0, |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3239 otherwise add NEW_NAMED_MERGE_POINT, which is initialized using |
|
55982
de4c259f651b
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-385
Miles Bader <miles@gnu.org>
parents:
55966
diff
changeset
|
3240 FACE_NAME, as the head of the linked list pointed to by |
|
de4c259f651b
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-385
Miles Bader <miles@gnu.org>
parents:
55966
diff
changeset
|
3241 NAMED_MERGE_POINTS, and return 1. */ |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3242 |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3243 static INLINE int |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3244 push_named_merge_point (struct named_merge_point *new_named_merge_point, |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3245 Lisp_Object face_name, |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3246 struct named_merge_point **named_merge_points) |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3247 { |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3248 struct named_merge_point *prev; |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3249 |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3250 for (prev = *named_merge_points; prev; prev = prev->prev) |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3251 if (EQ (face_name, prev->face_name)) |
|
55982
de4c259f651b
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-385
Miles Bader <miles@gnu.org>
parents:
55966
diff
changeset
|
3252 return 0; |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3253 |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3254 new_named_merge_point->face_name = face_name; |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3255 new_named_merge_point->prev = *named_merge_points; |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3256 |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3257 *named_merge_points = new_named_merge_point; |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3258 |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3259 return 1; |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3260 } |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3261 |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3262 |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3263 |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3264 |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3265 /* Resolve face name FACE_NAME. If FACE_NAME is a string, intern it |
|
25883
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
3266 to make it a symvol. If FACE_NAME is an alias for another face, |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
3267 return that face's name. */ |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
3268 |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
3269 static Lisp_Object |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
3270 resolve_face_name (face_name) |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
3271 Lisp_Object face_name; |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
3272 { |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
3273 Lisp_Object aliased; |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
3274 |
|
25883
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
3275 if (STRINGP (face_name)) |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
3276 face_name = intern (SDATA (face_name)); |
|
25883
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
3277 |
|
33070
ca31e3965686
(resolve_face_name): Handle case that FACE_NAME
Gerd Moellmann <gerd@gnu.org>
parents:
32752
diff
changeset
|
3278 while (SYMBOLP (face_name)) |
|
25883
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
3279 { |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
3280 aliased = Fget (face_name, Qface_alias); |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
3281 if (NILP (aliased)) |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
3282 break; |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
3283 else |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
3284 face_name = aliased; |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
3285 } |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
3286 |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
3287 return face_name; |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
3288 } |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
3289 |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
3290 |
| 24995 | 3291 /* Return the face definition of FACE_NAME on frame F. F null means |
|
33853
eb4affa4abc6
(lface_from_face_name): Function comment fix.
Gerd Moellmann <gerd@gnu.org>
parents:
33529
diff
changeset
|
3292 return the definition for new frames. FACE_NAME may be a string or |
|
eb4affa4abc6
(lface_from_face_name): Function comment fix.
Gerd Moellmann <gerd@gnu.org>
parents:
33529
diff
changeset
|
3293 a symbol (apparently Emacs 20.2 allowed strings as face names in |
|
eb4affa4abc6
(lface_from_face_name): Function comment fix.
Gerd Moellmann <gerd@gnu.org>
parents:
33529
diff
changeset
|
3294 face text properties; Ediff uses that). If FACE_NAME is an alias |
|
eb4affa4abc6
(lface_from_face_name): Function comment fix.
Gerd Moellmann <gerd@gnu.org>
parents:
33529
diff
changeset
|
3295 for another face, return that face's definition. If SIGNAL_P is |
|
25661
a6e2ae7964fb
(Fx_family_fonts): Replaces Fx_font_list.
Gerd Moellmann <gerd@gnu.org>
parents:
25592
diff
changeset
|
3296 non-zero, signal an error if FACE_NAME is not a valid face name. |
|
a6e2ae7964fb
(Fx_family_fonts): Replaces Fx_font_list.
Gerd Moellmann <gerd@gnu.org>
parents:
25592
diff
changeset
|
3297 If SIGNAL_P is zero, value is nil if FACE_NAME is not a valid face |
|
a6e2ae7964fb
(Fx_family_fonts): Replaces Fx_font_list.
Gerd Moellmann <gerd@gnu.org>
parents:
25592
diff
changeset
|
3298 name. */ |
| 24995 | 3299 |
| 3300 static INLINE Lisp_Object | |
| 3301 lface_from_face_name (f, face_name, signal_p) | |
| 3302 struct frame *f; | |
| 3303 Lisp_Object face_name; | |
| 3304 int signal_p; | |
| 3305 { | |
|
25883
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
3306 Lisp_Object lface; |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
3307 |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
3308 face_name = resolve_face_name (face_name); |
|
25661
a6e2ae7964fb
(Fx_family_fonts): Replaces Fx_font_list.
Gerd Moellmann <gerd@gnu.org>
parents:
25592
diff
changeset
|
3309 |
| 24995 | 3310 if (f) |
| 3311 lface = assq_no_quit (face_name, f->face_alist); | |
| 3312 else | |
| 3313 lface = assq_no_quit (face_name, Vface_new_frame_defaults); | |
| 3314 | |
| 3315 if (CONSP (lface)) | |
| 3316 lface = XCDR (lface); | |
| 3317 else if (signal_p) | |
| 3318 signal_error ("Invalid face", face_name); | |
| 3319 | |
| 3320 check_lface (lface); | |
| 3321 return lface; | |
| 3322 } | |
| 3323 | |
| 3324 | |
| 3325 /* Get face attributes of face FACE_NAME from frame-local faces on | |
| 3326 frame F. Store the resulting attributes in ATTRS which must point | |
| 3327 to a vector of Lisp_Objects of size LFACE_VECTOR_SIZE. If SIGNAL_P | |
| 3328 is non-zero, signal an error if FACE_NAME does not name a face. | |
| 3329 Otherwise, value is zero if FACE_NAME is not a face. */ | |
| 3330 | |
| 3331 static INLINE int | |
| 3332 get_lface_attributes (f, face_name, attrs, signal_p) | |
| 3333 struct frame *f; | |
| 3334 Lisp_Object face_name; | |
| 3335 Lisp_Object *attrs; | |
| 3336 int signal_p; | |
| 3337 { | |
| 3338 Lisp_Object lface; | |
| 3339 int success_p; | |
| 3340 | |
| 3341 lface = lface_from_face_name (f, face_name, signal_p); | |
| 3342 if (!NILP (lface)) | |
| 3343 { | |
| 3344 bcopy (XVECTOR (lface)->contents, attrs, | |
| 3345 LFACE_VECTOR_SIZE * sizeof *attrs); | |
| 3346 success_p = 1; | |
| 3347 } | |
| 3348 else | |
| 3349 success_p = 0; | |
| 3350 | |
| 3351 return success_p; | |
| 3352 } | |
| 3353 | |
| 3354 | |
| 3355 /* Non-zero if all attributes in face attribute vector ATTRS are | |
| 3356 specified, i.e. are non-nil. */ | |
| 3357 | |
| 3358 static int | |
| 3359 lface_fully_specified_p (attrs) | |
| 3360 Lisp_Object *attrs; | |
| 3361 { | |
| 3362 int i; | |
| 3363 | |
| 3364 for (i = 1; i < LFACE_VECTOR_SIZE; ++i) | |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3365 if (i != LFACE_FONT_INDEX && i != LFACE_INHERIT_INDEX |
| 89483 | 3366 && i != LFACE_AVGWIDTH_INDEX && i != LFACE_FONTSET_INDEX) |
|
53274
c6ecb6ee69bf
* xfaces.c (lface_fully_specified_p): Take into account that
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
53267
diff
changeset
|
3367 if (UNSPECIFIEDP (attrs[i]) |
|
c6ecb6ee69bf
* xfaces.c (lface_fully_specified_p): Take into account that
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
53267
diff
changeset
|
3368 #ifdef MAC_OS |
|
c6ecb6ee69bf
* xfaces.c (lface_fully_specified_p): Take into account that
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
53267
diff
changeset
|
3369 /* MAC_TODO: No stipple support on Mac OS yet, this index is |
|
c6ecb6ee69bf
* xfaces.c (lface_fully_specified_p): Take into account that
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
53267
diff
changeset
|
3370 always unspecified. */ |
|
c6ecb6ee69bf
* xfaces.c (lface_fully_specified_p): Take into account that
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
53267
diff
changeset
|
3371 && i != LFACE_STIPPLE_INDEX |
|
c6ecb6ee69bf
* xfaces.c (lface_fully_specified_p): Take into account that
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
53267
diff
changeset
|
3372 #endif |
|
c6ecb6ee69bf
* xfaces.c (lface_fully_specified_p): Take into account that
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
53267
diff
changeset
|
3373 ) |
|
31202
1733db535955
(lface_fully_specified_p): Handle :inherit.
Gerd Moellmann <gerd@gnu.org>
parents:
31178
diff
changeset
|
3374 break; |
| 24995 | 3375 |
| 3376 return i == LFACE_VECTOR_SIZE; | |
| 3377 } | |
| 3378 | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
3379 #ifdef HAVE_WINDOW_SYSTEM |
| 24995 | 3380 |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3381 /* Set font-related attributes of Lisp face LFACE from the fullname of |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3382 the font opened by FONTNAME. If FORCE_P is zero, set only |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3383 unspecified attributes of LFACE. The exception is `font' |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3384 attribute. It is set to FONTNAME as is regardless of FORCE_P. |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3385 |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3386 If FONTNAME is not available on frame F, |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3387 return 0 if MAY_FAIL_P is non-zero, otherwise abort. |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3388 If the fullname is not in a valid XLFD format, |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3389 return 0 if MAY_FAIL_P is non-zero, otherwise set normal values |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3390 in LFACE and return 1. |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3391 Otherwise, return 1. */ |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
3392 |
| 24995 | 3393 static int |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3394 set_lface_from_font_name (f, lface, fontname, force_p, may_fail_p) |
|
6784
d41c216ccd27
(frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents:
6768
diff
changeset
|
3395 struct frame *f; |
| 24995 | 3396 Lisp_Object lface; |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3397 Lisp_Object fontname; |
|
26594
f24bdf26ad39
(set_lface_from_font_name): New parameter may_fail_p.
Gerd Moellmann <gerd@gnu.org>
parents:
26574
diff
changeset
|
3398 int force_p, may_fail_p; |
| 24995 | 3399 { |
| 3400 struct font_name font; | |
| 3401 char *buffer; | |
| 3402 int pt; | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3403 int have_xlfd_p; |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3404 int fontset; |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
3405 char *font_name = SDATA (fontname); |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3406 struct font_info *font_info; |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3407 |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3408 /* If FONTNAME is actually a fontset name, get ASCII font name of it. */ |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3409 fontset = fs_query_fontset (fontname, 0); |
|
89125
81d88ca705db
(set_lface_from_font_name): Reject the default fontset.
Kenichi Handa <handa@m17n.org>
parents:
89047
diff
changeset
|
3410 if (fontset > 0) |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
3411 font_name = SDATA (fontset_ascii (fontset)); |
|
89125
81d88ca705db
(set_lface_from_font_name): Reject the default fontset.
Kenichi Handa <handa@m17n.org>
parents:
89047
diff
changeset
|
3412 else if (fontset == 0) |
|
81d88ca705db
(set_lface_from_font_name): Reject the default fontset.
Kenichi Handa <handa@m17n.org>
parents:
89047
diff
changeset
|
3413 { |
|
81d88ca705db
(set_lface_from_font_name): Reject the default fontset.
Kenichi Handa <handa@m17n.org>
parents:
89047
diff
changeset
|
3414 if (may_fail_p) |
|
81d88ca705db
(set_lface_from_font_name): Reject the default fontset.
Kenichi Handa <handa@m17n.org>
parents:
89047
diff
changeset
|
3415 return 0; |
|
81d88ca705db
(set_lface_from_font_name): Reject the default fontset.
Kenichi Handa <handa@m17n.org>
parents:
89047
diff
changeset
|
3416 abort (); |
|
81d88ca705db
(set_lface_from_font_name): Reject the default fontset.
Kenichi Handa <handa@m17n.org>
parents:
89047
diff
changeset
|
3417 } |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3418 |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3419 /* Check if FONT_NAME is surely available on the system. Usually |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3420 FONT_NAME is already cached for the frame F and FS_LOAD_FONT |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3421 returns quickly. But, even if FONT_NAME is not yet cached, |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3422 caching it now is not futail because we anyway load the font |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3423 later. */ |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3424 BLOCK_INPUT; |
|
88394
b954eee715da
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
43270
diff
changeset
|
3425 font_info = FS_LOAD_FONT (f, font_name); |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3426 UNBLOCK_INPUT; |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3427 |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3428 if (!font_info) |
|
26594
f24bdf26ad39
(set_lface_from_font_name): New parameter may_fail_p.
Gerd Moellmann <gerd@gnu.org>
parents:
26574
diff
changeset
|
3429 { |
|
f24bdf26ad39
(set_lface_from_font_name): New parameter may_fail_p.
Gerd Moellmann <gerd@gnu.org>
parents:
26574
diff
changeset
|
3430 if (may_fail_p) |
|
f24bdf26ad39
(set_lface_from_font_name): New parameter may_fail_p.
Gerd Moellmann <gerd@gnu.org>
parents:
26574
diff
changeset
|
3431 return 0; |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3432 abort (); |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3433 } |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3434 |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3435 font.name = STRDUPA (font_info->full_name); |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3436 have_xlfd_p = split_font_name (f, &font, 1); |
| 24995 | 3437 |
| 3438 /* Set attributes only if unspecified, otherwise face defaults for | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3439 new frames would never take effect. If we couldn't get a font |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3440 name conforming to XLFD, set normal values. */ |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
3441 |
| 24995 | 3442 if (force_p || UNSPECIFIEDP (LFACE_FAMILY (lface))) |
| 3443 { | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3444 Lisp_Object val; |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3445 if (have_xlfd_p) |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3446 { |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3447 buffer = (char *) alloca (strlen (font.fields[XLFD_FAMILY]) |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3448 + strlen (font.fields[XLFD_FOUNDRY]) |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3449 + 2); |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3450 sprintf (buffer, "%s-%s", font.fields[XLFD_FOUNDRY], |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3451 font.fields[XLFD_FAMILY]); |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3452 val = build_string (buffer); |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3453 } |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3454 else |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3455 val = build_string ("*"); |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3456 LFACE_FAMILY (lface) = val; |
| 24995 | 3457 } |
| 3458 | |
| 3459 if (force_p || UNSPECIFIEDP (LFACE_HEIGHT (lface))) | |
| 3460 { | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3461 if (have_xlfd_p) |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3462 pt = xlfd_point_size (f, &font); |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3463 else |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3464 pt = pixel_point_size (f, font_info->height * 10); |
| 24995 | 3465 xassert (pt > 0); |
| 3466 LFACE_HEIGHT (lface) = make_number (pt); | |
| 3467 } | |
| 3468 | |
| 3469 if (force_p || UNSPECIFIEDP (LFACE_SWIDTH (lface))) | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3470 LFACE_SWIDTH (lface) |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3471 = have_xlfd_p ? xlfd_symbolic_swidth (&font) : Qnormal; |
| 24995 | 3472 |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3473 if (force_p || UNSPECIFIEDP (LFACE_AVGWIDTH (lface))) |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3474 LFACE_AVGWIDTH (lface) |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3475 = (have_xlfd_p |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3476 ? make_number (font.numeric[XLFD_AVGWIDTH]) |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3477 : Qunspecified); |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3478 |
| 24995 | 3479 if (force_p || UNSPECIFIEDP (LFACE_WEIGHT (lface))) |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3480 LFACE_WEIGHT (lface) |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3481 = have_xlfd_p ? xlfd_symbolic_weight (&font) : Qnormal; |
| 24995 | 3482 |
| 3483 if (force_p || UNSPECIFIEDP (LFACE_SLANT (lface))) | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3484 LFACE_SLANT (lface) |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3485 = have_xlfd_p ? xlfd_symbolic_slant (&font) : Qnormal; |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
3486 |
|
89620
769df37c5ffa
(set_lface_from_font_name): Fix for the case that
Kenichi Handa <handa@m17n.org>
parents:
89554
diff
changeset
|
3487 if (fontset > 0) |
|
89047
3b6234eb229c
(QCfontset): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88939
diff
changeset
|
3488 { |
|
3b6234eb229c
(QCfontset): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88939
diff
changeset
|
3489 LFACE_FONT (lface) = build_string (font_info->full_name); |
|
3b6234eb229c
(QCfontset): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88939
diff
changeset
|
3490 LFACE_FONTSET (lface) = fontset_name (fontset); |
|
3b6234eb229c
(QCfontset): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88939
diff
changeset
|
3491 } |
|
3b6234eb229c
(QCfontset): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88939
diff
changeset
|
3492 else |
|
89838
dd77c0989865
(set_lface_from_font_name): If a font is specified for
Kenichi Handa <handa@m17n.org>
parents:
89835
diff
changeset
|
3493 { |
|
dd77c0989865
(set_lface_from_font_name): If a font is specified for
Kenichi Handa <handa@m17n.org>
parents:
89835
diff
changeset
|
3494 LFACE_FONT (lface) = fontname; |
|
dd77c0989865
(set_lface_from_font_name): If a font is specified for
Kenichi Handa <handa@m17n.org>
parents:
89835
diff
changeset
|
3495 fontset |
|
dd77c0989865
(set_lface_from_font_name): If a font is specified for
Kenichi Handa <handa@m17n.org>
parents:
89835
diff
changeset
|
3496 = new_fontset_from_font_name (build_string (font_info->full_name)); |
|
dd77c0989865
(set_lface_from_font_name): If a font is specified for
Kenichi Handa <handa@m17n.org>
parents:
89835
diff
changeset
|
3497 LFACE_FONTSET (lface) = fontset_name (fontset); |
|
dd77c0989865
(set_lface_from_font_name): If a font is specified for
Kenichi Handa <handa@m17n.org>
parents:
89835
diff
changeset
|
3498 } |
| 24995 | 3499 return 1; |
| 3500 } | |
|
31570
9eeff4863080
Remove conditional compilation on SCALABLE_FONTS.
Gerd Moellmann <gerd@gnu.org>
parents:
31522
diff
changeset
|
3501 |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
3502 #endif /* HAVE_WINDOW_SYSTEM */ |
| 24995 | 3503 |
| 3504 | |
| 31178 | 3505 /* Merges the face height FROM with the face height TO, and returns the |
| 3506 merged height. If FROM is an invalid height, then INVALID is | |
|
40398
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
3507 returned instead. FROM and TO may be either absolute face heights or |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
3508 `relative' heights; the returned value is always an absolute height |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
3509 unless both FROM and TO are relative. GCPRO is a lisp value that |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
3510 will be protected from garbage-collection if this function makes a |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
3511 call into lisp. */ |
| 31178 | 3512 |
| 3513 Lisp_Object | |
|
57997
7a44d300ed6f
(merge_named_face): GCPRO the face_name in the
Richard M. Stallman <rms@gnu.org>
parents:
57107
diff
changeset
|
3514 merge_face_heights (from, to, invalid) |
|
7a44d300ed6f
(merge_named_face): GCPRO the face_name in the
Richard M. Stallman <rms@gnu.org>
parents:
57107
diff
changeset
|
3515 Lisp_Object from, to, invalid; |
| 31178 | 3516 { |
|
40398
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
3517 Lisp_Object result = invalid; |
| 31178 | 3518 |
| 3519 if (INTEGERP (from)) | |
|
40398
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
3520 /* FROM is absolute, just use it as is. */ |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
3521 result = from; |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
3522 else if (FLOATP (from)) |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
3523 /* FROM is a scale, use it to adjust TO. */ |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
3524 { |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
3525 if (INTEGERP (to)) |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
3526 /* relative X absolute => absolute */ |
|
41518
ee7c1fe5feaf
(merge_face_heights): Coerce back to int explicitly.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41129
diff
changeset
|
3527 result = make_number ((EMACS_INT)(XFLOAT_DATA (from) * XINT (to))); |
|
40398
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
3528 else if (FLOATP (to)) |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
3529 /* relative X relative => relative */ |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
3530 result = make_float (XFLOAT_DATA (from) * XFLOAT_DATA (to)); |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3531 else if (UNSPECIFIEDP (to)) |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3532 result = from; |
|
40398
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
3533 } |
| 31178 | 3534 else if (FUNCTIONP (from)) |
|
40398
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
3535 /* FROM is a function, which use to adjust TO. */ |
| 31178 | 3536 { |
| 3537 /* Call function with current height as argument. | |
| 3538 From is the new height. */ | |
|
40398
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
3539 Lisp_Object args[2]; |
| 31178 | 3540 |
| 3541 args[0] = from; | |
| 3542 args[1] = to; | |
|
40398
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
3543 result = safe_call (2, args); |
| 31178 | 3544 |
|
40398
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
3545 /* Ensure that if TO was absolute, so is the result. */ |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
3546 if (INTEGERP (to) && !INTEGERP (result)) |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
3547 result = invalid; |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
3548 } |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
3549 |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
3550 return result; |
| 31178 | 3551 } |
| 3552 | |
| 3553 | |
| 3554 /* Merge two Lisp face attribute vectors on frame F, FROM and TO, and | |
|
31259
2be1770112c1
(default_face_vector): New function.
Miles Bader <miles@gnu.org>
parents:
31221
diff
changeset
|
3555 store the resulting attributes in TO, which must be already be |
|
2be1770112c1
(default_face_vector): New function.
Miles Bader <miles@gnu.org>
parents:
31221
diff
changeset
|
3556 completely specified and contain only absolute attributes. Every |
|
2be1770112c1
(default_face_vector): New function.
Miles Bader <miles@gnu.org>
parents:
31221
diff
changeset
|
3557 specified attribute of FROM overrides the corresponding attribute of |
|
2be1770112c1
(default_face_vector): New function.
Miles Bader <miles@gnu.org>
parents:
31221
diff
changeset
|
3558 TO; relative attributes in FROM are merged with the absolute value in |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3559 TO and replace it. NAMED_MERGE_POINTS is used internally to detect |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3560 loops in face inheritance; it should be 0 when called from other |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3561 places. */ |
| 24995 | 3562 |
| 3563 static INLINE void | |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3564 merge_face_vectors (f, from, to, named_merge_points) |
| 31178 | 3565 struct frame *f; |
| 24995 | 3566 Lisp_Object *from, *to; |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3567 struct named_merge_point *named_merge_points; |
| 24995 | 3568 { |
| 3569 int i; | |
| 31178 | 3570 |
| 3571 /* If FROM inherits from some other faces, merge their attributes into | |
| 3572 TO before merging FROM's direct attributes. Note that an :inherit | |
| 3573 attribute of `unspecified' is the same as one of nil; we never | |
| 3574 merge :inherit attributes, so nil is more correct, but lots of | |
| 3575 other code uses `unspecified' as a generic value for face attributes. */ | |
| 3576 if (!UNSPECIFIEDP (from[LFACE_INHERIT_INDEX]) | |
| 3577 && !NILP (from[LFACE_INHERIT_INDEX])) | |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3578 merge_face_ref (f, from[LFACE_INHERIT_INDEX], to, 0, named_merge_points); |
| 31178 | 3579 |
| 31221 | 3580 /* If TO specifies a :font attribute, and FROM specifies some |
| 3581 font-related attribute, we need to clear TO's :font attribute | |
| 3582 (because it will be inconsistent with whatever FROM specifies, and | |
| 3583 FROM takes precedence). */ | |
| 3584 if (!NILP (to[LFACE_FONT_INDEX]) | |
| 3585 && (!UNSPECIFIEDP (from[LFACE_FAMILY_INDEX]) | |
| 3586 || !UNSPECIFIEDP (from[LFACE_HEIGHT_INDEX]) | |
| 3587 || !UNSPECIFIEDP (from[LFACE_WEIGHT_INDEX]) | |
| 3588 || !UNSPECIFIEDP (from[LFACE_SLANT_INDEX]) | |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3589 || !UNSPECIFIEDP (from[LFACE_SWIDTH_INDEX]) |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3590 || !UNSPECIFIEDP (from[LFACE_AVGWIDTH_INDEX]))) |
| 31221 | 3591 to[LFACE_FONT_INDEX] = Qnil; |
| 3592 | |
| 24995 | 3593 for (i = 1; i < LFACE_VECTOR_SIZE; ++i) |
| 3594 if (!UNSPECIFIEDP (from[i])) | |
|
40838
bf08eafda9a3
(merge_face_vectors): Use braces to follow GNU Coding Standards.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
3595 { |
|
bf08eafda9a3
(merge_face_vectors): Use braces to follow GNU Coding Standards.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
3596 if (i == LFACE_HEIGHT_INDEX && !INTEGERP (from[i])) |
|
57997
7a44d300ed6f
(merge_named_face): GCPRO the face_name in the
Richard M. Stallman <rms@gnu.org>
parents:
57107
diff
changeset
|
3597 to[i] = merge_face_heights (from[i], to[i], to[i]); |
|
40838
bf08eafda9a3
(merge_face_vectors): Use braces to follow GNU Coding Standards.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
3598 else |
|
bf08eafda9a3
(merge_face_vectors): Use braces to follow GNU Coding Standards.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
3599 to[i] = from[i]; |
|
bf08eafda9a3
(merge_face_vectors): Use braces to follow GNU Coding Standards.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
3600 } |
| 31178 | 3601 |
| 3602 /* TO is always an absolute face, which should inherit from nothing. | |
| 3603 We blindly copy the :inherit attribute above and fix it up here. */ | |
| 3604 to[LFACE_INHERIT_INDEX] = Qnil; | |
| 3605 } | |
| 3606 | |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3607 /* Merge the named face FACE_NAME on frame F, into the vector of face |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3608 attributes TO. NAMED_MERGE_POINTS is used to detect loops in face |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3609 inheritance. Returns true if FACE_NAME is a valid face name and |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3610 merging succeeded. */ |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3611 |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3612 static int |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3613 merge_named_face (f, face_name, to, named_merge_points) |
| 31178 | 3614 struct frame *f; |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3615 Lisp_Object face_name; |
| 31178 | 3616 Lisp_Object *to; |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3617 struct named_merge_point *named_merge_points; |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3618 { |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3619 struct named_merge_point named_merge_point; |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3620 |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3621 if (push_named_merge_point (&named_merge_point, |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3622 face_name, &named_merge_points)) |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3623 { |
|
57997
7a44d300ed6f
(merge_named_face): GCPRO the face_name in the
Richard M. Stallman <rms@gnu.org>
parents:
57107
diff
changeset
|
3624 struct gcpro gcpro1; |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3625 Lisp_Object from[LFACE_VECTOR_SIZE]; |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3626 int ok = get_lface_attributes (f, face_name, from, 0); |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3627 |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3628 if (ok) |
|
57997
7a44d300ed6f
(merge_named_face): GCPRO the face_name in the
Richard M. Stallman <rms@gnu.org>
parents:
57107
diff
changeset
|
3629 { |
|
7a44d300ed6f
(merge_named_face): GCPRO the face_name in the
Richard M. Stallman <rms@gnu.org>
parents:
57107
diff
changeset
|
3630 GCPRO1 (named_merge_point.face_name); |
|
7a44d300ed6f
(merge_named_face): GCPRO the face_name in the
Richard M. Stallman <rms@gnu.org>
parents:
57107
diff
changeset
|
3631 merge_face_vectors (f, from, to, named_merge_points); |
|
7a44d300ed6f
(merge_named_face): GCPRO the face_name in the
Richard M. Stallman <rms@gnu.org>
parents:
57107
diff
changeset
|
3632 UNGCPRO; |
|
7a44d300ed6f
(merge_named_face): GCPRO the face_name in the
Richard M. Stallman <rms@gnu.org>
parents:
57107
diff
changeset
|
3633 } |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3634 |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3635 return ok; |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3636 } |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3637 else |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3638 return 0; |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3639 } |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3640 |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3641 |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3642 /* Merge face attributes from the lisp `face reference' FACE_REF on |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3643 frame F into the face attribute vector TO. If ERR_MSGS is non-zero, |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3644 problems with FACE_REF cause an error message to be shown. Return |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3645 non-zero if no errors occurred (regardless of the value of ERR_MSGS). |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3646 NAMED_MERGE_POINTS is used to detect loops in face inheritance or |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3647 list structure; it may be 0 for most callers. |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3648 |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3649 FACE_REF may be a single face specification or a list of such |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3650 specifications. Each face specification can be: |
| 24995 | 3651 |
| 3652 1. A symbol or string naming a Lisp face. | |
| 3653 | |
| 3654 2. A property list of the form (KEYWORD VALUE ...) where each | |
| 3655 KEYWORD is a face attribute name, and value is an appropriate value | |
| 3656 for that attribute. | |
| 3657 | |
| 3658 3. Conses or the form (FOREGROUND-COLOR . COLOR) or | |
| 3659 (BACKGROUND-COLOR . COLOR) where COLOR is a color name. This is | |
| 3660 for compatibility with 20.2. | |
| 3661 | |
| 3662 Face specifications earlier in lists take precedence over later | |
| 3663 specifications. */ | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
3664 |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3665 static int |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3666 merge_face_ref (f, face_ref, to, err_msgs, named_merge_points) |
| 24995 | 3667 struct frame *f; |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3668 Lisp_Object face_ref; |
| 24995 | 3669 Lisp_Object *to; |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3670 int err_msgs; |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3671 struct named_merge_point *named_merge_points; |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3672 { |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3673 int ok = 1; /* Succeed without an error? */ |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3674 |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3675 if (CONSP (face_ref)) |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3676 { |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3677 Lisp_Object first = XCAR (face_ref); |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
3678 |
| 24995 | 3679 if (EQ (first, Qforeground_color) |
| 3680 || EQ (first, Qbackground_color)) | |
| 3681 { | |
| 3682 /* One of (FOREGROUND-COLOR . COLOR) or (BACKGROUND-COLOR | |
| 3683 . COLOR). COLOR must be a string. */ | |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3684 Lisp_Object color_name = XCDR (face_ref); |
| 24995 | 3685 Lisp_Object color = first; |
| 3686 | |
| 3687 if (STRINGP (color_name)) | |
| 3688 { | |
| 3689 if (EQ (color, Qforeground_color)) | |
| 3690 to[LFACE_FOREGROUND_INDEX] = color_name; | |
| 3691 else | |
| 3692 to[LFACE_BACKGROUND_INDEX] = color_name; | |
| 3693 } | |
| 3694 else | |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3695 { |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3696 if (err_msgs) |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3697 add_to_log ("Invalid face color", color_name, Qnil); |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3698 ok = 0; |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3699 } |
| 24995 | 3700 } |
| 3701 else if (SYMBOLP (first) | |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
3702 && *SDATA (SYMBOL_NAME (first)) == ':') |
| 24995 | 3703 { |
| 3704 /* Assume this is the property list form. */ | |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3705 while (CONSP (face_ref) && CONSP (XCDR (face_ref))) |
| 24995 | 3706 { |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3707 Lisp_Object keyword = XCAR (face_ref); |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3708 Lisp_Object value = XCAR (XCDR (face_ref)); |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3709 int err = 0; |
| 24995 | 3710 |
|
56694
d5801cbd92f5
(merge_face_ref): Specifying `unspecified' is a no-op.
Richard M. Stallman <rms@gnu.org>
parents:
56518
diff
changeset
|
3711 /* Specifying `unspecified' is a no-op. */ |
|
d5801cbd92f5
(merge_face_ref): Specifying `unspecified' is a no-op.
Richard M. Stallman <rms@gnu.org>
parents:
56518
diff
changeset
|
3712 if (EQ (value, Qunspecified)) |
|
d5801cbd92f5
(merge_face_ref): Specifying `unspecified' is a no-op.
Richard M. Stallman <rms@gnu.org>
parents:
56518
diff
changeset
|
3713 ; |
|
d5801cbd92f5
(merge_face_ref): Specifying `unspecified' is a no-op.
Richard M. Stallman <rms@gnu.org>
parents:
56518
diff
changeset
|
3714 else if (EQ (keyword, QCfamily)) |
| 24995 | 3715 { |
| 3716 if (STRINGP (value)) | |
| 3717 to[LFACE_FAMILY_INDEX] = value; | |
| 3718 else | |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3719 err = 1; |
| 24995 | 3720 } |
| 3721 else if (EQ (keyword, QCheight)) | |
| 3722 { | |
| 31178 | 3723 Lisp_Object new_height = |
|
57997
7a44d300ed6f
(merge_named_face): GCPRO the face_name in the
Richard M. Stallman <rms@gnu.org>
parents:
57107
diff
changeset
|
3724 merge_face_heights (value, to[LFACE_HEIGHT_INDEX], Qnil); |
| 31178 | 3725 |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3726 if (! NILP (new_height)) |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3727 to[LFACE_HEIGHT_INDEX] = new_height; |
| 24995 | 3728 else |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3729 err = 1; |
| 24995 | 3730 } |
| 3731 else if (EQ (keyword, QCweight)) | |
| 3732 { | |
| 3733 if (SYMBOLP (value) | |
| 3734 && face_numeric_weight (value) >= 0) | |
| 3735 to[LFACE_WEIGHT_INDEX] = value; | |
| 3736 else | |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3737 err = 1; |
| 24995 | 3738 } |
| 3739 else if (EQ (keyword, QCslant)) | |
| 3740 { | |
| 3741 if (SYMBOLP (value) | |
| 3742 && face_numeric_slant (value) >= 0) | |
| 3743 to[LFACE_SLANT_INDEX] = value; | |
| 3744 else | |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3745 err = 1; |
| 24995 | 3746 } |
| 3747 else if (EQ (keyword, QCunderline)) | |
| 3748 { | |
| 3749 if (EQ (value, Qt) | |
| 3750 || NILP (value) | |
| 3751 || STRINGP (value)) | |
| 3752 to[LFACE_UNDERLINE_INDEX] = value; | |
| 3753 else | |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3754 err = 1; |
| 24995 | 3755 } |
| 3756 else if (EQ (keyword, QCoverline)) | |
| 3757 { | |
| 3758 if (EQ (value, Qt) | |
| 3759 || NILP (value) | |
| 3760 || STRINGP (value)) | |
| 3761 to[LFACE_OVERLINE_INDEX] = value; | |
| 3762 else | |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3763 err = 1; |
| 24995 | 3764 } |
| 3765 else if (EQ (keyword, QCstrike_through)) | |
| 3766 { | |
| 3767 if (EQ (value, Qt) | |
| 3768 || NILP (value) | |
| 3769 || STRINGP (value)) | |
| 3770 to[LFACE_STRIKE_THROUGH_INDEX] = value; | |
| 3771 else | |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3772 err = 1; |
| 24995 | 3773 } |
| 3774 else if (EQ (keyword, QCbox)) | |
| 3775 { | |
| 3776 if (EQ (value, Qt)) | |
| 3777 value = make_number (1); | |
| 3778 if (INTEGERP (value) | |
| 3779 || STRINGP (value) | |
| 3780 || CONSP (value) | |
| 3781 || NILP (value)) | |
| 3782 to[LFACE_BOX_INDEX] = value; | |
| 3783 else | |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3784 err = 1; |
| 24995 | 3785 } |
| 3786 else if (EQ (keyword, QCinverse_video) | |
| 3787 || EQ (keyword, QCreverse_video)) | |
| 3788 { | |
| 3789 if (EQ (value, Qt) || NILP (value)) | |
| 3790 to[LFACE_INVERSE_INDEX] = value; | |
| 3791 else | |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3792 err = 1; |
| 24995 | 3793 } |
| 3794 else if (EQ (keyword, QCforeground)) | |
| 3795 { | |
| 3796 if (STRINGP (value)) | |
| 3797 to[LFACE_FOREGROUND_INDEX] = value; | |
| 3798 else | |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3799 err = 1; |
| 24995 | 3800 } |
| 3801 else if (EQ (keyword, QCbackground)) | |
| 3802 { | |
| 3803 if (STRINGP (value)) | |
| 3804 to[LFACE_BACKGROUND_INDEX] = value; | |
| 3805 else | |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3806 err = 1; |
| 24995 | 3807 } |
| 3808 else if (EQ (keyword, QCstipple)) | |
| 3809 { | |
| 3810 #ifdef HAVE_X_WINDOWS | |
|
25890
b10a34d40b55
(Qbitmap_spec_p): Replaces Qpixmap_spec_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25883
diff
changeset
|
3811 Lisp_Object pixmap_p = Fbitmap_spec_p (value); |
| 24995 | 3812 if (!NILP (pixmap_p)) |
| 3813 to[LFACE_STIPPLE_INDEX] = value; | |
| 3814 else | |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3815 err = 1; |
| 24995 | 3816 #endif |
| 3817 } | |
| 3818 else if (EQ (keyword, QCwidth)) | |
| 3819 { | |
| 3820 if (SYMBOLP (value) | |
| 3821 && face_numeric_swidth (value) >= 0) | |
| 3822 to[LFACE_SWIDTH_INDEX] = value; | |
| 3823 else | |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3824 err = 1; |
| 24995 | 3825 } |
| 31178 | 3826 else if (EQ (keyword, QCinherit)) |
| 3827 { | |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3828 /* This is not really very useful; it's just like a |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3829 normal face reference. */ |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3830 if (! merge_face_ref (f, value, to, |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3831 err_msgs, named_merge_points)) |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3832 err = 1; |
| 31178 | 3833 } |
| 24995 | 3834 else |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3835 err = 1; |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3836 |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3837 if (err) |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3838 { |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3839 add_to_log ("Invalid face attribute %S %S", keyword, value); |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3840 ok = 0; |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3841 } |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3842 |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3843 face_ref = XCDR (XCDR (face_ref)); |
| 24995 | 3844 } |
| 3845 } | |
| 3846 else | |
| 3847 { | |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3848 /* This is a list of face refs. Those at the beginning of the |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3849 list take precedence over what follows, so we have to merge |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3850 from the end backwards. */ |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3851 Lisp_Object next = XCDR (face_ref); |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3852 |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3853 if (! NILP (next)) |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3854 ok = merge_face_ref (f, next, to, err_msgs, named_merge_points); |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3855 |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3856 if (! merge_face_ref (f, first, to, err_msgs, named_merge_points)) |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3857 ok = 0; |
| 24995 | 3858 } |
| 3859 } | |
| 3860 else | |
| 3861 { | |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3862 /* FACE_REF ought to be a face name. */ |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3863 ok = merge_named_face (f, face_ref, to, named_merge_points); |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3864 if (!ok && err_msgs) |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3865 add_to_log ("Invalid face reference: %s", face_ref, Qnil); |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3866 } |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3867 |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
3868 return ok; |
| 24995 | 3869 } |
| 3870 | |
| 3871 | |
| 3872 DEFUN ("internal-make-lisp-face", Finternal_make_lisp_face, | |
| 3873 Sinternal_make_lisp_face, 1, 2, 0, | |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
3874 doc: /* Make FACE, a symbol, a Lisp face with all attributes nil. |
|
39914
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
3875 If FACE was not known as a face before, create a new one. |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
3876 If optional argument FRAME is specified, make a frame-local face |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
3877 for that frame. Otherwise operate on the global face definition. |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
3878 Value is a vector of face attributes. */) |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
3879 (face, frame) |
| 24995 | 3880 Lisp_Object face, frame; |
| 3881 { | |
| 3882 Lisp_Object global_lface, lface; | |
| 3883 struct frame *f; | |
| 3884 int i; | |
| 3885 | |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
3886 CHECK_SYMBOL (face); |
| 24995 | 3887 global_lface = lface_from_face_name (NULL, face, 0); |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
3888 |
| 24995 | 3889 if (!NILP (frame)) |
| 3890 { | |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
3891 CHECK_LIVE_FRAME (frame); |
| 24995 | 3892 f = XFRAME (frame); |
| 3893 lface = lface_from_face_name (f, face, 0); | |
| 3894 } | |
| 3895 else | |
| 3896 f = NULL, lface = Qnil; | |
| 3897 | |
| 3898 /* Add a global definition if there is none. */ | |
| 3899 if (NILP (global_lface)) | |
| 3900 { | |
| 3901 global_lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE), | |
| 3902 Qunspecified); | |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3903 AREF (global_lface, 0) = Qface; |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
3904 Vface_new_frame_defaults = Fcons (Fcons (face, global_lface), |
| 24995 | 3905 Vface_new_frame_defaults); |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
3906 |
| 24995 | 3907 /* Assign the new Lisp face a unique ID. The mapping from Lisp |
| 3908 face id to Lisp face is given by the vector lface_id_to_name. | |
| 3909 The mapping from Lisp face to Lisp face id is given by the | |
| 3910 property `face' of the Lisp face name. */ | |
| 3911 if (next_lface_id == lface_id_to_name_size) | |
| 3912 { | |
| 3913 int new_size = max (50, 2 * lface_id_to_name_size); | |
| 3914 int sz = new_size * sizeof *lface_id_to_name; | |
| 3915 lface_id_to_name = (Lisp_Object *) xrealloc (lface_id_to_name, sz); | |
| 3916 lface_id_to_name_size = new_size; | |
| 3917 } | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
3918 |
| 24995 | 3919 lface_id_to_name[next_lface_id] = face; |
| 3920 Fput (face, Qface, make_number (next_lface_id)); | |
| 3921 ++next_lface_id; | |
| 3922 } | |
| 3923 else if (f == NULL) | |
| 3924 for (i = 1; i < LFACE_VECTOR_SIZE; ++i) | |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3925 AREF (global_lface, i) = Qunspecified; |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
3926 |
| 24995 | 3927 /* Add a frame-local definition. */ |
| 3928 if (f) | |
| 3929 { | |
| 3930 if (NILP (lface)) | |
| 3931 { | |
| 3932 lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE), | |
| 3933 Qunspecified); | |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3934 AREF (lface, 0) = Qface; |
| 24995 | 3935 f->face_alist = Fcons (Fcons (face, lface), f->face_alist); |
| 3936 } | |
| 3937 else | |
| 3938 for (i = 1; i < LFACE_VECTOR_SIZE; ++i) | |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
3939 AREF (lface, i) = Qunspecified; |
| 24995 | 3940 } |
| 3941 else | |
| 3942 lface = global_lface; | |
| 3943 | |
|
43270
935816913346
(Finternal_make_lisp_face, Finternal_copy_lisp_face)
Richard M. Stallman <rms@gnu.org>
parents:
43203
diff
changeset
|
3944 /* Changing a named face means that all realized faces depending on |
|
935816913346
(Finternal_make_lisp_face, Finternal_copy_lisp_face)
Richard M. Stallman <rms@gnu.org>
parents:
43203
diff
changeset
|
3945 that face are invalid. Since we cannot tell which realized faces |
|
935816913346
(Finternal_make_lisp_face, Finternal_copy_lisp_face)
Richard M. Stallman <rms@gnu.org>
parents:
43203
diff
changeset
|
3946 depend on the face, make sure they are all removed. This is done |
|
935816913346
(Finternal_make_lisp_face, Finternal_copy_lisp_face)
Richard M. Stallman <rms@gnu.org>
parents:
43203
diff
changeset
|
3947 by incrementing face_change_count. The next call to |
|
935816913346
(Finternal_make_lisp_face, Finternal_copy_lisp_face)
Richard M. Stallman <rms@gnu.org>
parents:
43203
diff
changeset
|
3948 init_iterator will then free realized faces. */ |
| 57107 | 3949 if (NILP (Fget (face, Qface_no_inherit))) |
| 3950 { | |
| 3951 ++face_change_count; | |
| 3952 ++windows_or_buffers_changed; | |
| 3953 } | |
|
43270
935816913346
(Finternal_make_lisp_face, Finternal_copy_lisp_face)
Richard M. Stallman <rms@gnu.org>
parents:
43203
diff
changeset
|
3954 |
| 24995 | 3955 xassert (LFACEP (lface)); |
| 3956 check_lface (lface); | |
| 3957 return lface; | |
| 3958 } | |
| 3959 | |
| 3960 | |
| 3961 DEFUN ("internal-lisp-face-p", Finternal_lisp_face_p, | |
| 3962 Sinternal_lisp_face_p, 1, 2, 0, | |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
3963 doc: /* Return non-nil if FACE names a face. |
|
39914
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
3964 If optional second parameter FRAME is non-nil, check for the |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
3965 existence of a frame-local face with name FACE on that frame. |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
3966 Otherwise check for the existence of a global face. */) |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
3967 (face, frame) |
| 24995 | 3968 Lisp_Object face, frame; |
| 3969 { | |
| 3970 Lisp_Object lface; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
3971 |
| 24995 | 3972 if (!NILP (frame)) |
| 3973 { | |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
3974 CHECK_LIVE_FRAME (frame); |
| 24995 | 3975 lface = lface_from_face_name (XFRAME (frame), face, 0); |
| 3976 } | |
| 3977 else | |
| 3978 lface = lface_from_face_name (NULL, face, 0); | |
| 3979 | |
| 3980 return lface; | |
| 3981 } | |
| 3982 | |
| 3983 | |
| 3984 DEFUN ("internal-copy-lisp-face", Finternal_copy_lisp_face, | |
| 3985 Sinternal_copy_lisp_face, 4, 4, 0, | |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
3986 doc: /* Copy face FROM to TO. |
|
56176
21c659556daa
(Finternal_copy_lisp_face): Small cleanup; doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
56063
diff
changeset
|
3987 If FRAME is t, copy the global face definition of FROM. |
|
21c659556daa
(Finternal_copy_lisp_face): Small cleanup; doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
56063
diff
changeset
|
3988 Otherwise, copy the frame-local definition of FROM on FRAME. |
|
21c659556daa
(Finternal_copy_lisp_face): Small cleanup; doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
56063
diff
changeset
|
3989 If NEW-FRAME is a frame, copy that data into the frame-local |
|
21c659556daa
(Finternal_copy_lisp_face): Small cleanup; doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
56063
diff
changeset
|
3990 definition of TO on NEW-FRAME. If NEW-FRAME is nil. |
|
21c659556daa
(Finternal_copy_lisp_face): Small cleanup; doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
56063
diff
changeset
|
3991 FRAME controls where the data is copied to. |
|
21c659556daa
(Finternal_copy_lisp_face): Small cleanup; doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
56063
diff
changeset
|
3992 |
|
21c659556daa
(Finternal_copy_lisp_face): Small cleanup; doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
56063
diff
changeset
|
3993 The value is TO. */) |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
3994 (from, to, frame, new_frame) |
| 24995 | 3995 Lisp_Object from, to, frame, new_frame; |
| 3996 { | |
| 3997 Lisp_Object lface, copy; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
3998 |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
3999 CHECK_SYMBOL (from); |
|
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
4000 CHECK_SYMBOL (to); |
| 24995 | 4001 |
| 4002 if (EQ (frame, Qt)) | |
| 4003 { | |
| 4004 /* Copy global definition of FROM. We don't make copies of | |
| 4005 strings etc. because 20.2 didn't do it either. */ | |
| 4006 lface = lface_from_face_name (NULL, from, 1); | |
| 4007 copy = Finternal_make_lisp_face (to, Qnil); | |
| 4008 } | |
| 4009 else | |
| 4010 { | |
| 4011 /* Copy frame-local definition of FROM. */ | |
|
56176
21c659556daa
(Finternal_copy_lisp_face): Small cleanup; doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
56063
diff
changeset
|
4012 if (NILP (new_frame)) |
|
21c659556daa
(Finternal_copy_lisp_face): Small cleanup; doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
56063
diff
changeset
|
4013 new_frame = frame; |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
4014 CHECK_LIVE_FRAME (frame); |
|
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
4015 CHECK_LIVE_FRAME (new_frame); |
| 24995 | 4016 lface = lface_from_face_name (XFRAME (frame), from, 1); |
| 4017 copy = Finternal_make_lisp_face (to, new_frame); | |
| 4018 } | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
4019 |
| 24995 | 4020 bcopy (XVECTOR (lface)->contents, XVECTOR (copy)->contents, |
| 4021 LFACE_VECTOR_SIZE * sizeof (Lisp_Object)); | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
4022 |
|
43270
935816913346
(Finternal_make_lisp_face, Finternal_copy_lisp_face)
Richard M. Stallman <rms@gnu.org>
parents:
43203
diff
changeset
|
4023 /* Changing a named face means that all realized faces depending on |
|
935816913346
(Finternal_make_lisp_face, Finternal_copy_lisp_face)
Richard M. Stallman <rms@gnu.org>
parents:
43203
diff
changeset
|
4024 that face are invalid. Since we cannot tell which realized faces |
|
935816913346
(Finternal_make_lisp_face, Finternal_copy_lisp_face)
Richard M. Stallman <rms@gnu.org>
parents:
43203
diff
changeset
|
4025 depend on the face, make sure they are all removed. This is done |
|
935816913346
(Finternal_make_lisp_face, Finternal_copy_lisp_face)
Richard M. Stallman <rms@gnu.org>
parents:
43203
diff
changeset
|
4026 by incrementing face_change_count. The next call to |
|
935816913346
(Finternal_make_lisp_face, Finternal_copy_lisp_face)
Richard M. Stallman <rms@gnu.org>
parents:
43203
diff
changeset
|
4027 init_iterator will then free realized faces. */ |
| 57107 | 4028 if (NILP (Fget (to, Qface_no_inherit))) |
| 4029 { | |
| 4030 ++face_change_count; | |
| 4031 ++windows_or_buffers_changed; | |
| 4032 } | |
|
43270
935816913346
(Finternal_make_lisp_face, Finternal_copy_lisp_face)
Richard M. Stallman <rms@gnu.org>
parents:
43203
diff
changeset
|
4033 |
| 24995 | 4034 return to; |
| 4035 } | |
| 4036 | |
| 4037 | |
| 4038 DEFUN ("internal-set-lisp-face-attribute", Finternal_set_lisp_face_attribute, | |
| 4039 Sinternal_set_lisp_face_attribute, 3, 4, 0, | |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
4040 doc: /* Set attribute ATTR of FACE to VALUE. |
|
39914
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
4041 FRAME being a frame means change the face on that frame. |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
4042 FRAME nil means change the face of the selected frame. |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
4043 FRAME t means change the default for new frames. |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
4044 FRAME 0 means change the face on all frames, and change the default |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
4045 for new frames. */) |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
4046 (face, attr, value, frame) |
| 24995 | 4047 Lisp_Object face, attr, value, frame; |
|
6784
d41c216ccd27
(frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents:
6768
diff
changeset
|
4048 { |
| 24995 | 4049 Lisp_Object lface; |
| 4050 Lisp_Object old_value = Qnil; | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
4051 /* Set 1 if ATTR is QCfont. */ |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
4052 int font_attr_p = 0; |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
4053 /* Set 1 if ATTR is one of font-related attributes other than QCfont. */ |
| 24995 | 4054 int font_related_attr_p = 0; |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
4055 |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
4056 CHECK_SYMBOL (face); |
|
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
4057 CHECK_SYMBOL (attr); |
| 24995 | 4058 |
|
25883
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
4059 face = resolve_face_name (face); |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
4060 |
|
31440
67f5b4186ed2
(Finternal_set_lisp_face_attribute): If FRAME is 0,
Gerd Moellmann <gerd@gnu.org>
parents:
31292
diff
changeset
|
4061 /* If FRAME is 0, change face on all frames, and change the |
|
67f5b4186ed2
(Finternal_set_lisp_face_attribute): If FRAME is 0,
Gerd Moellmann <gerd@gnu.org>
parents:
31292
diff
changeset
|
4062 default for new frames. */ |
|
67f5b4186ed2
(Finternal_set_lisp_face_attribute): If FRAME is 0,
Gerd Moellmann <gerd@gnu.org>
parents:
31292
diff
changeset
|
4063 if (INTEGERP (frame) && XINT (frame) == 0) |
|
67f5b4186ed2
(Finternal_set_lisp_face_attribute): If FRAME is 0,
Gerd Moellmann <gerd@gnu.org>
parents:
31292
diff
changeset
|
4064 { |
|
67f5b4186ed2
(Finternal_set_lisp_face_attribute): If FRAME is 0,
Gerd Moellmann <gerd@gnu.org>
parents:
31292
diff
changeset
|
4065 Lisp_Object tail; |
|
31570
9eeff4863080
Remove conditional compilation on SCALABLE_FONTS.
Gerd Moellmann <gerd@gnu.org>
parents:
31522
diff
changeset
|
4066 Finternal_set_lisp_face_attribute (face, attr, value, Qt); |
|
31440
67f5b4186ed2
(Finternal_set_lisp_face_attribute): If FRAME is 0,
Gerd Moellmann <gerd@gnu.org>
parents:
31292
diff
changeset
|
4067 FOR_EACH_FRAME (tail, frame) |
|
67f5b4186ed2
(Finternal_set_lisp_face_attribute): If FRAME is 0,
Gerd Moellmann <gerd@gnu.org>
parents:
31292
diff
changeset
|
4068 Finternal_set_lisp_face_attribute (face, attr, value, frame); |
|
31570
9eeff4863080
Remove conditional compilation on SCALABLE_FONTS.
Gerd Moellmann <gerd@gnu.org>
parents:
31522
diff
changeset
|
4069 return face; |
|
31440
67f5b4186ed2
(Finternal_set_lisp_face_attribute): If FRAME is 0,
Gerd Moellmann <gerd@gnu.org>
parents:
31292
diff
changeset
|
4070 } |
|
67f5b4186ed2
(Finternal_set_lisp_face_attribute): If FRAME is 0,
Gerd Moellmann <gerd@gnu.org>
parents:
31292
diff
changeset
|
4071 |
| 24995 | 4072 /* Set lface to the Lisp attribute vector of FACE. */ |
| 4073 if (EQ (frame, Qt)) | |
| 4074 lface = lface_from_face_name (NULL, face, 1); | |
| 4075 else | |
| 4076 { | |
| 4077 if (NILP (frame)) | |
|
25678
1878f7ae0df5
(frame_or_selected_frame): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25661
diff
changeset
|
4078 frame = selected_frame; |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
4079 |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
4080 CHECK_LIVE_FRAME (frame); |
| 24995 | 4081 lface = lface_from_face_name (XFRAME (frame), face, 0); |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
4082 |
| 24995 | 4083 /* If a frame-local face doesn't exist yet, create one. */ |
| 4084 if (NILP (lface)) | |
| 4085 lface = Finternal_make_lisp_face (face, frame); | |
| 4086 } | |
| 4087 | |
| 4088 if (EQ (attr, QCfamily)) | |
| 4089 { | |
| 4090 if (!UNSPECIFIEDP (value)) | |
| 4091 { | |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
4092 CHECK_STRING (value); |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
4093 if (SCHARS (value) == 0) |
| 24995 | 4094 signal_error ("Invalid face family", value); |
| 4095 } | |
| 4096 old_value = LFACE_FAMILY (lface); | |
| 4097 LFACE_FAMILY (lface) = value; | |
| 4098 font_related_attr_p = 1; | |
| 4099 } | |
| 4100 else if (EQ (attr, QCheight)) | |
| 4101 { | |
| 4102 if (!UNSPECIFIEDP (value)) | |
| 4103 { | |
|
40023
3914e6d2452f
(Finternal_set_lisp_face_attribute): Follow coding conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
39988
diff
changeset
|
4104 Lisp_Object test; |
|
3914e6d2452f
(Finternal_set_lisp_face_attribute): Follow coding conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
39988
diff
changeset
|
4105 |
|
3914e6d2452f
(Finternal_set_lisp_face_attribute): Follow coding conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
39988
diff
changeset
|
4106 test = (EQ (face, Qdefault) |
|
3914e6d2452f
(Finternal_set_lisp_face_attribute): Follow coding conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
39988
diff
changeset
|
4107 ? value |
|
3914e6d2452f
(Finternal_set_lisp_face_attribute): Follow coding conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
39988
diff
changeset
|
4108 /* The default face must have an absolute size, |
|
3914e6d2452f
(Finternal_set_lisp_face_attribute): Follow coding conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
39988
diff
changeset
|
4109 otherwise, we do a test merge with a random |
|
3914e6d2452f
(Finternal_set_lisp_face_attribute): Follow coding conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
39988
diff
changeset
|
4110 height to see if VALUE's ok. */ |
|
57997
7a44d300ed6f
(merge_named_face): GCPRO the face_name in the
Richard M. Stallman <rms@gnu.org>
parents:
57107
diff
changeset
|
4111 : merge_face_heights (value, make_number (10), Qnil)); |
|
40023
3914e6d2452f
(Finternal_set_lisp_face_attribute): Follow coding conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
39988
diff
changeset
|
4112 |
|
3914e6d2452f
(Finternal_set_lisp_face_attribute): Follow coding conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
39988
diff
changeset
|
4113 if (!INTEGERP (test) || XINT (test) <= 0) |
| 24995 | 4114 signal_error ("Invalid face height", value); |
| 4115 } | |
| 31178 | 4116 |
| 24995 | 4117 old_value = LFACE_HEIGHT (lface); |
| 4118 LFACE_HEIGHT (lface) = value; | |
| 4119 font_related_attr_p = 1; | |
| 4120 } | |
| 4121 else if (EQ (attr, QCweight)) | |
| 4122 { | |
| 4123 if (!UNSPECIFIEDP (value)) | |
| 4124 { | |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
4125 CHECK_SYMBOL (value); |
| 24995 | 4126 if (face_numeric_weight (value) < 0) |
| 4127 signal_error ("Invalid face weight", value); | |
| 4128 } | |
| 4129 old_value = LFACE_WEIGHT (lface); | |
| 4130 LFACE_WEIGHT (lface) = value; | |
| 4131 font_related_attr_p = 1; | |
| 4132 } | |
| 4133 else if (EQ (attr, QCslant)) | |
| 4134 { | |
| 4135 if (!UNSPECIFIEDP (value)) | |
| 4136 { | |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
4137 CHECK_SYMBOL (value); |
| 24995 | 4138 if (face_numeric_slant (value) < 0) |
| 4139 signal_error ("Invalid face slant", value); | |
| 4140 } | |
| 4141 old_value = LFACE_SLANT (lface); | |
| 4142 LFACE_SLANT (lface) = value; | |
| 4143 font_related_attr_p = 1; | |
| 4144 } | |
| 4145 else if (EQ (attr, QCunderline)) | |
| 4146 { | |
| 4147 if (!UNSPECIFIEDP (value)) | |
| 4148 if ((SYMBOLP (value) | |
| 4149 && !EQ (value, Qt) | |
| 4150 && !EQ (value, Qnil)) | |
| 4151 /* Underline color. */ | |
| 4152 || (STRINGP (value) | |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
4153 && SCHARS (value) == 0)) |
| 24995 | 4154 signal_error ("Invalid face underline", value); |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
4155 |
| 24995 | 4156 old_value = LFACE_UNDERLINE (lface); |
| 4157 LFACE_UNDERLINE (lface) = value; | |
| 4158 } | |
| 4159 else if (EQ (attr, QCoverline)) | |
| 4160 { | |
| 4161 if (!UNSPECIFIEDP (value)) | |
| 4162 if ((SYMBOLP (value) | |
| 4163 && !EQ (value, Qt) | |
| 4164 && !EQ (value, Qnil)) | |
| 4165 /* Overline color. */ | |
| 4166 || (STRINGP (value) | |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
4167 && SCHARS (value) == 0)) |
| 24995 | 4168 signal_error ("Invalid face overline", value); |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
4169 |
| 24995 | 4170 old_value = LFACE_OVERLINE (lface); |
| 4171 LFACE_OVERLINE (lface) = value; | |
| 4172 } | |
| 4173 else if (EQ (attr, QCstrike_through)) | |
| 4174 { | |
| 4175 if (!UNSPECIFIEDP (value)) | |
| 4176 if ((SYMBOLP (value) | |
| 4177 && !EQ (value, Qt) | |
| 4178 && !EQ (value, Qnil)) | |
| 4179 /* Strike-through color. */ | |
| 4180 || (STRINGP (value) | |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
4181 && SCHARS (value) == 0)) |
| 24995 | 4182 signal_error ("Invalid face strike-through", value); |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
4183 |
| 24995 | 4184 old_value = LFACE_STRIKE_THROUGH (lface); |
| 4185 LFACE_STRIKE_THROUGH (lface) = value; | |
| 4186 } | |
| 4187 else if (EQ (attr, QCbox)) | |
| 4188 { | |
| 4189 int valid_p; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
4190 |
| 24995 | 4191 /* Allow t meaning a simple box of width 1 in foreground color |
| 4192 of the face. */ | |
| 4193 if (EQ (value, Qt)) | |
| 4194 value = make_number (1); | |
| 4195 | |
| 4196 if (UNSPECIFIEDP (value)) | |
| 4197 valid_p = 1; | |
| 4198 else if (NILP (value)) | |
| 4199 valid_p = 1; | |
| 4200 else if (INTEGERP (value)) | |
|
36006
a9d75e8a6cb9
(Finternal_set_lisp_face_attribute): The value of :box
Kenichi Handa <handa@m17n.org>
parents:
35913
diff
changeset
|
4201 valid_p = XINT (value) != 0; |
| 24995 | 4202 else if (STRINGP (value)) |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
4203 valid_p = SCHARS (value) > 0; |
| 24995 | 4204 else if (CONSP (value)) |
| 4205 { | |
| 4206 Lisp_Object tem; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
4207 |
| 24995 | 4208 tem = value; |
| 4209 while (CONSP (tem)) | |
| 4210 { | |
| 4211 Lisp_Object k, v; | |
| 4212 | |
| 4213 k = XCAR (tem); | |
| 4214 tem = XCDR (tem); | |
| 4215 if (!CONSP (tem)) | |
| 4216 break; | |
| 4217 v = XCAR (tem); | |
| 4218 tem = XCDR (tem); | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
4219 |
| 24995 | 4220 if (EQ (k, QCline_width)) |
| 4221 { | |
|
36006
a9d75e8a6cb9
(Finternal_set_lisp_face_attribute): The value of :box
Kenichi Handa <handa@m17n.org>
parents:
35913
diff
changeset
|
4222 if (!INTEGERP (v) || XINT (v) == 0) |
| 24995 | 4223 break; |
| 4224 } | |
| 4225 else if (EQ (k, QCcolor)) | |
| 4226 { | |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
4227 if (!STRINGP (v) || SCHARS (v) == 0) |
| 24995 | 4228 break; |
| 4229 } | |
| 4230 else if (EQ (k, QCstyle)) | |
| 4231 { | |
| 4232 if (!EQ (v, Qpressed_button) && !EQ (v, Qreleased_button)) | |
| 4233 break; | |
| 4234 } | |
| 4235 else | |
| 4236 break; | |
| 4237 } | |
| 4238 | |
| 4239 valid_p = NILP (tem); | |
| 4240 } | |
| 4241 else | |
| 4242 valid_p = 0; | |
| 4243 | |
| 4244 if (!valid_p) | |
| 4245 signal_error ("Invalid face box", value); | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
4246 |
| 24995 | 4247 old_value = LFACE_BOX (lface); |
| 4248 LFACE_BOX (lface) = value; | |
| 4249 } | |
| 4250 else if (EQ (attr, QCinverse_video) | |
| 4251 || EQ (attr, QCreverse_video)) | |
| 4252 { | |
| 4253 if (!UNSPECIFIEDP (value)) | |
| 4254 { | |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
4255 CHECK_SYMBOL (value); |
| 24995 | 4256 if (!EQ (value, Qt) && !NILP (value)) |
| 4257 signal_error ("Invalid inverse-video face attribute value", value); | |
| 4258 } | |
| 4259 old_value = LFACE_INVERSE (lface); | |
| 4260 LFACE_INVERSE (lface) = value; | |
| 4261 } | |
| 4262 else if (EQ (attr, QCforeground)) | |
| 4263 { | |
|
27114
4efa5e54e9a9
(Qunspecified_fg, Qunspecified_bg): Remove.
Eli Zaretskii <eliz@gnu.org>
parents:
27100
diff
changeset
|
4264 if (!UNSPECIFIEDP (value)) |
| 24995 | 4265 { |
| 4266 /* Don't check for valid color names here because it depends | |
| 4267 on the frame (display) whether the color will be valid | |
| 4268 when the face is realized. */ | |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
4269 CHECK_STRING (value); |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
4270 if (SCHARS (value) == 0) |
| 24995 | 4271 signal_error ("Empty foreground color value", value); |
| 4272 } | |
| 4273 old_value = LFACE_FOREGROUND (lface); | |
| 4274 LFACE_FOREGROUND (lface) = value; | |
| 4275 } | |
| 4276 else if (EQ (attr, QCbackground)) | |
| 4277 { | |
|
27114
4efa5e54e9a9
(Qunspecified_fg, Qunspecified_bg): Remove.
Eli Zaretskii <eliz@gnu.org>
parents:
27100
diff
changeset
|
4278 if (!UNSPECIFIEDP (value)) |
| 24995 | 4279 { |
| 4280 /* Don't check for valid color names here because it depends | |
| 4281 on the frame (display) whether the color will be valid | |
| 4282 when the face is realized. */ | |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
4283 CHECK_STRING (value); |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
4284 if (SCHARS (value) == 0) |
| 24995 | 4285 signal_error ("Empty background color value", value); |
| 4286 } | |
| 4287 old_value = LFACE_BACKGROUND (lface); | |
| 4288 LFACE_BACKGROUND (lface) = value; | |
| 4289 } | |
| 4290 else if (EQ (attr, QCstipple)) | |
| 4291 { | |
| 4292 #ifdef HAVE_X_WINDOWS | |
| 4293 if (!UNSPECIFIEDP (value) | |
| 4294 && !NILP (value) | |
|
25890
b10a34d40b55
(Qbitmap_spec_p): Replaces Qpixmap_spec_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25883
diff
changeset
|
4295 && NILP (Fbitmap_spec_p (value))) |
| 24995 | 4296 signal_error ("Invalid stipple attribute", value); |
| 4297 old_value = LFACE_STIPPLE (lface); | |
| 4298 LFACE_STIPPLE (lface) = value; | |
| 4299 #endif /* HAVE_X_WINDOWS */ | |
| 4300 } | |
| 4301 else if (EQ (attr, QCwidth)) | |
| 4302 { | |
| 4303 if (!UNSPECIFIEDP (value)) | |
| 4304 { | |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
4305 CHECK_SYMBOL (value); |
| 24995 | 4306 if (face_numeric_swidth (value) < 0) |
| 4307 signal_error ("Invalid face width", value); | |
| 4308 } | |
| 4309 old_value = LFACE_SWIDTH (lface); | |
| 4310 LFACE_SWIDTH (lface) = value; | |
| 4311 font_related_attr_p = 1; | |
| 4312 } | |
|
89047
3b6234eb229c
(QCfontset): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88939
diff
changeset
|
4313 else if (EQ (attr, QCfont) || EQ (attr, QCfontset)) |
| 24995 | 4314 { |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
4315 #ifdef HAVE_WINDOW_SYSTEM |
|
44705
413dd322c77d
(clear_font_table): Don't free the default font of
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43270
diff
changeset
|
4316 if (EQ (frame, Qt) || FRAME_WINDOW_P (XFRAME (frame))) |
|
40224
12dcadf8cb59
(Finternal_set_lisp_face_attribute)
Eli Zaretskii <eliz@gnu.org>
parents:
40023
diff
changeset
|
4317 { |
|
12dcadf8cb59
(Finternal_set_lisp_face_attribute)
Eli Zaretskii <eliz@gnu.org>
parents:
40023
diff
changeset
|
4318 /* Set font-related attributes of the Lisp face from an XLFD |
|
12dcadf8cb59
(Finternal_set_lisp_face_attribute)
Eli Zaretskii <eliz@gnu.org>
parents:
40023
diff
changeset
|
4319 font name. */ |
|
12dcadf8cb59
(Finternal_set_lisp_face_attribute)
Eli Zaretskii <eliz@gnu.org>
parents:
40023
diff
changeset
|
4320 struct frame *f; |
|
12dcadf8cb59
(Finternal_set_lisp_face_attribute)
Eli Zaretskii <eliz@gnu.org>
parents:
40023
diff
changeset
|
4321 Lisp_Object tmp; |
|
12dcadf8cb59
(Finternal_set_lisp_face_attribute)
Eli Zaretskii <eliz@gnu.org>
parents:
40023
diff
changeset
|
4322 |
|
12dcadf8cb59
(Finternal_set_lisp_face_attribute)
Eli Zaretskii <eliz@gnu.org>
parents:
40023
diff
changeset
|
4323 if (EQ (frame, Qt)) |
|
12dcadf8cb59
(Finternal_set_lisp_face_attribute)
Eli Zaretskii <eliz@gnu.org>
parents:
40023
diff
changeset
|
4324 f = SELECTED_FRAME (); |
|
12dcadf8cb59
(Finternal_set_lisp_face_attribute)
Eli Zaretskii <eliz@gnu.org>
parents:
40023
diff
changeset
|
4325 else |
|
12dcadf8cb59
(Finternal_set_lisp_face_attribute)
Eli Zaretskii <eliz@gnu.org>
parents:
40023
diff
changeset
|
4326 f = check_x_frame (frame); |
|
12dcadf8cb59
(Finternal_set_lisp_face_attribute)
Eli Zaretskii <eliz@gnu.org>
parents:
40023
diff
changeset
|
4327 |
|
51092
c559952fe972
(Finternal_set_lisp_face_attribute): Handle Qunspecified
Richard M. Stallman <rms@gnu.org>
parents:
50515
diff
changeset
|
4328 if (!UNSPECIFIEDP (value)) |
|
c559952fe972
(Finternal_set_lisp_face_attribute): Handle Qunspecified
Richard M. Stallman <rms@gnu.org>
parents:
50515
diff
changeset
|
4329 { |
|
c559952fe972
(Finternal_set_lisp_face_attribute): Handle Qunspecified
Richard M. Stallman <rms@gnu.org>
parents:
50515
diff
changeset
|
4330 CHECK_STRING (value); |
|
c559952fe972
(Finternal_set_lisp_face_attribute): Handle Qunspecified
Richard M. Stallman <rms@gnu.org>
parents:
50515
diff
changeset
|
4331 |
|
c559952fe972
(Finternal_set_lisp_face_attribute): Handle Qunspecified
Richard M. Stallman <rms@gnu.org>
parents:
50515
diff
changeset
|
4332 /* VALUE may be a fontset name or an alias of fontset. In |
|
c559952fe972
(Finternal_set_lisp_face_attribute): Handle Qunspecified
Richard M. Stallman <rms@gnu.org>
parents:
50515
diff
changeset
|
4333 such a case, use the base fontset name. */ |
|
c559952fe972
(Finternal_set_lisp_face_attribute): Handle Qunspecified
Richard M. Stallman <rms@gnu.org>
parents:
50515
diff
changeset
|
4334 tmp = Fquery_fontset (value, Qnil); |
|
c559952fe972
(Finternal_set_lisp_face_attribute): Handle Qunspecified
Richard M. Stallman <rms@gnu.org>
parents:
50515
diff
changeset
|
4335 if (!NILP (tmp)) |
|
c559952fe972
(Finternal_set_lisp_face_attribute): Handle Qunspecified
Richard M. Stallman <rms@gnu.org>
parents:
50515
diff
changeset
|
4336 value = tmp; |
| 89483 | 4337 else if (EQ (attr, QCfontset)) |
| 4338 signal_error ("Invalid fontset name", value); | |
| 4339 | |
| 4340 if (EQ (attr, QCfont)) | |
| 4341 { | |
| 4342 if (!set_lface_from_font_name (f, lface, value, 1, 1)) | |
| 4343 signal_error ("Invalid font or fontset name", value); | |
| 4344 } | |
| 4345 else | |
| 4346 LFACE_FONTSET (lface) = value; | |
|
51092
c559952fe972
(Finternal_set_lisp_face_attribute): Handle Qunspecified
Richard M. Stallman <rms@gnu.org>
parents:
50515
diff
changeset
|
4347 } |
|
40224
12dcadf8cb59
(Finternal_set_lisp_face_attribute)
Eli Zaretskii <eliz@gnu.org>
parents:
40023
diff
changeset
|
4348 |
|
12dcadf8cb59
(Finternal_set_lisp_face_attribute)
Eli Zaretskii <eliz@gnu.org>
parents:
40023
diff
changeset
|
4349 font_attr_p = 1; |
|
12dcadf8cb59
(Finternal_set_lisp_face_attribute)
Eli Zaretskii <eliz@gnu.org>
parents:
40023
diff
changeset
|
4350 } |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
4351 #endif /* HAVE_WINDOW_SYSTEM */ |
| 24995 | 4352 } |
| 31178 | 4353 else if (EQ (attr, QCinherit)) |
| 4354 { | |
| 4355 Lisp_Object tail; | |
| 4356 if (SYMBOLP (value)) | |
| 4357 tail = Qnil; | |
| 4358 else | |
| 4359 for (tail = value; CONSP (tail); tail = XCDR (tail)) | |
| 4360 if (!SYMBOLP (XCAR (tail))) | |
| 4361 break; | |
| 4362 if (NILP (tail)) | |
| 4363 LFACE_INHERIT (lface) = value; | |
| 4364 else | |
|
31202
1733db535955
(lface_fully_specified_p): Handle :inherit.
Gerd Moellmann <gerd@gnu.org>
parents:
31178
diff
changeset
|
4365 signal_error ("Invalid face inheritance", value); |
| 31178 | 4366 } |
| 24995 | 4367 else if (EQ (attr, QCbold)) |
| 4368 { | |
| 4369 old_value = LFACE_WEIGHT (lface); | |
| 4370 LFACE_WEIGHT (lface) = NILP (value) ? Qnormal : Qbold; | |
| 4371 font_related_attr_p = 1; | |
| 4372 } | |
| 4373 else if (EQ (attr, QCitalic)) | |
| 4374 { | |
| 4375 old_value = LFACE_SLANT (lface); | |
| 4376 LFACE_SLANT (lface) = NILP (value) ? Qnormal : Qitalic; | |
| 4377 font_related_attr_p = 1; | |
| 4378 } | |
| 4379 else | |
| 4380 signal_error ("Invalid face attribute name", attr); | |
| 4381 | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
4382 if (font_related_attr_p |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
4383 && !UNSPECIFIEDP (value)) |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
4384 /* If a font-related attribute other than QCfont is specified, the |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
4385 original `font' attribute nor that of default face is useless |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
4386 to determine a new font. Thus, we set it to nil so that font |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
4387 selection mechanism doesn't use it. */ |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
4388 LFACE_FONT (lface) = Qnil; |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
4389 |
| 24995 | 4390 /* Changing a named face means that all realized faces depending on |
| 4391 that face are invalid. Since we cannot tell which realized faces | |
| 4392 depend on the face, make sure they are all removed. This is done | |
| 4393 by incrementing face_change_count. The next call to | |
| 4394 init_iterator will then free realized faces. */ | |
| 4395 if (!EQ (frame, Qt) | |
| 57107 | 4396 && NILP (Fget (face, Qface_no_inherit)) |
| 24995 | 4397 && (EQ (attr, QCfont) |
|
89047
3b6234eb229c
(QCfontset): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88939
diff
changeset
|
4398 || EQ (attr, QCfontset) |
| 24995 | 4399 || NILP (Fequal (old_value, value)))) |
| 4400 { | |
| 4401 ++face_change_count; | |
| 4402 ++windows_or_buffers_changed; | |
| 4403 } | |
| 4404 | |
|
34242
dd4e1abada68
(Finternal_set_lisp_face_attribute): If FRAME is `t', update
Miles Bader <miles@gnu.org>
parents:
34160
diff
changeset
|
4405 if (!UNSPECIFIEDP (value) |
| 24995 | 4406 && NILP (Fequal (old_value, value))) |
|
25592
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4407 { |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4408 Lisp_Object param; |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4409 |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4410 param = Qnil; |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
4411 |
|
25592
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4412 if (EQ (face, Qdefault)) |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4413 { |
|
36481
8456d3257f81
(Finternal_set_lisp_face_attribute)
Eli Zaretskii <eliz@gnu.org>
parents:
36066
diff
changeset
|
4414 #ifdef HAVE_WINDOW_SYSTEM |
|
25592
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4415 /* Changed font-related attributes of the `default' face are |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4416 reflected in changed `font' frame parameters. */ |
|
38905
70ef1eb656a6
(menu_face_changed_default): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38818
diff
changeset
|
4417 if (FRAMEP (frame) |
|
70ef1eb656a6
(menu_face_changed_default): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38818
diff
changeset
|
4418 && (font_related_attr_p || font_attr_p) |
|
25592
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4419 && lface_fully_specified_p (XVECTOR (lface)->contents)) |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4420 set_font_frame_param (frame, lface); |
|
36481
8456d3257f81
(Finternal_set_lisp_face_attribute)
Eli Zaretskii <eliz@gnu.org>
parents:
36066
diff
changeset
|
4421 else |
|
8456d3257f81
(Finternal_set_lisp_face_attribute)
Eli Zaretskii <eliz@gnu.org>
parents:
36066
diff
changeset
|
4422 #endif /* HAVE_WINDOW_SYSTEM */ |
|
8456d3257f81
(Finternal_set_lisp_face_attribute)
Eli Zaretskii <eliz@gnu.org>
parents:
36066
diff
changeset
|
4423 |
|
8456d3257f81
(Finternal_set_lisp_face_attribute)
Eli Zaretskii <eliz@gnu.org>
parents:
36066
diff
changeset
|
4424 if (EQ (attr, QCforeground)) |
|
25592
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4425 param = Qforeground_color; |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4426 else if (EQ (attr, QCbackground)) |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4427 param = Qbackground_color; |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4428 } |
|
36481
8456d3257f81
(Finternal_set_lisp_face_attribute)
Eli Zaretskii <eliz@gnu.org>
parents:
36066
diff
changeset
|
4429 #ifdef HAVE_WINDOW_SYSTEM |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
4430 #ifndef WINDOWSNT |
|
25592
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4431 else if (EQ (face, Qscroll_bar)) |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4432 { |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4433 /* Changing the colors of `scroll-bar' sets frame parameters |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4434 `scroll-bar-foreground' and `scroll-bar-background'. */ |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4435 if (EQ (attr, QCforeground)) |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4436 param = Qscroll_bar_foreground; |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4437 else if (EQ (attr, QCbackground)) |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4438 param = Qscroll_bar_background; |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4439 } |
|
31570
9eeff4863080
Remove conditional compilation on SCALABLE_FONTS.
Gerd Moellmann <gerd@gnu.org>
parents:
31522
diff
changeset
|
4440 #endif /* not WINDOWSNT */ |
|
25592
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4441 else if (EQ (face, Qborder)) |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4442 { |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4443 /* Changing background color of `border' sets frame parameter |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4444 `border-color'. */ |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4445 if (EQ (attr, QCbackground)) |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4446 param = Qborder_color; |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4447 } |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4448 else if (EQ (face, Qcursor)) |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4449 { |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4450 /* Changing background color of `cursor' sets frame parameter |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4451 `cursor-color'. */ |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4452 if (EQ (attr, QCbackground)) |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4453 param = Qcursor_color; |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4454 } |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4455 else if (EQ (face, Qmouse)) |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4456 { |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4457 /* Changing background color of `mouse' sets frame parameter |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4458 `mouse-color'. */ |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4459 if (EQ (attr, QCbackground)) |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4460 param = Qmouse_color; |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4461 } |
|
36481
8456d3257f81
(Finternal_set_lisp_face_attribute)
Eli Zaretskii <eliz@gnu.org>
parents:
36066
diff
changeset
|
4462 #endif /* HAVE_WINDOW_SYSTEM */ |
|
33082
5ab6f3e1f5c8
(menu_face_change_count): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33070
diff
changeset
|
4463 else if (EQ (face, Qmenu)) |
|
38905
70ef1eb656a6
(menu_face_changed_default): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38818
diff
changeset
|
4464 { |
|
70ef1eb656a6
(menu_face_changed_default): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38818
diff
changeset
|
4465 /* Indicate that we have to update the menu bar when |
|
70ef1eb656a6
(menu_face_changed_default): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38818
diff
changeset
|
4466 realizing faces on FRAME. FRAME t change the |
|
70ef1eb656a6
(menu_face_changed_default): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38818
diff
changeset
|
4467 default for new frames. We do this by setting |
|
70ef1eb656a6
(menu_face_changed_default): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38818
diff
changeset
|
4468 setting the flag in new face caches */ |
|
70ef1eb656a6
(menu_face_changed_default): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38818
diff
changeset
|
4469 if (FRAMEP (frame)) |
|
70ef1eb656a6
(menu_face_changed_default): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38818
diff
changeset
|
4470 { |
|
70ef1eb656a6
(menu_face_changed_default): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38818
diff
changeset
|
4471 struct frame *f = XFRAME (frame); |
|
70ef1eb656a6
(menu_face_changed_default): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38818
diff
changeset
|
4472 if (FRAME_FACE_CACHE (f) == NULL) |
|
70ef1eb656a6
(menu_face_changed_default): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38818
diff
changeset
|
4473 FRAME_FACE_CACHE (f) = make_face_cache (f); |
|
70ef1eb656a6
(menu_face_changed_default): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38818
diff
changeset
|
4474 FRAME_FACE_CACHE (f)->menu_face_changed_p = 1; |
|
70ef1eb656a6
(menu_face_changed_default): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38818
diff
changeset
|
4475 } |
|
70ef1eb656a6
(menu_face_changed_default): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38818
diff
changeset
|
4476 else |
|
70ef1eb656a6
(menu_face_changed_default): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38818
diff
changeset
|
4477 menu_face_changed_default = 1; |
|
70ef1eb656a6
(menu_face_changed_default): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38818
diff
changeset
|
4478 } |
|
25592
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4479 |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
4480 if (!NILP (param)) |
|
40838
bf08eafda9a3
(merge_face_vectors): Use braces to follow GNU Coding Standards.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
4481 { |
|
bf08eafda9a3
(merge_face_vectors): Use braces to follow GNU Coding Standards.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
4482 if (EQ (frame, Qt)) |
|
bf08eafda9a3
(merge_face_vectors): Use braces to follow GNU Coding Standards.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
4483 /* Update `default-frame-alist', which is used for new frames. */ |
|
bf08eafda9a3
(merge_face_vectors): Use braces to follow GNU Coding Standards.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
4484 { |
|
bf08eafda9a3
(merge_face_vectors): Use braces to follow GNU Coding Standards.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
4485 store_in_alist (&Vdefault_frame_alist, param, value); |
|
bf08eafda9a3
(merge_face_vectors): Use braces to follow GNU Coding Standards.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
4486 } |
|
bf08eafda9a3
(merge_face_vectors): Use braces to follow GNU Coding Standards.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
4487 else |
|
bf08eafda9a3
(merge_face_vectors): Use braces to follow GNU Coding Standards.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
4488 /* Update the current frame's parameters. */ |
|
bf08eafda9a3
(merge_face_vectors): Use braces to follow GNU Coding Standards.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
4489 { |
|
bf08eafda9a3
(merge_face_vectors): Use braces to follow GNU Coding Standards.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
4490 Lisp_Object cons; |
|
bf08eafda9a3
(merge_face_vectors): Use braces to follow GNU Coding Standards.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
4491 cons = XCAR (Vparam_value_alist); |
|
bf08eafda9a3
(merge_face_vectors): Use braces to follow GNU Coding Standards.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
4492 XSETCAR (cons, param); |
|
bf08eafda9a3
(merge_face_vectors): Use braces to follow GNU Coding Standards.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
4493 XSETCDR (cons, value); |
|
bf08eafda9a3
(merge_face_vectors): Use braces to follow GNU Coding Standards.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
4494 Fmodify_frame_parameters (frame, Vparam_value_alist); |
|
bf08eafda9a3
(merge_face_vectors): Use braces to follow GNU Coding Standards.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
4495 } |
|
bf08eafda9a3
(merge_face_vectors): Use braces to follow GNU Coding Standards.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40656
diff
changeset
|
4496 } |
|
25592
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4497 } |
| 24995 | 4498 |
| 4499 return face; | |
| 4500 } | |
| 4501 | |
| 4502 | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
4503 #ifdef HAVE_WINDOW_SYSTEM |
| 24995 | 4504 |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
4505 /* Set the `font' frame parameter of FRAME determined from `default' |
|
89047
3b6234eb229c
(QCfontset): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88939
diff
changeset
|
4506 face attributes LFACE. If a font name is explicitely |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
4507 specfied in LFACE, use it as is. Otherwise, determine a font name |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
4508 from the other font-related atrributes of LFACE. In that case, if |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
4509 there's no matching font, signals an error. */ |
| 24995 | 4510 |
| 4511 static void | |
| 4512 set_font_frame_param (frame, lface) | |
| 4513 Lisp_Object frame, lface; | |
| 4514 { | |
| 4515 struct frame *f = XFRAME (frame); | |
|
35040
604d4b3d1054
(set_font_frame_param): Don't do anything for
Gerd Moellmann <gerd@gnu.org>
parents:
35004
diff
changeset
|
4516 |
|
604d4b3d1054
(set_font_frame_param): Don't do anything for
Gerd Moellmann <gerd@gnu.org>
parents:
35004
diff
changeset
|
4517 if (FRAME_WINDOW_P (f)) |
|
604d4b3d1054
(set_font_frame_param): Don't do anything for
Gerd Moellmann <gerd@gnu.org>
parents:
35004
diff
changeset
|
4518 { |
|
604d4b3d1054
(set_font_frame_param): Don't do anything for
Gerd Moellmann <gerd@gnu.org>
parents:
35004
diff
changeset
|
4519 Lisp_Object font_name; |
|
604d4b3d1054
(set_font_frame_param): Don't do anything for
Gerd Moellmann <gerd@gnu.org>
parents:
35004
diff
changeset
|
4520 char *font; |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48384
diff
changeset
|
4521 |
|
35040
604d4b3d1054
(set_font_frame_param): Don't do anything for
Gerd Moellmann <gerd@gnu.org>
parents:
35004
diff
changeset
|
4522 if (STRINGP (LFACE_FONT (lface))) |
|
604d4b3d1054
(set_font_frame_param): Don't do anything for
Gerd Moellmann <gerd@gnu.org>
parents:
35004
diff
changeset
|
4523 font_name = LFACE_FONT (lface); |
|
604d4b3d1054
(set_font_frame_param): Don't do anything for
Gerd Moellmann <gerd@gnu.org>
parents:
35004
diff
changeset
|
4524 else |
|
604d4b3d1054
(set_font_frame_param): Don't do anything for
Gerd Moellmann <gerd@gnu.org>
parents:
35004
diff
changeset
|
4525 { |
|
604d4b3d1054
(set_font_frame_param): Don't do anything for
Gerd Moellmann <gerd@gnu.org>
parents:
35004
diff
changeset
|
4526 /* Choose a font name that reflects LFACE's attributes and has |
|
604d4b3d1054
(set_font_frame_param): Don't do anything for
Gerd Moellmann <gerd@gnu.org>
parents:
35004
diff
changeset
|
4527 the registry and encoding pattern specified in the default |
|
604d4b3d1054
(set_font_frame_param): Don't do anything for
Gerd Moellmann <gerd@gnu.org>
parents:
35004
diff
changeset
|
4528 fontset (3rd arg: -1) for ASCII characters (4th arg: 0). */ |
| 89483 | 4529 font = choose_face_font (f, XVECTOR (lface)->contents, Qnil, NULL); |
|
35040
604d4b3d1054
(set_font_frame_param): Don't do anything for
Gerd Moellmann <gerd@gnu.org>
parents:
35004
diff
changeset
|
4530 if (!font) |
|
604d4b3d1054
(set_font_frame_param): Don't do anything for
Gerd Moellmann <gerd@gnu.org>
parents:
35004
diff
changeset
|
4531 error ("No font matches the specified attribute"); |
|
604d4b3d1054
(set_font_frame_param): Don't do anything for
Gerd Moellmann <gerd@gnu.org>
parents:
35004
diff
changeset
|
4532 font_name = build_string (font); |
|
604d4b3d1054
(set_font_frame_param): Don't do anything for
Gerd Moellmann <gerd@gnu.org>
parents:
35004
diff
changeset
|
4533 xfree (font); |
|
604d4b3d1054
(set_font_frame_param): Don't do anything for
Gerd Moellmann <gerd@gnu.org>
parents:
35004
diff
changeset
|
4534 } |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48384
diff
changeset
|
4535 |
|
51665
c1f65dfc56eb
Fix some of the font/face problems.
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
51500
diff
changeset
|
4536 f->default_face_done_p = 0; |
|
35040
604d4b3d1054
(set_font_frame_param): Don't do anything for
Gerd Moellmann <gerd@gnu.org>
parents:
35004
diff
changeset
|
4537 Fmodify_frame_parameters (frame, Fcons (Fcons (Qfont, font_name), Qnil)); |
|
604d4b3d1054
(set_font_frame_param): Don't do anything for
Gerd Moellmann <gerd@gnu.org>
parents:
35004
diff
changeset
|
4538 } |
| 24995 | 4539 } |
| 4540 | |
| 4541 | |
|
25592
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4542 /* Update the corresponding face when frame parameter PARAM on frame F |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4543 has been assigned the value NEW_VALUE. */ |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4544 |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4545 void |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4546 update_face_from_frame_parameter (f, param, new_value) |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4547 struct frame *f; |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4548 Lisp_Object param, new_value; |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4549 { |
| 57107 | 4550 Lisp_Object face = Qnil; |
|
25592
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4551 Lisp_Object lface; |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4552 |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4553 /* If there are no faces yet, give up. This is the case when called |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4554 from Fx_create_frame, and we do the necessary things later in |
|
25661
a6e2ae7964fb
(Fx_family_fonts): Replaces Fx_font_list.
Gerd Moellmann <gerd@gnu.org>
parents:
25592
diff
changeset
|
4555 face-set-after-frame-defaults. */ |
|
25592
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4556 if (NILP (f->face_alist)) |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4557 return; |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
4558 |
|
25592
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4559 if (EQ (param, Qforeground_color)) |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4560 { |
| 57107 | 4561 face = Qdefault; |
| 4562 lface = lface_from_face_name (f, face, 1); | |
|
25592
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4563 LFACE_FOREGROUND (lface) = (STRINGP (new_value) |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4564 ? new_value : Qunspecified); |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4565 realize_basic_faces (f); |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4566 } |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4567 else if (EQ (param, Qbackground_color)) |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4568 { |
|
25661
a6e2ae7964fb
(Fx_family_fonts): Replaces Fx_font_list.
Gerd Moellmann <gerd@gnu.org>
parents:
25592
diff
changeset
|
4569 Lisp_Object frame; |
|
a6e2ae7964fb
(Fx_family_fonts): Replaces Fx_font_list.
Gerd Moellmann <gerd@gnu.org>
parents:
25592
diff
changeset
|
4570 |
|
a6e2ae7964fb
(Fx_family_fonts): Replaces Fx_font_list.
Gerd Moellmann <gerd@gnu.org>
parents:
25592
diff
changeset
|
4571 /* Changing the background color might change the background |
|
a6e2ae7964fb
(Fx_family_fonts): Replaces Fx_font_list.
Gerd Moellmann <gerd@gnu.org>
parents:
25592
diff
changeset
|
4572 mode, so that we have to load new defface specs. Call |
|
a6e2ae7964fb
(Fx_family_fonts): Replaces Fx_font_list.
Gerd Moellmann <gerd@gnu.org>
parents:
25592
diff
changeset
|
4573 frame-update-face-colors to do that. */ |
|
a6e2ae7964fb
(Fx_family_fonts): Replaces Fx_font_list.
Gerd Moellmann <gerd@gnu.org>
parents:
25592
diff
changeset
|
4574 XSETFRAME (frame, f); |
|
a6e2ae7964fb
(Fx_family_fonts): Replaces Fx_font_list.
Gerd Moellmann <gerd@gnu.org>
parents:
25592
diff
changeset
|
4575 call1 (Qframe_update_face_colors, frame); |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
4576 |
| 57107 | 4577 face = Qdefault; |
| 4578 lface = lface_from_face_name (f, face, 1); | |
|
25592
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4579 LFACE_BACKGROUND (lface) = (STRINGP (new_value) |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4580 ? new_value : Qunspecified); |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4581 realize_basic_faces (f); |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4582 } |
| 57107 | 4583 else if (EQ (param, Qborder_color)) |
| 4584 { | |
| 4585 face = Qborder; | |
| 4586 lface = lface_from_face_name (f, face, 1); | |
|
25592
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4587 LFACE_BACKGROUND (lface) = (STRINGP (new_value) |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4588 ? new_value : Qunspecified); |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4589 } |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4590 else if (EQ (param, Qcursor_color)) |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4591 { |
| 57107 | 4592 face = Qcursor; |
| 4593 lface = lface_from_face_name (f, face, 1); | |
|
25592
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4594 LFACE_BACKGROUND (lface) = (STRINGP (new_value) |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4595 ? new_value : Qunspecified); |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4596 } |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4597 else if (EQ (param, Qmouse_color)) |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4598 { |
| 57107 | 4599 face = Qmouse; |
| 4600 lface = lface_from_face_name (f, face, 1); | |
|
25592
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4601 LFACE_BACKGROUND (lface) = (STRINGP (new_value) |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4602 ? new_value : Qunspecified); |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4603 } |
| 57107 | 4604 |
| 4605 /* Changing a named face means that all realized faces depending on | |
| 4606 that face are invalid. Since we cannot tell which realized faces | |
| 4607 depend on the face, make sure they are all removed. This is done | |
| 4608 by incrementing face_change_count. The next call to | |
| 4609 init_iterator will then free realized faces. */ | |
| 4610 if (!NILP (face) | |
| 4611 && NILP (Fget (face, Qface_no_inherit))) | |
| 4612 { | |
| 4613 ++face_change_count; | |
| 4614 ++windows_or_buffers_changed; | |
| 4615 } | |
|
25592
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4616 } |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4617 |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
4618 |
| 24995 | 4619 /* Get the value of X resource RESOURCE, class CLASS for the display |
| 4620 of frame FRAME. This is here because ordinary `x-get-resource' | |
| 4621 doesn't take a frame argument. */ | |
| 4622 | |
| 4623 DEFUN ("internal-face-x-get-resource", Finternal_face_x_get_resource, | |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
4624 Sinternal_face_x_get_resource, 3, 3, 0, doc: /* */) |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
4625 (resource, class, frame) |
| 24995 | 4626 Lisp_Object resource, class, frame; |
| 4627 { | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
4628 Lisp_Object value = Qnil; |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
4629 CHECK_STRING (resource); |
|
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
4630 CHECK_STRING (class); |
|
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
4631 CHECK_LIVE_FRAME (frame); |
| 24995 | 4632 BLOCK_INPUT; |
| 4633 value = display_x_get_resource (FRAME_X_DISPLAY_INFO (XFRAME (frame)), | |
| 4634 resource, class, Qnil, Qnil); | |
| 4635 UNBLOCK_INPUT; | |
| 4636 return value; | |
| 4637 } | |
| 4638 | |
| 4639 | |
| 4640 /* Return resource string VALUE as a boolean value, i.e. nil, or t. | |
| 4641 If VALUE is "on" or "true", return t. If VALUE is "off" or | |
| 4642 "false", return nil. Otherwise, if SIGNAL_P is non-zero, signal an | |
| 4643 error; if SIGNAL_P is zero, return 0. */ | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
4644 |
| 24995 | 4645 static Lisp_Object |
| 4646 face_boolean_x_resource_value (value, signal_p) | |
| 4647 Lisp_Object value; | |
| 4648 int signal_p; | |
| 4649 { | |
| 4650 Lisp_Object result = make_number (0); | |
| 4651 | |
| 4652 xassert (STRINGP (value)); | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
4653 |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
4654 if (xstricmp (SDATA (value), "on") == 0 |
|
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
4655 || xstricmp (SDATA (value), "true") == 0) |
| 24995 | 4656 result = Qt; |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
4657 else if (xstricmp (SDATA (value), "off") == 0 |
|
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
4658 || xstricmp (SDATA (value), "false") == 0) |
| 24995 | 4659 result = Qnil; |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
4660 else if (xstricmp (SDATA (value), "unspecified") == 0) |
| 24995 | 4661 result = Qunspecified; |
| 4662 else if (signal_p) | |
| 4663 signal_error ("Invalid face attribute value from X resource", value); | |
| 4664 | |
| 4665 return result; | |
| 4666 } | |
| 4667 | |
| 4668 | |
| 4669 DEFUN ("internal-set-lisp-face-attribute-from-resource", | |
| 4670 Finternal_set_lisp_face_attribute_from_resource, | |
| 4671 Sinternal_set_lisp_face_attribute_from_resource, | |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
4672 3, 4, 0, doc: /* */) |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
4673 (face, attr, value, frame) |
| 24995 | 4674 Lisp_Object face, attr, value, frame; |
| 4675 { | |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
4676 CHECK_SYMBOL (face); |
|
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
4677 CHECK_SYMBOL (attr); |
|
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
4678 CHECK_STRING (value); |
| 24995 | 4679 |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
4680 if (xstricmp (SDATA (value), "unspecified") == 0) |
| 24995 | 4681 value = Qunspecified; |
| 4682 else if (EQ (attr, QCheight)) | |
| 4683 { | |
| 4684 value = Fstring_to_number (value, make_number (10)); | |
| 4685 if (XINT (value) <= 0) | |
| 4686 signal_error ("Invalid face height from X resource", value); | |
| 4687 } | |
| 4688 else if (EQ (attr, QCbold) || EQ (attr, QCitalic)) | |
| 4689 value = face_boolean_x_resource_value (value, 1); | |
| 4690 else if (EQ (attr, QCweight) || EQ (attr, QCslant) || EQ (attr, QCwidth)) | |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
4691 value = intern (SDATA (value)); |
| 24995 | 4692 else if (EQ (attr, QCreverse_video) || EQ (attr, QCinverse_video)) |
| 4693 value = face_boolean_x_resource_value (value, 1); | |
| 4694 else if (EQ (attr, QCunderline) | |
| 4695 || EQ (attr, QCoverline) | |
|
40603
e8ff19a0b76e
(Finternal_set_lisp_face_attribute_from_resource):
Gerd Moellmann <gerd@gnu.org>
parents:
40598
diff
changeset
|
4696 || EQ (attr, QCstrike_through)) |
| 24995 | 4697 { |
| 4698 Lisp_Object boolean_value; | |
| 4699 | |
| 4700 /* If the result of face_boolean_x_resource_value is t or nil, | |
| 4701 VALUE does NOT specify a color. */ | |
| 4702 boolean_value = face_boolean_x_resource_value (value, 0); | |
| 4703 if (SYMBOLP (boolean_value)) | |
| 4704 value = boolean_value; | |
| 4705 } | |
|
40603
e8ff19a0b76e
(Finternal_set_lisp_face_attribute_from_resource):
Gerd Moellmann <gerd@gnu.org>
parents:
40598
diff
changeset
|
4706 else if (EQ (attr, QCbox)) |
|
e8ff19a0b76e
(Finternal_set_lisp_face_attribute_from_resource):
Gerd Moellmann <gerd@gnu.org>
parents:
40598
diff
changeset
|
4707 value = Fcar (Fread_from_string (value, Qnil, Qnil)); |
| 24995 | 4708 |
| 4709 return Finternal_set_lisp_face_attribute (face, attr, value, frame); | |
|
6784
d41c216ccd27
(frame_update_line_height): Check param_faces[i] not null.
Richard M. Stallman <rms@gnu.org>
parents:
6768
diff
changeset
|
4710 } |
|
8472
0d0b32e78a5b
(compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
8119
diff
changeset
|
4711 |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
4712 #endif /* HAVE_WINDOW_SYSTEM */ |
| 24995 | 4713 |
|
25883
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
4714 |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
4715 /*********************************************************************** |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
4716 Menu face |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
4717 ***********************************************************************/ |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
4718 |
|
36942
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4719 #if defined HAVE_X_WINDOWS && defined USE_X_TOOLKIT |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4720 |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4721 /* Make menus on frame F appear as specified by the `menu' face. */ |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4722 |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4723 static void |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4724 x_update_menu_appearance (f) |
|
25883
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
4725 struct frame *f; |
|
36936
bda3649d35fd
(x_set_menu_resources_from_menu_face) [USE_X_TOOLKIT]:
Gerd Moellmann <gerd@gnu.org>
parents:
36932
diff
changeset
|
4726 { |
|
bda3649d35fd
(x_set_menu_resources_from_menu_face) [USE_X_TOOLKIT]:
Gerd Moellmann <gerd@gnu.org>
parents:
36932
diff
changeset
|
4727 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); |
|
36942
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4728 XrmDatabase rdb; |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4729 |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4730 if (dpyinfo |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4731 && (rdb = XrmGetDatabase (FRAME_X_DISPLAY (f)), |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4732 rdb != NULL)) |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4733 { |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4734 char line[512]; |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4735 Lisp_Object lface = lface_from_face_name (f, Qmenu, 1); |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4736 struct face *face = FACE_FROM_ID (f, MENU_FACE_ID); |
|
46556
71e205b50a3e
(may_use_scalable_font_p): Argument now points to
Ken Raeburn <raeburn@raeburn.org>
parents:
46478
diff
changeset
|
4737 const char *myname = SDATA (Vx_resource_name); |
|
36942
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4738 int changed_p = 0; |
|
36956
22c5aa03d4aa
(x_update_menu_appearance): Use a different path
Gerd Moellmann <gerd@gnu.org>
parents:
36946
diff
changeset
|
4739 #ifdef USE_MOTIF |
|
22c5aa03d4aa
(x_update_menu_appearance): Use a different path
Gerd Moellmann <gerd@gnu.org>
parents:
36946
diff
changeset
|
4740 const char *popup_path = "popup_menu"; |
|
22c5aa03d4aa
(x_update_menu_appearance): Use a different path
Gerd Moellmann <gerd@gnu.org>
parents:
36946
diff
changeset
|
4741 #else |
|
22c5aa03d4aa
(x_update_menu_appearance): Use a different path
Gerd Moellmann <gerd@gnu.org>
parents:
36946
diff
changeset
|
4742 const char *popup_path = "menu.popup"; |
|
22c5aa03d4aa
(x_update_menu_appearance): Use a different path
Gerd Moellmann <gerd@gnu.org>
parents:
36946
diff
changeset
|
4743 #endif |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48384
diff
changeset
|
4744 |
|
36942
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4745 if (STRINGP (LFACE_FOREGROUND (lface))) |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4746 { |
|
36956
22c5aa03d4aa
(x_update_menu_appearance): Use a different path
Gerd Moellmann <gerd@gnu.org>
parents:
36946
diff
changeset
|
4747 sprintf (line, "%s.%s*foreground: %s", |
|
22c5aa03d4aa
(x_update_menu_appearance): Use a different path
Gerd Moellmann <gerd@gnu.org>
parents:
36946
diff
changeset
|
4748 myname, popup_path, |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
4749 SDATA (LFACE_FOREGROUND (lface))); |
|
36942
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4750 XrmPutLineResource (&rdb, line); |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4751 sprintf (line, "%s.pane.menubar*foreground: %s", |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
4752 myname, SDATA (LFACE_FOREGROUND (lface))); |
|
36942
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4753 XrmPutLineResource (&rdb, line); |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4754 changed_p = 1; |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4755 } |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4756 |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4757 if (STRINGP (LFACE_BACKGROUND (lface))) |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4758 { |
|
36956
22c5aa03d4aa
(x_update_menu_appearance): Use a different path
Gerd Moellmann <gerd@gnu.org>
parents:
36946
diff
changeset
|
4759 sprintf (line, "%s.%s*background: %s", |
|
22c5aa03d4aa
(x_update_menu_appearance): Use a different path
Gerd Moellmann <gerd@gnu.org>
parents:
36946
diff
changeset
|
4760 myname, popup_path, |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
4761 SDATA (LFACE_BACKGROUND (lface))); |
|
36942
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4762 XrmPutLineResource (&rdb, line); |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4763 sprintf (line, "%s.pane.menubar*background: %s", |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
4764 myname, SDATA (LFACE_BACKGROUND (lface))); |
|
36942
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4765 XrmPutLineResource (&rdb, line); |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4766 changed_p = 1; |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4767 } |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48384
diff
changeset
|
4768 |
|
36942
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4769 if (face->font_name |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4770 && (!UNSPECIFIEDP (LFACE_FAMILY (lface)) |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4771 || !UNSPECIFIEDP (LFACE_SWIDTH (lface)) |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4772 || !UNSPECIFIEDP (LFACE_AVGWIDTH (lface)) |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4773 || !UNSPECIFIEDP (LFACE_WEIGHT (lface)) |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4774 || !UNSPECIFIEDP (LFACE_SLANT (lface)) |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4775 || !UNSPECIFIEDP (LFACE_HEIGHT (lface)))) |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4776 { |
|
25883
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
4777 #ifdef USE_MOTIF |
|
36942
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4778 const char *suffix = "List"; |
|
36936
bda3649d35fd
(x_set_menu_resources_from_menu_face) [USE_X_TOOLKIT]:
Gerd Moellmann <gerd@gnu.org>
parents:
36932
diff
changeset
|
4779 #else |
|
36942
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4780 const char *suffix = ""; |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4781 #endif |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4782 sprintf (line, "%s.pane.menubar*font%s: %s", |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4783 myname, suffix, face->font_name); |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4784 XrmPutLineResource (&rdb, line); |
|
36996
46d9cc8def79
(x_update_menu_appearance): Use local variable
Gerd Moellmann <gerd@gnu.org>
parents:
36956
diff
changeset
|
4785 sprintf (line, "%s.%s*font%s: %s", |
|
46d9cc8def79
(x_update_menu_appearance): Use local variable
Gerd Moellmann <gerd@gnu.org>
parents:
36956
diff
changeset
|
4786 myname, popup_path, suffix, face->font_name); |
|
36942
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4787 XrmPutLineResource (&rdb, line); |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4788 changed_p = 1; |
|
36936
bda3649d35fd
(x_set_menu_resources_from_menu_face) [USE_X_TOOLKIT]:
Gerd Moellmann <gerd@gnu.org>
parents:
36932
diff
changeset
|
4789 } |
|
36942
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4790 |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4791 if (changed_p && f->output_data.x->menubar_widget) |
|
38818
b0327e4e1da7
(x_update_menu_appearance): Don't call
Gerd Moellmann <gerd@gnu.org>
parents:
38802
diff
changeset
|
4792 free_frame_menubar (f); |
|
36942
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4793 } |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4794 } |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4795 |
|
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
4796 #endif /* HAVE_X_WINDOWS && USE_X_TOOLKIT */ |
| 24995 | 4797 |
| 4798 | |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48384
diff
changeset
|
4799 DEFUN ("face-attribute-relative-p", Fface_attribute_relative_p, |
|
40398
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
4800 Sface_attribute_relative_p, |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
4801 2, 2, 0, |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
4802 doc: /* Return non-nil if face ATTRIBUTE VALUE is relative. */) |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
4803 (attribute, value) |
|
40532
221868112227
(Fface_attribute_relative_p): Declare args.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
40441
diff
changeset
|
4804 Lisp_Object attribute, value; |
|
40398
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
4805 { |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
4806 if (EQ (value, Qunspecified)) |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
4807 return Qt; |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
4808 else if (EQ (attribute, QCheight)) |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
4809 return INTEGERP (value) ? Qnil : Qt; |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
4810 else |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
4811 return Qnil; |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
4812 } |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
4813 |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
4814 DEFUN ("merge-face-attribute", Fmerge_face_attribute, Smerge_face_attribute, |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
4815 3, 3, 0, |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
4816 doc: /* Return face ATTRIBUTE VALUE1 merged with VALUE2. |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
4817 If VALUE1 or VALUE2 are absolute (see `face-attribute-relative-p'), then |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
4818 the result will be absolute, otherwise it will be relative. */) |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
4819 (attribute, value1, value2) |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
4820 Lisp_Object attribute, value1, value2; |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
4821 { |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
4822 if (EQ (value1, Qunspecified)) |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
4823 return value2; |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
4824 else if (EQ (attribute, QCheight)) |
|
57997
7a44d300ed6f
(merge_named_face): GCPRO the face_name in the
Richard M. Stallman <rms@gnu.org>
parents:
57107
diff
changeset
|
4825 return merge_face_heights (value1, value2, value1); |
|
40398
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
4826 else |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
4827 return value1; |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
4828 } |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
4829 |
| 24995 | 4830 |
| 4831 DEFUN ("internal-get-lisp-face-attribute", Finternal_get_lisp_face_attribute, | |
| 4832 Sinternal_get_lisp_face_attribute, | |
| 4833 2, 3, 0, | |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
4834 doc: /* Return face attribute KEYWORD of face SYMBOL. |
|
39914
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
4835 If SYMBOL does not name a valid Lisp face or KEYWORD isn't a valid |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
4836 face attribute name, signal an error. |
|
55560
f262795a9004
(Ftty_supports_face_attributes_p, Finternal_copy_lisp_face): Fix typo in
Juanma Barranquero <lekktu@gmail.com>
parents:
55142
diff
changeset
|
4837 If the optional argument FRAME is given, report on face SYMBOL in that |
|
f262795a9004
(Ftty_supports_face_attributes_p, Finternal_copy_lisp_face): Fix typo in
Juanma Barranquero <lekktu@gmail.com>
parents:
55142
diff
changeset
|
4838 frame. If FRAME is t, report on the defaults for face SYMBOL (for new |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
4839 frames). If FRAME is omitted or nil, use the selected frame. */) |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
4840 (symbol, keyword, frame) |
| 24995 | 4841 Lisp_Object symbol, keyword, frame; |
| 4842 { | |
| 4843 Lisp_Object lface, value = Qnil; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
4844 |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
4845 CHECK_SYMBOL (symbol); |
|
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
4846 CHECK_SYMBOL (keyword); |
| 24995 | 4847 |
| 4848 if (EQ (frame, Qt)) | |
| 4849 lface = lface_from_face_name (NULL, symbol, 1); | |
| 4850 else | |
| 4851 { | |
| 4852 if (NILP (frame)) | |
|
25678
1878f7ae0df5
(frame_or_selected_frame): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25661
diff
changeset
|
4853 frame = selected_frame; |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
4854 CHECK_LIVE_FRAME (frame); |
| 24995 | 4855 lface = lface_from_face_name (XFRAME (frame), symbol, 1); |
| 4856 } | |
| 4857 | |
| 4858 if (EQ (keyword, QCfamily)) | |
| 4859 value = LFACE_FAMILY (lface); | |
| 4860 else if (EQ (keyword, QCheight)) | |
| 4861 value = LFACE_HEIGHT (lface); | |
| 4862 else if (EQ (keyword, QCweight)) | |
| 4863 value = LFACE_WEIGHT (lface); | |
| 4864 else if (EQ (keyword, QCslant)) | |
| 4865 value = LFACE_SLANT (lface); | |
| 4866 else if (EQ (keyword, QCunderline)) | |
| 4867 value = LFACE_UNDERLINE (lface); | |
| 4868 else if (EQ (keyword, QCoverline)) | |
| 4869 value = LFACE_OVERLINE (lface); | |
| 4870 else if (EQ (keyword, QCstrike_through)) | |
| 4871 value = LFACE_STRIKE_THROUGH (lface); | |
| 4872 else if (EQ (keyword, QCbox)) | |
| 4873 value = LFACE_BOX (lface); | |
| 4874 else if (EQ (keyword, QCinverse_video) | |
| 4875 || EQ (keyword, QCreverse_video)) | |
| 4876 value = LFACE_INVERSE (lface); | |
| 4877 else if (EQ (keyword, QCforeground)) | |
| 4878 value = LFACE_FOREGROUND (lface); | |
| 4879 else if (EQ (keyword, QCbackground)) | |
| 4880 value = LFACE_BACKGROUND (lface); | |
| 4881 else if (EQ (keyword, QCstipple)) | |
| 4882 value = LFACE_STIPPLE (lface); | |
| 4883 else if (EQ (keyword, QCwidth)) | |
| 4884 value = LFACE_SWIDTH (lface); | |
| 31178 | 4885 else if (EQ (keyword, QCinherit)) |
| 4886 value = LFACE_INHERIT (lface); | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
4887 else if (EQ (keyword, QCfont)) |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
4888 value = LFACE_FONT (lface); |
|
89047
3b6234eb229c
(QCfontset): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88939
diff
changeset
|
4889 else if (EQ (keyword, QCfontset)) |
|
3b6234eb229c
(QCfontset): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88939
diff
changeset
|
4890 value = LFACE_FONTSET (lface); |
| 24995 | 4891 else |
| 4892 signal_error ("Invalid face attribute name", keyword); | |
| 4893 | |
| 4894 return value; | |
| 4895 } | |
| 4896 | |
| 4897 | |
| 4898 DEFUN ("internal-lisp-face-attribute-values", | |
| 4899 Finternal_lisp_face_attribute_values, | |
| 4900 Sinternal_lisp_face_attribute_values, 1, 1, 0, | |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
4901 doc: /* Return a list of valid discrete values for face attribute ATTR. |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
4902 Value is nil if ATTR doesn't have a discrete set of valid values. */) |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
4903 (attr) |
| 24995 | 4904 Lisp_Object attr; |
| 4905 { | |
| 4906 Lisp_Object result = Qnil; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
4907 |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
4908 CHECK_SYMBOL (attr); |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
4909 |
| 24995 | 4910 if (EQ (attr, QCweight) |
| 4911 || EQ (attr, QCslant) | |
| 4912 || EQ (attr, QCwidth)) | |
| 4913 { | |
| 4914 /* Extract permissible symbols from tables. */ | |
| 4915 struct table_entry *table; | |
| 4916 int i, dim; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
4917 |
| 24995 | 4918 if (EQ (attr, QCweight)) |
| 4919 table = weight_table, dim = DIM (weight_table); | |
| 4920 else if (EQ (attr, QCslant)) | |
| 4921 table = slant_table, dim = DIM (slant_table); | |
| 4922 else | |
| 4923 table = swidth_table, dim = DIM (swidth_table); | |
| 4924 | |
| 4925 for (i = 0; i < dim; ++i) | |
| 4926 { | |
| 4927 Lisp_Object symbol = *table[i].symbol; | |
| 4928 Lisp_Object tail = result; | |
| 4929 | |
| 4930 while (!NILP (tail) | |
| 4931 && !EQ (XCAR (tail), symbol)) | |
| 4932 tail = XCDR (tail); | |
| 4933 | |
| 4934 if (NILP (tail)) | |
| 4935 result = Fcons (symbol, result); | |
| 4936 } | |
| 4937 } | |
| 4938 else if (EQ (attr, QCunderline)) | |
| 4939 result = Fcons (Qt, Fcons (Qnil, Qnil)); | |
| 4940 else if (EQ (attr, QCoverline)) | |
| 4941 result = Fcons (Qt, Fcons (Qnil, Qnil)); | |
| 4942 else if (EQ (attr, QCstrike_through)) | |
| 4943 result = Fcons (Qt, Fcons (Qnil, Qnil)); | |
| 4944 else if (EQ (attr, QCinverse_video) || EQ (attr, QCreverse_video)) | |
| 4945 result = Fcons (Qt, Fcons (Qnil, Qnil)); | |
| 4946 | |
| 4947 return result; | |
| 4948 } | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
4949 |
| 24995 | 4950 |
| 4951 DEFUN ("internal-merge-in-global-face", Finternal_merge_in_global_face, | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
4952 Sinternal_merge_in_global_face, 2, 2, 0, |
|
40598
7f3db64c7d42
(Finternal_merge_in_global_face): Reindent.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40555
diff
changeset
|
4953 doc: /* Add attributes from frame-default definition of FACE to FACE on FRAME. |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
4954 Default face attributes override any local face attributes. */) |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
4955 (face, frame) |
| 24995 | 4956 Lisp_Object face, frame; |
| 4957 { | |
|
31483
5ef4cd475781
(default_face_vector): Function removed.
Miles Bader <miles@gnu.org>
parents:
31463
diff
changeset
|
4958 int i; |
|
5ef4cd475781
(default_face_vector): Function removed.
Miles Bader <miles@gnu.org>
parents:
31463
diff
changeset
|
4959 Lisp_Object global_lface, local_lface, *gvec, *lvec; |
|
5ef4cd475781
(default_face_vector): Function removed.
Miles Bader <miles@gnu.org>
parents:
31463
diff
changeset
|
4960 |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
4961 CHECK_LIVE_FRAME (frame); |
| 24995 | 4962 global_lface = lface_from_face_name (NULL, face, 1); |
| 4963 local_lface = lface_from_face_name (XFRAME (frame), face, 0); | |
| 4964 if (NILP (local_lface)) | |
| 4965 local_lface = Finternal_make_lisp_face (face, frame); | |
|
31483
5ef4cd475781
(default_face_vector): Function removed.
Miles Bader <miles@gnu.org>
parents:
31463
diff
changeset
|
4966 |
|
31519
5a14247e8e26
(Finternal_set_lisp_face_attribute): Minor thinko.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31518
diff
changeset
|
4967 /* Make every specified global attribute override the local one. |
|
5a14247e8e26
(Finternal_set_lisp_face_attribute): Minor thinko.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31518
diff
changeset
|
4968 BEWARE!! This is only used from `face-set-after-frame-default' where |
|
5a14247e8e26
(Finternal_set_lisp_face_attribute): Minor thinko.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31518
diff
changeset
|
4969 the local frame is defined from default specs in `face-defface-spec' |
|
5a14247e8e26
(Finternal_set_lisp_face_attribute): Minor thinko.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31518
diff
changeset
|
4970 and those should be overridden by global settings. Hence the strange |
|
5a14247e8e26
(Finternal_set_lisp_face_attribute): Minor thinko.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
31518
diff
changeset
|
4971 "global before local" priority. */ |
|
31483
5ef4cd475781
(default_face_vector): Function removed.
Miles Bader <miles@gnu.org>
parents:
31463
diff
changeset
|
4972 lvec = XVECTOR (local_lface)->contents; |
|
5ef4cd475781
(default_face_vector): Function removed.
Miles Bader <miles@gnu.org>
parents:
31463
diff
changeset
|
4973 gvec = XVECTOR (global_lface)->contents; |
|
5ef4cd475781
(default_face_vector): Function removed.
Miles Bader <miles@gnu.org>
parents:
31463
diff
changeset
|
4974 for (i = 1; i < LFACE_VECTOR_SIZE; ++i) |
|
5ef4cd475781
(default_face_vector): Function removed.
Miles Bader <miles@gnu.org>
parents:
31463
diff
changeset
|
4975 if (! UNSPECIFIEDP (gvec[i])) |
|
5ef4cd475781
(default_face_vector): Function removed.
Miles Bader <miles@gnu.org>
parents:
31463
diff
changeset
|
4976 lvec[i] = gvec[i]; |
|
31507
ac6d049932e9
(Finternal_merge_in_global_face): Return a Lisp object.
Gerd Moellmann <gerd@gnu.org>
parents:
31483
diff
changeset
|
4977 |
|
ac6d049932e9
(Finternal_merge_in_global_face): Return a Lisp object.
Gerd Moellmann <gerd@gnu.org>
parents:
31483
diff
changeset
|
4978 return Qnil; |
| 24995 | 4979 } |
| 4980 | |
| 4981 | |
| 4982 /* The following function is implemented for compatibility with 20.2. | |
| 4983 The function is used in x-resolve-fonts when it is asked to | |
| 4984 return fonts with the same size as the font of a face. This is | |
| 4985 done in fontset.el. */ | |
| 4986 | |
|
89835
4a7ac88259e1
(Fface_font): New optional arg CHARACTER.
Kenichi Handa <handa@m17n.org>
parents:
89701
diff
changeset
|
4987 DEFUN ("face-font", Fface_font, Sface_font, 1, 3, 0, |
|
40598
7f3db64c7d42
(Finternal_merge_in_global_face): Reindent.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40555
diff
changeset
|
4988 doc: /* Return the font name of face FACE, or nil if it is unspecified. |
|
89835
4a7ac88259e1
(Fface_font): New optional arg CHARACTER.
Kenichi Handa <handa@m17n.org>
parents:
89701
diff
changeset
|
4989 The font name is, by default, for ASCII characters. |
|
39914
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
4990 If the optional argument FRAME is given, report on face FACE in that frame. |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
4991 If FRAME is t, report on the defaults for face FACE (for new frames). |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
4992 The font default for a face is either nil, or a list |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
4993 of the form (bold), (italic) or (bold italic). |
|
89835
4a7ac88259e1
(Fface_font): New optional arg CHARACTER.
Kenichi Handa <handa@m17n.org>
parents:
89701
diff
changeset
|
4994 If FRAME is omitted or nil, use the selected frame. And, in this case, |
|
4a7ac88259e1
(Fface_font): New optional arg CHARACTER.
Kenichi Handa <handa@m17n.org>
parents:
89701
diff
changeset
|
4995 if the optional third argument CHARACTER is given, |
|
4a7ac88259e1
(Fface_font): New optional arg CHARACTER.
Kenichi Handa <handa@m17n.org>
parents:
89701
diff
changeset
|
4996 return the font name used for CHARACTER. */) |
|
4a7ac88259e1
(Fface_font): New optional arg CHARACTER.
Kenichi Handa <handa@m17n.org>
parents:
89701
diff
changeset
|
4997 (face, frame, character) |
|
4a7ac88259e1
(Fface_font): New optional arg CHARACTER.
Kenichi Handa <handa@m17n.org>
parents:
89701
diff
changeset
|
4998 Lisp_Object face, frame, character; |
| 24995 | 4999 { |
| 5000 if (EQ (frame, Qt)) | |
| 5001 { | |
| 5002 Lisp_Object result = Qnil; | |
| 5003 Lisp_Object lface = lface_from_face_name (NULL, face, 1); | |
| 5004 | |
| 5005 if (!UNSPECIFIEDP (LFACE_WEIGHT (lface)) | |
| 5006 && !EQ (LFACE_WEIGHT (lface), Qnormal)) | |
| 5007 result = Fcons (Qbold, result); | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
5008 |
|
40441
024f6efc3f87
(Fface_font): Use UNSPECIFIEDP instead of NILP for
Gerd Moellmann <gerd@gnu.org>
parents:
40398
diff
changeset
|
5009 if (!UNSPECIFIEDP (LFACE_SLANT (lface)) |
| 24995 | 5010 && !EQ (LFACE_SLANT (lface), Qnormal)) |
| 5011 result = Fcons (Qitalic, result); | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
5012 |
| 24995 | 5013 return result; |
| 5014 } | |
| 5015 else | |
| 5016 { | |
| 5017 struct frame *f = frame_or_selected_frame (frame, 1); | |
|
90054
f2ebccfa87d4
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-74
Miles Bader <miles@gnu.org>
diff
changeset
|
5018 int face_id = lookup_named_face (f, face, 1); |
| 24995 | 5019 struct face *face = FACE_FROM_ID (f, face_id); |
|
89835
4a7ac88259e1
(Fface_font): New optional arg CHARACTER.
Kenichi Handa <handa@m17n.org>
parents:
89701
diff
changeset
|
5020 |
|
4a7ac88259e1
(Fface_font): New optional arg CHARACTER.
Kenichi Handa <handa@m17n.org>
parents:
89701
diff
changeset
|
5021 if (! face) |
|
4a7ac88259e1
(Fface_font): New optional arg CHARACTER.
Kenichi Handa <handa@m17n.org>
parents:
89701
diff
changeset
|
5022 return Qnil; |
|
89947
62d04caf8fb9
(Fface_font): If HAVE_WINDOW_SYSTEM is not defined,
Kenichi Handa <handa@m17n.org>
parents:
89943
diff
changeset
|
5023 #ifdef HAVE_WINDOW_SYSTEM |
|
89948
e94e49dc760e
(Fface_font): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
89947
diff
changeset
|
5024 if (FRAME_WINDOW_P (f) && !NILP (character)) |
|
89947
62d04caf8fb9
(Fface_font): If HAVE_WINDOW_SYSTEM is not defined,
Kenichi Handa <handa@m17n.org>
parents:
89943
diff
changeset
|
5025 { |
|
62d04caf8fb9
(Fface_font): If HAVE_WINDOW_SYSTEM is not defined,
Kenichi Handa <handa@m17n.org>
parents:
89943
diff
changeset
|
5026 CHECK_CHARACTER (character); |
|
62d04caf8fb9
(Fface_font): If HAVE_WINDOW_SYSTEM is not defined,
Kenichi Handa <handa@m17n.org>
parents:
89943
diff
changeset
|
5027 face_id = FACE_FOR_CHAR (f, face, XINT (character), -1, Qnil); |
|
62d04caf8fb9
(Fface_font): If HAVE_WINDOW_SYSTEM is not defined,
Kenichi Handa <handa@m17n.org>
parents:
89943
diff
changeset
|
5028 face = FACE_FROM_ID (f, face_id); |
|
62d04caf8fb9
(Fface_font): If HAVE_WINDOW_SYSTEM is not defined,
Kenichi Handa <handa@m17n.org>
parents:
89943
diff
changeset
|
5029 return (face->font && face->font_name |
|
62d04caf8fb9
(Fface_font): If HAVE_WINDOW_SYSTEM is not defined,
Kenichi Handa <handa@m17n.org>
parents:
89943
diff
changeset
|
5030 ? build_string (face->font_name) |
|
62d04caf8fb9
(Fface_font): If HAVE_WINDOW_SYSTEM is not defined,
Kenichi Handa <handa@m17n.org>
parents:
89943
diff
changeset
|
5031 : Qnil); |
|
62d04caf8fb9
(Fface_font): If HAVE_WINDOW_SYSTEM is not defined,
Kenichi Handa <handa@m17n.org>
parents:
89943
diff
changeset
|
5032 } |
|
62d04caf8fb9
(Fface_font): If HAVE_WINDOW_SYSTEM is not defined,
Kenichi Handa <handa@m17n.org>
parents:
89943
diff
changeset
|
5033 #endif |
|
62d04caf8fb9
(Fface_font): If HAVE_WINDOW_SYSTEM is not defined,
Kenichi Handa <handa@m17n.org>
parents:
89943
diff
changeset
|
5034 return build_string (face->font_name); |
| 24995 | 5035 } |
| 5036 } | |
| 5037 | |
| 5038 | |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5039 /* Compare face-attribute values v1 and v2 for equality. Value is non-zero if |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5040 all attributes are `equal'. Tries to be fast because this function |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5041 is called quite often. */ |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5042 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5043 static INLINE int |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5044 face_attr_equal_p (v1, v2) |
|
56063
109c0a603543
(face_attr_equal_p): Declare parameters.
Andreas Schwab <schwab@suse.de>
parents:
55982
diff
changeset
|
5045 Lisp_Object v1, v2; |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5046 { |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5047 /* Type can differ, e.g. when one attribute is unspecified, i.e. nil, |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5048 and the other is specified. */ |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5049 if (XTYPE (v1) != XTYPE (v2)) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5050 return 0; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5051 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5052 if (EQ (v1, v2)) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5053 return 1; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5054 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5055 switch (XTYPE (v1)) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5056 { |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5057 case Lisp_String: |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5058 if (SBYTES (v1) != SBYTES (v2)) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5059 return 0; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5060 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5061 return bcmp (SDATA (v1), SDATA (v2), SBYTES (v1)) == 0; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5062 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5063 case Lisp_Int: |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5064 case Lisp_Symbol: |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5065 return 0; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5066 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5067 default: |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5068 return !NILP (Fequal (v1, v2)); |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5069 } |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5070 } |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5071 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5072 |
| 24995 | 5073 /* Compare face vectors V1 and V2 for equality. Value is non-zero if |
| 5074 all attributes are `equal'. Tries to be fast because this function | |
| 5075 is called quite often. */ | |
| 5076 | |
| 5077 static INLINE int | |
| 5078 lface_equal_p (v1, v2) | |
| 5079 Lisp_Object *v1, *v2; | |
| 5080 { | |
| 5081 int i, equal_p = 1; | |
| 5082 | |
| 5083 for (i = 1; i < LFACE_VECTOR_SIZE && equal_p; ++i) | |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5084 equal_p = face_attr_equal_p (v1[i], v2[i]); |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
5085 |
| 24995 | 5086 return equal_p; |
| 5087 } | |
| 5088 | |
| 5089 | |
| 5090 DEFUN ("internal-lisp-face-equal-p", Finternal_lisp_face_equal_p, | |
| 5091 Sinternal_lisp_face_equal_p, 2, 3, 0, | |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
5092 doc: /* True if FACE1 and FACE2 are equal. |
|
39914
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
5093 If the optional argument FRAME is given, report on face FACE in that frame. |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
5094 If FRAME is t, report on the defaults for face FACE (for new frames). |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
5095 If FRAME is omitted or nil, use the selected frame. */) |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
5096 (face1, face2, frame) |
| 24995 | 5097 Lisp_Object face1, face2, frame; |
| 5098 { | |
| 5099 int equal_p; | |
| 5100 Lisp_Object lface1, lface2; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
5101 |
| 24995 | 5102 lface1 = lface_from_face_name (NULL, face1, 1); |
| 5103 lface2 = lface_from_face_name (NULL, face2, 1); | |
| 5104 equal_p = lface_equal_p (XVECTOR (lface1)->contents, | |
| 5105 XVECTOR (lface2)->contents); | |
| 5106 return equal_p ? Qt : Qnil; | |
| 5107 } | |
| 5108 | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
5109 |
| 24995 | 5110 DEFUN ("internal-lisp-face-empty-p", Finternal_lisp_face_empty_p, |
| 5111 Sinternal_lisp_face_empty_p, 1, 2, 0, | |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
5112 doc: /* True if FACE has no attribute specified. |
|
39914
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
5113 If the optional argument FRAME is given, report on face FACE in that frame. |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
5114 If FRAME is t, report on the defaults for face FACE (for new frames). |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
5115 If FRAME is omitted or nil, use the selected frame. */) |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
5116 (face, frame) |
| 24995 | 5117 Lisp_Object face, frame; |
| 5118 { | |
| 5119 struct frame *f; | |
| 5120 Lisp_Object lface; | |
| 5121 int i; | |
| 5122 | |
| 5123 if (NILP (frame)) | |
|
25678
1878f7ae0df5
(frame_or_selected_frame): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25661
diff
changeset
|
5124 frame = selected_frame; |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
5125 CHECK_LIVE_FRAME (frame); |
|
25678
1878f7ae0df5
(frame_or_selected_frame): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25661
diff
changeset
|
5126 f = XFRAME (frame); |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
5127 |
| 24995 | 5128 if (EQ (frame, Qt)) |
| 5129 lface = lface_from_face_name (NULL, face, 1); | |
| 5130 else | |
| 5131 lface = lface_from_face_name (f, face, 1); | |
| 5132 | |
| 5133 for (i = 1; i < LFACE_VECTOR_SIZE; ++i) | |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
5134 if (!UNSPECIFIEDP (AREF (lface, i))) |
| 24995 | 5135 break; |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
5136 |
| 24995 | 5137 return i == LFACE_VECTOR_SIZE ? Qt : Qnil; |
| 5138 } | |
| 5139 | |
| 5140 | |
| 5141 DEFUN ("frame-face-alist", Fframe_face_alist, Sframe_face_alist, | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
5142 0, 1, 0, |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
5143 doc: /* Return an alist of frame-local faces defined on FRAME. |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
5144 For internal use only. */) |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
5145 (frame) |
| 24995 | 5146 Lisp_Object frame; |
| 5147 { | |
| 5148 struct frame *f = frame_or_selected_frame (frame, 0); | |
| 5149 return f->face_alist; | |
| 5150 } | |
| 5151 | |
| 5152 | |
| 5153 /* Return a hash code for Lisp string STRING with case ignored. Used | |
| 5154 below in computing a hash value for a Lisp face. */ | |
| 5155 | |
| 5156 static INLINE unsigned | |
| 5157 hash_string_case_insensitive (string) | |
| 5158 Lisp_Object string; | |
| 5159 { | |
|
46556
71e205b50a3e
(may_use_scalable_font_p): Argument now points to
Ken Raeburn <raeburn@raeburn.org>
parents:
46478
diff
changeset
|
5160 const unsigned char *s; |
| 24995 | 5161 unsigned hash = 0; |
| 5162 xassert (STRINGP (string)); | |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
5163 for (s = SDATA (string); *s; ++s) |
| 24995 | 5164 hash = (hash << 1) ^ tolower (*s); |
| 5165 return hash; | |
| 5166 } | |
| 5167 | |
| 5168 | |
| 5169 /* Return a hash code for face attribute vector V. */ | |
| 5170 | |
| 5171 static INLINE unsigned | |
| 5172 lface_hash (v) | |
| 5173 Lisp_Object *v; | |
| 5174 { | |
| 5175 return (hash_string_case_insensitive (v[LFACE_FAMILY_INDEX]) | |
| 5176 ^ hash_string_case_insensitive (v[LFACE_FOREGROUND_INDEX]) | |
| 5177 ^ hash_string_case_insensitive (v[LFACE_BACKGROUND_INDEX]) | |
|
28464
cad4cc0508a0
Fix Lisp_Object/int type confusion revealed by making Lisp_Object a union type:
Ken Raeburn <raeburn@raeburn.org>
parents:
28461
diff
changeset
|
5178 ^ XFASTINT (v[LFACE_WEIGHT_INDEX]) |
|
cad4cc0508a0
Fix Lisp_Object/int type confusion revealed by making Lisp_Object a union type:
Ken Raeburn <raeburn@raeburn.org>
parents:
28461
diff
changeset
|
5179 ^ XFASTINT (v[LFACE_SLANT_INDEX]) |
|
cad4cc0508a0
Fix Lisp_Object/int type confusion revealed by making Lisp_Object a union type:
Ken Raeburn <raeburn@raeburn.org>
parents:
28461
diff
changeset
|
5180 ^ XFASTINT (v[LFACE_SWIDTH_INDEX]) |
| 24995 | 5181 ^ XFASTINT (v[LFACE_HEIGHT_INDEX])); |
| 5182 } | |
| 5183 | |
| 5184 | |
| 5185 /* Return non-zero if LFACE1 and LFACE2 specify the same font (without | |
| 5186 considering charsets/registries). They do if they specify the same | |
|
89047
3b6234eb229c
(QCfontset): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88939
diff
changeset
|
5187 family, point size, weight, width, slant, font, and fontset. Both |
|
3b6234eb229c
(QCfontset): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88939
diff
changeset
|
5188 LFACE1 and LFACE2 must be fully-specified. */ |
| 24995 | 5189 |
| 5190 static INLINE int | |
| 5191 lface_same_font_attributes_p (lface1, lface2) | |
| 5192 Lisp_Object *lface1, *lface2; | |
| 5193 { | |
| 5194 xassert (lface_fully_specified_p (lface1) | |
| 5195 && lface_fully_specified_p (lface2)); | |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
5196 return (xstricmp (SDATA (lface1[LFACE_FAMILY_INDEX]), |
|
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
5197 SDATA (lface2[LFACE_FAMILY_INDEX])) == 0 |
| 31178 | 5198 && EQ (lface1[LFACE_HEIGHT_INDEX], lface2[LFACE_HEIGHT_INDEX]) |
| 24995 | 5199 && EQ (lface1[LFACE_SWIDTH_INDEX], lface2[LFACE_SWIDTH_INDEX]) |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
5200 && EQ (lface1[LFACE_AVGWIDTH_INDEX], lface2[LFACE_AVGWIDTH_INDEX]) |
| 24995 | 5201 && EQ (lface1[LFACE_WEIGHT_INDEX], lface2[LFACE_WEIGHT_INDEX]) |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5202 && EQ (lface1[LFACE_SLANT_INDEX], lface2[LFACE_SLANT_INDEX]) |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5203 && (EQ (lface1[LFACE_FONT_INDEX], lface2[LFACE_FONT_INDEX]) |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5204 || (STRINGP (lface1[LFACE_FONT_INDEX]) |
|
28263
73181b84ea57
(lface_same_font_attributes_p): Compare font attributes
Gerd Moellmann <gerd@gnu.org>
parents:
28237
diff
changeset
|
5205 && STRINGP (lface2[LFACE_FONT_INDEX]) |
| 89483 | 5206 && ! xstricmp (SDATA (lface1[LFACE_FONT_INDEX]), |
| 5207 SDATA (lface2[LFACE_FONT_INDEX])))) | |
|
89047
3b6234eb229c
(QCfontset): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88939
diff
changeset
|
5208 && (EQ (lface1[LFACE_FONTSET_INDEX], lface2[LFACE_FONTSET_INDEX]) |
|
3b6234eb229c
(QCfontset): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88939
diff
changeset
|
5209 || (STRINGP (lface1[LFACE_FONTSET_INDEX]) |
|
3b6234eb229c
(QCfontset): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88939
diff
changeset
|
5210 && STRINGP (lface2[LFACE_FONTSET_INDEX]) |
| 89483 | 5211 && ! xstricmp (SDATA (lface1[LFACE_FONTSET_INDEX]), |
| 5212 SDATA (lface2[LFACE_FONTSET_INDEX])))) | |
|
89047
3b6234eb229c
(QCfontset): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88939
diff
changeset
|
5213 ); |
| 24995 | 5214 } |
| 5215 | |
| 5216 | |
| 5217 | |
| 5218 /*********************************************************************** | |
| 5219 Realized Faces | |
| 5220 ***********************************************************************/ | |
| 5221 | |
| 5222 /* Allocate and return a new realized face for Lisp face attribute | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5223 vector ATTR. */ |
| 24995 | 5224 |
| 5225 static struct face * | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5226 make_realized_face (attr) |
| 24995 | 5227 Lisp_Object *attr; |
| 5228 { | |
| 5229 struct face *face = (struct face *) xmalloc (sizeof *face); | |
| 5230 bzero (face, sizeof *face); | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5231 face->ascii_face = face; |
| 24995 | 5232 bcopy (attr, face->lface, sizeof face->lface); |
| 5233 return face; | |
| 5234 } | |
| 5235 | |
| 5236 | |
| 5237 /* Free realized face FACE, including its X resources. FACE may | |
| 5238 be null. */ | |
| 5239 | |
|
88394
b954eee715da
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
43270
diff
changeset
|
5240 void |
| 24995 | 5241 free_realized_face (f, face) |
| 5242 struct frame *f; | |
| 5243 struct face *face; | |
| 5244 { | |
| 5245 if (face) | |
| 5246 { | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
5247 #ifdef HAVE_WINDOW_SYSTEM |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
5248 if (FRAME_WINDOW_P (f)) |
| 24995 | 5249 { |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5250 /* Free fontset of FACE if it is ASCII face. */ |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5251 if (face->fontset >= 0 && face == face->ascii_face) |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5252 free_face_fontset (f, face); |
| 24995 | 5253 if (face->gc) |
| 5254 { | |
| 5255 x_free_gc (f, face->gc); | |
| 5256 face->gc = 0; | |
| 5257 } | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
5258 |
| 24995 | 5259 free_face_colors (f, face); |
| 5260 x_destroy_bitmap (f, face->stipple); | |
| 5261 } | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
5262 #endif /* HAVE_WINDOW_SYSTEM */ |
| 24995 | 5263 |
| 5264 xfree (face); | |
| 5265 } | |
| 5266 } | |
| 5267 | |
| 5268 | |
| 5269 /* Prepare face FACE for subsequent display on frame F. This | |
| 5270 allocated GCs if they haven't been allocated yet or have been freed | |
| 5271 by clearing the face cache. */ | |
| 5272 | |
| 5273 void | |
| 5274 prepare_face_for_display (f, face) | |
| 5275 struct frame *f; | |
| 5276 struct face *face; | |
| 5277 { | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
5278 #ifdef HAVE_WINDOW_SYSTEM |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
5279 xassert (FRAME_WINDOW_P (f)); |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
5280 |
| 24995 | 5281 if (face->gc == 0) |
| 5282 { | |
| 5283 XGCValues xgcv; | |
| 5284 unsigned long mask = GCForeground | GCBackground | GCGraphicsExposures; | |
| 5285 | |
| 5286 xgcv.foreground = face->foreground; | |
| 5287 xgcv.background = face->background; | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
5288 #ifdef HAVE_X_WINDOWS |
| 24995 | 5289 xgcv.graphics_exposures = False; |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
5290 #endif |
| 24995 | 5291 /* The font of FACE may be null if we couldn't load it. */ |
| 5292 if (face->font) | |
| 5293 { | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
5294 #ifdef HAVE_X_WINDOWS |
| 24995 | 5295 xgcv.font = face->font->fid; |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
5296 #endif |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
5297 #ifdef WINDOWSNT |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
5298 xgcv.font = face->font; |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
5299 #endif |
|
44890
01b93e5e53a7
Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog,
Andrew Choi <akochoi@shaw.ca>
parents:
44705
diff
changeset
|
5300 #ifdef MAC_OS |
|
32752
923b8d6d8277
Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
32176
diff
changeset
|
5301 xgcv.font = face->font; |
|
923b8d6d8277
Initial check-in: changes for building Emacs under Mac OS.
Andrew Choi <akochoi@shaw.ca>
parents:
32176
diff
changeset
|
5302 #endif |
| 24995 | 5303 mask |= GCFont; |
| 5304 } | |
| 5305 | |
| 5306 BLOCK_INPUT; | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
5307 #ifdef HAVE_X_WINDOWS |
| 24995 | 5308 if (face->stipple) |
| 5309 { | |
|
25092
79a5a567bdb0
(prepare_face_for_display): Use FillOpaqueStippled instead of
Gerd Moellmann <gerd@gnu.org>
parents:
25062
diff
changeset
|
5310 xgcv.fill_style = FillOpaqueStippled; |
| 24995 | 5311 xgcv.stipple = x_bitmap_pixmap (f, face->stipple); |
| 5312 mask |= GCFillStyle | GCStipple; | |
| 5313 } | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
5314 #endif |
| 24995 | 5315 face->gc = x_create_gc (f, mask, &xgcv); |
| 5316 UNBLOCK_INPUT; | |
| 5317 } | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
5318 #endif /* HAVE_WINDOW_SYSTEM */ |
| 24995 | 5319 } |
| 5320 | |
| 5321 | |
|
45718
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5322 /* Returns the `distance' between the colors X and Y. */ |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5323 |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5324 static int |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5325 color_distance (x, y) |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5326 XColor *x, *y; |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5327 { |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5328 /* This formula is from a paper title `Colour metric' by Thiadmer Riemersma. |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5329 Quoting from that paper: |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5330 |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5331 This formula has results that are very close to L*u*v* (with the |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5332 modified lightness curve) and, more importantly, it is a more even |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5333 algorithm: it does not have a range of colours where it suddenly |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5334 gives far from optimal results. |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5335 |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5336 See <http://www.compuphase.com/cmetric.htm> for more info. */ |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5337 |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5338 long r = (x->red - y->red) >> 8; |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5339 long g = (x->green - y->green) >> 8; |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5340 long b = (x->blue - y->blue) >> 8; |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5341 long r_mean = (x->red + y->red) >> 9; |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5342 |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5343 return |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5344 (((512 + r_mean) * r * r) >> 8) |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5345 + 4 * g * g |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5346 + (((767 - r_mean) * b * b) >> 8); |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5347 } |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5348 |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5349 |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5350 DEFUN ("color-distance", Fcolor_distance, Scolor_distance, 2, 3, 0, |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5351 doc: /* Return an integer distance between COLOR1 and COLOR2 on FRAME. |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5352 COLOR1 and COLOR2 may be either strings containing the color name, |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5353 or lists of the form (RED GREEN BLUE). |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5354 If FRAME is unspecified or nil, the current frame is used. */) |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5355 (color1, color2, frame) |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5356 Lisp_Object color1, color2, frame; |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5357 { |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5358 struct frame *f; |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5359 XColor cdef1, cdef2; |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5360 |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5361 if (NILP (frame)) |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5362 frame = selected_frame; |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5363 CHECK_LIVE_FRAME (frame); |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5364 f = XFRAME (frame); |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5365 |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5366 if ((CONSP (color1) && !parse_rgb_list (color1, &cdef1)) |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5367 || !STRINGP (color1) |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
5368 || !defined_color (f, SDATA (color1), &cdef1, 0)) |
|
45718
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5369 signal_error ("Invalid color", color1); |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5370 if ((CONSP (color2) && !parse_rgb_list (color2, &cdef2)) |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5371 || !STRINGP (color2) |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
5372 || !defined_color (f, SDATA (color2), &cdef2, 0)) |
|
45718
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5373 signal_error ("Invalid color", color2); |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5374 |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5375 return make_number (color_distance (&cdef1, &cdef2)); |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5376 } |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5377 |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5378 |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
5379 /*********************************************************************** |
| 24995 | 5380 Face Cache |
| 5381 ***********************************************************************/ | |
| 5382 | |
| 5383 /* Return a new face cache for frame F. */ | |
| 5384 | |
| 5385 static struct face_cache * | |
| 5386 make_face_cache (f) | |
|
8472
0d0b32e78a5b
(compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
8119
diff
changeset
|
5387 struct frame *f; |
| 24995 | 5388 { |
| 5389 struct face_cache *c; | |
| 5390 int size; | |
| 5391 | |
| 5392 c = (struct face_cache *) xmalloc (sizeof *c); | |
| 5393 bzero (c, sizeof *c); | |
| 5394 size = FACE_CACHE_BUCKETS_SIZE * sizeof *c->buckets; | |
| 5395 c->buckets = (struct face **) xmalloc (size); | |
| 5396 bzero (c->buckets, size); | |
| 5397 c->size = 50; | |
| 5398 c->faces_by_id = (struct face **) xmalloc (c->size * sizeof *c->faces_by_id); | |
| 5399 c->f = f; | |
|
38905
70ef1eb656a6
(menu_face_changed_default): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38818
diff
changeset
|
5400 c->menu_face_changed_p = menu_face_changed_default; |
| 24995 | 5401 return c; |
| 5402 } | |
| 5403 | |
| 5404 | |
| 5405 /* Clear out all graphics contexts for all realized faces, except for | |
| 5406 the basic faces. This should be done from time to time just to avoid | |
| 5407 keeping too many graphics contexts that are no longer needed. */ | |
| 5408 | |
| 5409 static void | |
| 5410 clear_face_gcs (c) | |
| 5411 struct face_cache *c; | |
| 5412 { | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
5413 if (c && FRAME_WINDOW_P (c->f)) |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
5414 { |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
5415 #ifdef HAVE_WINDOW_SYSTEM |
| 24995 | 5416 int i; |
| 5417 for (i = BASIC_FACE_ID_SENTINEL; i < c->used; ++i) | |
| 5418 { | |
| 5419 struct face *face = c->faces_by_id[i]; | |
| 5420 if (face && face->gc) | |
| 5421 { | |
| 5422 x_free_gc (c->f, face->gc); | |
| 5423 face->gc = 0; | |
| 5424 } | |
| 5425 } | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
5426 #endif /* HAVE_WINDOW_SYSTEM */ |
| 24995 | 5427 } |
| 5428 } | |
| 5429 | |
| 5430 | |
|
55560
f262795a9004
(Ftty_supports_face_attributes_p, Finternal_copy_lisp_face): Fix typo in
Juanma Barranquero <lekktu@gmail.com>
parents:
55142
diff
changeset
|
5431 /* Free all realized faces in face cache C, including basic faces. |
|
f262795a9004
(Ftty_supports_face_attributes_p, Finternal_copy_lisp_face): Fix typo in
Juanma Barranquero <lekktu@gmail.com>
parents:
55142
diff
changeset
|
5432 C may be null. If faces are freed, make sure the frame's current |
| 24995 | 5433 matrix is marked invalid, so that a display caused by an expose |
| 5434 event doesn't try to use faces we destroyed. */ | |
| 5435 | |
| 5436 static void | |
| 5437 free_realized_faces (c) | |
| 5438 struct face_cache *c; | |
|
8472
0d0b32e78a5b
(compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
8119
diff
changeset
|
5439 { |
| 24995 | 5440 if (c && c->used) |
| 5441 { | |
| 5442 int i, size; | |
| 5443 struct frame *f = c->f; | |
| 5444 | |
|
29284
d458dee20518
(free_realized_faces): Block/unblock input.
Gerd Moellmann <gerd@gnu.org>
parents:
28753
diff
changeset
|
5445 /* We must block input here because we can't process X events |
|
d458dee20518
(free_realized_faces): Block/unblock input.
Gerd Moellmann <gerd@gnu.org>
parents:
28753
diff
changeset
|
5446 safely while only some faces are freed, or when the frame's |
|
d458dee20518
(free_realized_faces): Block/unblock input.
Gerd Moellmann <gerd@gnu.org>
parents:
28753
diff
changeset
|
5447 current matrix still references freed faces. */ |
|
d458dee20518
(free_realized_faces): Block/unblock input.
Gerd Moellmann <gerd@gnu.org>
parents:
28753
diff
changeset
|
5448 BLOCK_INPUT; |
|
d458dee20518
(free_realized_faces): Block/unblock input.
Gerd Moellmann <gerd@gnu.org>
parents:
28753
diff
changeset
|
5449 |
| 24995 | 5450 for (i = 0; i < c->used; ++i) |
| 5451 { | |
| 5452 free_realized_face (f, c->faces_by_id[i]); | |
| 5453 c->faces_by_id[i] = NULL; | |
| 5454 } | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
5455 |
| 24995 | 5456 c->used = 0; |
| 5457 size = FACE_CACHE_BUCKETS_SIZE * sizeof *c->buckets; | |
| 5458 bzero (c->buckets, size); | |
| 5459 | |
| 5460 /* Must do a thorough redisplay the next time. Mark current | |
| 5461 matrices as invalid because they will reference faces freed | |
| 5462 above. This function is also called when a frame is | |
| 5463 destroyed. In this case, the root window of F is nil. */ | |
| 5464 if (WINDOWP (f->root_window)) | |
| 5465 { | |
| 5466 clear_current_matrices (f); | |
| 5467 ++windows_or_buffers_changed; | |
| 5468 } | |
|
29284
d458dee20518
(free_realized_faces): Block/unblock input.
Gerd Moellmann <gerd@gnu.org>
parents:
28753
diff
changeset
|
5469 |
|
d458dee20518
(free_realized_faces): Block/unblock input.
Gerd Moellmann <gerd@gnu.org>
parents:
28753
diff
changeset
|
5470 UNBLOCK_INPUT; |
| 24995 | 5471 } |
| 5472 } | |
| 5473 | |
| 5474 | |
|
88394
b954eee715da
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
43270
diff
changeset
|
5475 /* Free all realized faces that are using FONTSET on frame F. */ |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5476 |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5477 void |
|
88394
b954eee715da
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
43270
diff
changeset
|
5478 free_realized_faces_for_fontset (f, fontset) |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5479 struct frame *f; |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5480 int fontset; |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5481 { |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5482 struct face_cache *cache = FRAME_FACE_CACHE (f); |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5483 struct face *face; |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5484 int i; |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5485 |
|
29284
d458dee20518
(free_realized_faces): Block/unblock input.
Gerd Moellmann <gerd@gnu.org>
parents:
28753
diff
changeset
|
5486 /* We must block input here because we can't process X events safely |
|
d458dee20518
(free_realized_faces): Block/unblock input.
Gerd Moellmann <gerd@gnu.org>
parents:
28753
diff
changeset
|
5487 while only some faces are freed, or when the frame's current |
|
d458dee20518
(free_realized_faces): Block/unblock input.
Gerd Moellmann <gerd@gnu.org>
parents:
28753
diff
changeset
|
5488 matrix still references freed faces. */ |
|
d458dee20518
(free_realized_faces): Block/unblock input.
Gerd Moellmann <gerd@gnu.org>
parents:
28753
diff
changeset
|
5489 BLOCK_INPUT; |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
5490 |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5491 for (i = 0; i < cache->used; i++) |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5492 { |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5493 face = cache->faces_by_id[i]; |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5494 if (face |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5495 && face->fontset == fontset) |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5496 { |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5497 uncache_face (cache, face); |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5498 free_realized_face (f, face); |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5499 } |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5500 } |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
5501 |
|
29284
d458dee20518
(free_realized_faces): Block/unblock input.
Gerd Moellmann <gerd@gnu.org>
parents:
28753
diff
changeset
|
5502 /* Must do a thorough redisplay the next time. Mark current |
|
d458dee20518
(free_realized_faces): Block/unblock input.
Gerd Moellmann <gerd@gnu.org>
parents:
28753
diff
changeset
|
5503 matrices as invalid because they will reference faces freed |
|
d458dee20518
(free_realized_faces): Block/unblock input.
Gerd Moellmann <gerd@gnu.org>
parents:
28753
diff
changeset
|
5504 above. This function is also called when a frame is destroyed. |
|
d458dee20518
(free_realized_faces): Block/unblock input.
Gerd Moellmann <gerd@gnu.org>
parents:
28753
diff
changeset
|
5505 In this case, the root window of F is nil. */ |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5506 if (WINDOWP (f->root_window)) |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5507 { |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5508 clear_current_matrices (f); |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5509 ++windows_or_buffers_changed; |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5510 } |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
5511 |
|
29284
d458dee20518
(free_realized_faces): Block/unblock input.
Gerd Moellmann <gerd@gnu.org>
parents:
28753
diff
changeset
|
5512 UNBLOCK_INPUT; |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5513 } |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5514 |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5515 |
| 24995 | 5516 /* Free all realized faces on FRAME or on all frames if FRAME is nil. |
| 5517 This is done after attributes of a named face have been changed, | |
| 5518 because we can't tell which realized faces depend on that face. */ | |
| 5519 | |
| 5520 void | |
| 5521 free_all_realized_faces (frame) | |
| 5522 Lisp_Object frame; | |
| 5523 { | |
| 5524 if (NILP (frame)) | |
|
8472
0d0b32e78a5b
(compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
8119
diff
changeset
|
5525 { |
| 24995 | 5526 Lisp_Object rest; |
| 5527 FOR_EACH_FRAME (rest, frame) | |
| 5528 free_realized_faces (FRAME_FACE_CACHE (XFRAME (frame))); | |
| 5529 } | |
| 5530 else | |
| 5531 free_realized_faces (FRAME_FACE_CACHE (XFRAME (frame))); | |
| 5532 } | |
| 5533 | |
| 5534 | |
| 5535 /* Free face cache C and faces in it, including their X resources. */ | |
| 5536 | |
| 5537 static void | |
| 5538 free_face_cache (c) | |
| 5539 struct face_cache *c; | |
| 5540 { | |
| 5541 if (c) | |
| 5542 { | |
| 5543 free_realized_faces (c); | |
| 5544 xfree (c->buckets); | |
| 5545 xfree (c->faces_by_id); | |
| 5546 xfree (c); | |
| 5547 } | |
| 5548 } | |
| 5549 | |
| 5550 | |
| 5551 /* Cache realized face FACE in face cache C. HASH is the hash value | |
| 88907 | 5552 of FACE. If FACE is for ASCII characters (i.e. FACE->ascii_face == |
| 5553 FACE), insert the new face to the beginning of the collision list | |
| 5554 of the face hash table of C. Otherwise, add the new face to the | |
| 5555 end of the collision list. This way, lookup_face can quickly find | |
| 5556 that a requested face is not cached. */ | |
| 24995 | 5557 |
| 5558 static void | |
| 5559 cache_face (c, face, hash) | |
| 5560 struct face_cache *c; | |
| 5561 struct face *face; | |
| 5562 unsigned hash; | |
| 5563 { | |
| 5564 int i = hash % FACE_CACHE_BUCKETS_SIZE; | |
| 5565 | |
| 5566 face->hash = hash; | |
| 5567 | |
| 88907 | 5568 if (face->ascii_face != face) |
| 24995 | 5569 { |
| 5570 struct face *last = c->buckets[i]; | |
| 5571 if (last) | |
| 5572 { | |
| 5573 while (last->next) | |
| 5574 last = last->next; | |
| 5575 last->next = face; | |
| 5576 face->prev = last; | |
| 5577 face->next = NULL; | |
| 5578 } | |
| 5579 else | |
| 5580 { | |
| 5581 c->buckets[i] = face; | |
| 5582 face->prev = face->next = NULL; | |
| 5583 } | |
| 5584 } | |
| 5585 else | |
| 5586 { | |
| 5587 face->prev = NULL; | |
| 5588 face->next = c->buckets[i]; | |
| 5589 if (face->next) | |
| 5590 face->next->prev = face; | |
| 5591 c->buckets[i] = face; | |
|
8472
0d0b32e78a5b
(compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
8119
diff
changeset
|
5592 } |
|
0d0b32e78a5b
(compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
8119
diff
changeset
|
5593 |
| 24995 | 5594 /* Find a free slot in C->faces_by_id and use the index of the free |
| 5595 slot as FACE->id. */ | |
| 5596 for (i = 0; i < c->used; ++i) | |
| 5597 if (c->faces_by_id[i] == NULL) | |
| 5598 break; | |
| 5599 face->id = i; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
5600 |
| 24995 | 5601 /* Maybe enlarge C->faces_by_id. */ |
|
53334
0432020d46a7
(cache_face): Abort if c->size exceeds MAX_FACE_ID.
Kim F. Storm <storm@cua.dk>
parents:
53274
diff
changeset
|
5602 if (i == c->used) |
|
0432020d46a7
(cache_face): Abort if c->size exceeds MAX_FACE_ID.
Kim F. Storm <storm@cua.dk>
parents:
53274
diff
changeset
|
5603 { |
|
0432020d46a7
(cache_face): Abort if c->size exceeds MAX_FACE_ID.
Kim F. Storm <storm@cua.dk>
parents:
53274
diff
changeset
|
5604 if (c->used == c->size) |
|
0432020d46a7
(cache_face): Abort if c->size exceeds MAX_FACE_ID.
Kim F. Storm <storm@cua.dk>
parents:
53274
diff
changeset
|
5605 { |
|
0432020d46a7
(cache_face): Abort if c->size exceeds MAX_FACE_ID.
Kim F. Storm <storm@cua.dk>
parents:
53274
diff
changeset
|
5606 int new_size, sz; |
|
0432020d46a7
(cache_face): Abort if c->size exceeds MAX_FACE_ID.
Kim F. Storm <storm@cua.dk>
parents:
53274
diff
changeset
|
5607 new_size = min (2 * c->size, MAX_FACE_ID); |
|
0432020d46a7
(cache_face): Abort if c->size exceeds MAX_FACE_ID.
Kim F. Storm <storm@cua.dk>
parents:
53274
diff
changeset
|
5608 if (new_size == c->size) |
|
0432020d46a7
(cache_face): Abort if c->size exceeds MAX_FACE_ID.
Kim F. Storm <storm@cua.dk>
parents:
53274
diff
changeset
|
5609 abort (); /* Alternatives? ++kfs */ |
|
0432020d46a7
(cache_face): Abort if c->size exceeds MAX_FACE_ID.
Kim F. Storm <storm@cua.dk>
parents:
53274
diff
changeset
|
5610 sz = new_size * sizeof *c->faces_by_id; |
|
0432020d46a7
(cache_face): Abort if c->size exceeds MAX_FACE_ID.
Kim F. Storm <storm@cua.dk>
parents:
53274
diff
changeset
|
5611 c->faces_by_id = (struct face **) xrealloc (c->faces_by_id, sz); |
|
0432020d46a7
(cache_face): Abort if c->size exceeds MAX_FACE_ID.
Kim F. Storm <storm@cua.dk>
parents:
53274
diff
changeset
|
5612 c->size = new_size; |
|
0432020d46a7
(cache_face): Abort if c->size exceeds MAX_FACE_ID.
Kim F. Storm <storm@cua.dk>
parents:
53274
diff
changeset
|
5613 } |
|
0432020d46a7
(cache_face): Abort if c->size exceeds MAX_FACE_ID.
Kim F. Storm <storm@cua.dk>
parents:
53274
diff
changeset
|
5614 c->used++; |
| 24995 | 5615 } |
| 5616 | |
| 5617 #if GLYPH_DEBUG | |
| 5618 /* Check that FACE got a unique id. */ | |
| 5619 { | |
| 5620 int j, n; | |
| 5621 struct face *face; | |
| 5622 | |
| 5623 for (j = n = 0; j < FACE_CACHE_BUCKETS_SIZE; ++j) | |
| 5624 for (face = c->buckets[j]; face; face = face->next) | |
| 5625 if (face->id == i) | |
| 5626 ++n; | |
| 5627 | |
| 5628 xassert (n == 1); | |
| 5629 } | |
| 5630 #endif /* GLYPH_DEBUG */ | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
5631 |
| 24995 | 5632 c->faces_by_id[i] = face; |
| 5633 } | |
| 5634 | |
| 5635 | |
| 5636 /* Remove face FACE from cache C. */ | |
| 5637 | |
| 5638 static void | |
| 5639 uncache_face (c, face) | |
| 5640 struct face_cache *c; | |
| 5641 struct face *face; | |
| 5642 { | |
| 5643 int i = face->hash % FACE_CACHE_BUCKETS_SIZE; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
5644 |
| 24995 | 5645 if (face->prev) |
| 5646 face->prev->next = face->next; | |
| 5647 else | |
| 5648 c->buckets[i] = face->next; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
5649 |
| 24995 | 5650 if (face->next) |
| 5651 face->next->prev = face->prev; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
5652 |
| 24995 | 5653 c->faces_by_id[face->id] = NULL; |
| 5654 if (face->id == c->used) | |
| 5655 --c->used; | |
| 5656 } | |
| 5657 | |
| 5658 | |
| 5659 /* Look up a realized face with face attributes ATTR in the face cache | |
| 88907 | 5660 of frame F. The face will be used to display ASCII characters. |
| 5661 Value is the ID of the face found. If no suitable face is found, | |
| 5662 realize a new one. */ | |
| 24995 | 5663 |
| 5664 INLINE int | |
| 88907 | 5665 lookup_face (f, attr) |
| 24995 | 5666 struct frame *f; |
| 5667 Lisp_Object *attr; | |
| 5668 { | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5669 struct face_cache *cache = FRAME_FACE_CACHE (f); |
| 24995 | 5670 unsigned hash; |
| 5671 int i; | |
| 5672 struct face *face; | |
| 5673 | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5674 xassert (cache != NULL); |
| 24995 | 5675 check_lface_attrs (attr); |
| 5676 | |
| 5677 /* Look up ATTR in the face cache. */ | |
| 5678 hash = lface_hash (attr); | |
| 5679 i = hash % FACE_CACHE_BUCKETS_SIZE; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
5680 |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5681 for (face = cache->buckets[i]; face; face = face->next) |
| 88907 | 5682 { |
| 5683 if (face->ascii_face != face) | |
| 5684 { | |
| 5685 /* There's no more ASCII face. */ | |
| 5686 face = NULL; | |
| 5687 break; | |
| 5688 } | |
| 5689 if (face->hash == hash | |
| 5690 && lface_equal_p (face->lface, attr)) | |
| 5691 break; | |
| 5692 } | |
| 24995 | 5693 |
| 5694 /* If not found, realize a new face. */ | |
| 5695 if (face == NULL) | |
| 88907 | 5696 face = realize_face (cache, attr, -1); |
| 24995 | 5697 |
| 5698 #if GLYPH_DEBUG | |
| 5699 xassert (face == FACE_FROM_ID (f, face->id)); | |
| 5700 #endif /* GLYPH_DEBUG */ | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
5701 |
| 24995 | 5702 return face->id; |
|
8472
0d0b32e78a5b
(compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
8119
diff
changeset
|
5703 } |
| 24995 | 5704 |
|
89950
ad8c5c667a14
(split_font_name_into_vector, build_font_name_from_vector)
Kenichi Handa <handa@m17n.org>
parents:
89948
diff
changeset
|
5705 #ifdef HAVE_WINDOW_SYSTEM |
| 88907 | 5706 /* Look up a realized face that has the same attributes as BASE_FACE |
| 5707 except for the font in the face cache of frame F. If FONT_ID is | |
| 5708 not negative, it is an ID number of an already opened font that is | |
| 5709 used by the face. If FONT_ID is negative, the face has no font. | |
| 5710 Value is the ID of the face found. If no suitable face is found, | |
| 5711 realize a new one. */ | |
| 24995 | 5712 |
| 5713 int | |
| 88907 | 5714 lookup_non_ascii_face (f, font_id, base_face) |
| 5715 struct frame *f; | |
| 5716 int font_id; | |
| 5717 struct face *base_face; | |
| 5718 { | |
| 5719 struct face_cache *cache = FRAME_FACE_CACHE (f); | |
| 5720 unsigned hash; | |
| 5721 int i; | |
| 5722 struct face *face; | |
| 5723 | |
| 5724 xassert (cache != NULL); | |
| 5725 base_face = base_face->ascii_face; | |
| 5726 hash = lface_hash (base_face->lface); | |
| 5727 i = hash % FACE_CACHE_BUCKETS_SIZE; | |
| 5728 | |
| 5729 for (face = cache->buckets[i]; face; face = face->next) | |
| 5730 { | |
| 5731 if (face->ascii_face == face) | |
| 5732 continue; | |
| 5733 if (face->ascii_face == base_face | |
| 5734 && face->font_info_id == font_id) | |
| 5735 break; | |
| 5736 } | |
| 5737 | |
| 5738 /* If not found, realize a new face. */ | |
| 5739 if (face == NULL) | |
| 5740 face = realize_non_ascii_face (f, font_id, base_face); | |
| 5741 | |
| 5742 #if GLYPH_DEBUG | |
| 5743 xassert (face == FACE_FROM_ID (f, face->id)); | |
| 24995 | 5744 #endif /* GLYPH_DEBUG */ |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
5745 |
| 24995 | 5746 return face->id; |
|
8472
0d0b32e78a5b
(compute_glyph_face_1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
8119
diff
changeset
|
5747 } |
|
89950
ad8c5c667a14
(split_font_name_into_vector, build_font_name_from_vector)
Kenichi Handa <handa@m17n.org>
parents:
89948
diff
changeset
|
5748 #endif /* HAVE_WINDOW_SYSTEM */ |
| 24995 | 5749 |
| 5750 /* Return the face id of the realized face for named face SYMBOL on | |
| 88907 | 5751 frame F suitable for displaying ASCII characters. Value is -1 if |
| 5752 the face couldn't be determined, which might happen if the default | |
| 5753 face isn't realized and cannot be realized. */ | |
| 24995 | 5754 |
| 5755 int | |
|
90054
f2ebccfa87d4
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-74
Miles Bader <miles@gnu.org>
diff
changeset
|
5756 lookup_named_face (f, symbol, signal_p) |
| 24995 | 5757 struct frame *f; |
| 5758 Lisp_Object symbol; | |
|
58439
b1e7465ce5fc
(lookup_named_face): Add signal_p arg. Return -1 if
Kim F. Storm <storm@cua.dk>
parents:
57997
diff
changeset
|
5759 int signal_p; |
| 24995 | 5760 { |
| 5761 Lisp_Object attrs[LFACE_VECTOR_SIZE]; | |
| 5762 Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE]; | |
| 5763 struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); | |
| 5764 | |
|
33275
8c453c73a11b
(lookup_named_face): If default face isn't realized,
Gerd Moellmann <gerd@gnu.org>
parents:
33082
diff
changeset
|
5765 if (default_face == NULL) |
|
8c453c73a11b
(lookup_named_face): If default face isn't realized,
Gerd Moellmann <gerd@gnu.org>
parents:
33082
diff
changeset
|
5766 { |
|
8c453c73a11b
(lookup_named_face): If default face isn't realized,
Gerd Moellmann <gerd@gnu.org>
parents:
33082
diff
changeset
|
5767 if (!realize_basic_faces (f)) |
|
8c453c73a11b
(lookup_named_face): If default face isn't realized,
Gerd Moellmann <gerd@gnu.org>
parents:
33082
diff
changeset
|
5768 return -1; |
|
8c453c73a11b
(lookup_named_face): If default face isn't realized,
Gerd Moellmann <gerd@gnu.org>
parents:
33082
diff
changeset
|
5769 default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); |
|
8c453c73a11b
(lookup_named_face): If default face isn't realized,
Gerd Moellmann <gerd@gnu.org>
parents:
33082
diff
changeset
|
5770 } |
|
8c453c73a11b
(lookup_named_face): If default face isn't realized,
Gerd Moellmann <gerd@gnu.org>
parents:
33082
diff
changeset
|
5771 |
|
58439
b1e7465ce5fc
(lookup_named_face): Add signal_p arg. Return -1 if
Kim F. Storm <storm@cua.dk>
parents:
57997
diff
changeset
|
5772 if (!get_lface_attributes (f, symbol, symbol_attrs, signal_p)) |
|
b1e7465ce5fc
(lookup_named_face): Add signal_p arg. Return -1 if
Kim F. Storm <storm@cua.dk>
parents:
57997
diff
changeset
|
5773 return -1; |
|
b1e7465ce5fc
(lookup_named_face): Add signal_p arg. Return -1 if
Kim F. Storm <storm@cua.dk>
parents:
57997
diff
changeset
|
5774 |
| 24995 | 5775 bcopy (default_face->lface, attrs, sizeof attrs); |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
5776 merge_face_vectors (f, symbol_attrs, attrs, 0); |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
5777 |
| 88907 | 5778 return lookup_face (f, attrs); |
| 24995 | 5779 } |
| 5780 | |
| 5781 | |
| 5782 /* Return the ID of the realized ASCII face of Lisp face with ID | |
| 5783 LFACE_ID on frame F. Value is -1 if LFACE_ID isn't valid. */ | |
| 5784 | |
| 5785 int | |
| 5786 ascii_face_of_lisp_face (f, lface_id) | |
| 5787 struct frame *f; | |
| 5788 int lface_id; | |
| 5789 { | |
| 5790 int face_id; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
5791 |
| 24995 | 5792 if (lface_id >= 0 && lface_id < lface_id_to_name_size) |
| 5793 { | |
| 5794 Lisp_Object face_name = lface_id_to_name[lface_id]; | |
|
90054
f2ebccfa87d4
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-74
Miles Bader <miles@gnu.org>
diff
changeset
|
5795 face_id = lookup_named_face (f, face_name, 1); |
| 24995 | 5796 } |
| 5797 else | |
| 5798 face_id = -1; | |
| 5799 | |
| 5800 return face_id; | |
| 5801 } | |
| 5802 | |
| 5803 | |
| 5804 /* Return a face for charset ASCII that is like the face with id | |
| 5805 FACE_ID on frame F, but has a font that is STEPS steps smaller. | |
| 5806 STEPS < 0 means larger. Value is the id of the face. */ | |
| 5807 | |
| 5808 int | |
| 5809 smaller_face (f, face_id, steps) | |
| 5810 struct frame *f; | |
| 5811 int face_id, steps; | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
5812 { |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
5813 #ifdef HAVE_WINDOW_SYSTEM |
| 24995 | 5814 struct face *face; |
| 5815 Lisp_Object attrs[LFACE_VECTOR_SIZE]; | |
| 5816 int pt, last_pt, last_height; | |
| 5817 int delta; | |
| 5818 int new_face_id; | |
| 5819 struct face *new_face; | |
| 5820 | |
| 5821 /* If not called for an X frame, just return the original face. */ | |
| 5822 if (FRAME_TERMCAP_P (f)) | |
| 5823 return face_id; | |
| 5824 | |
| 5825 /* Try in increments of 1/2 pt. */ | |
| 5826 delta = steps < 0 ? 5 : -5; | |
| 5827 steps = abs (steps); | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
5828 |
| 24995 | 5829 face = FACE_FROM_ID (f, face_id); |
| 5830 bcopy (face->lface, attrs, sizeof attrs); | |
| 5831 pt = last_pt = XFASTINT (attrs[LFACE_HEIGHT_INDEX]); | |
| 5832 new_face_id = face_id; | |
| 5833 last_height = FONT_HEIGHT (face->font); | |
| 5834 | |
| 5835 while (steps | |
| 5836 && pt + delta > 0 | |
| 5837 /* Give up if we cannot find a font within 10pt. */ | |
| 5838 && abs (last_pt - pt) < 100) | |
| 5839 { | |
| 5840 /* Look up a face for a slightly smaller/larger font. */ | |
| 5841 pt += delta; | |
| 5842 attrs[LFACE_HEIGHT_INDEX] = make_number (pt); | |
| 88907 | 5843 new_face_id = lookup_face (f, attrs); |
| 24995 | 5844 new_face = FACE_FROM_ID (f, new_face_id); |
| 5845 | |
| 5846 /* If height changes, count that as one step. */ | |
|
31463
628bb2264f46
(smaller_face): Compare font heights with `<' and `>'
Gerd Moellmann <gerd@gnu.org>
parents:
31449
diff
changeset
|
5847 if ((delta < 0 && FONT_HEIGHT (new_face->font) < last_height) |
|
628bb2264f46
(smaller_face): Compare font heights with `<' and `>'
Gerd Moellmann <gerd@gnu.org>
parents:
31449
diff
changeset
|
5848 || (delta > 0 && FONT_HEIGHT (new_face->font) > last_height)) |
| 24995 | 5849 { |
| 5850 --steps; | |
| 5851 last_height = FONT_HEIGHT (new_face->font); | |
| 5852 last_pt = pt; | |
| 5853 } | |
| 5854 } | |
| 5855 | |
| 5856 return new_face_id; | |
| 5857 | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
5858 #else /* not HAVE_WINDOW_SYSTEM */ |
| 24995 | 5859 |
| 5860 return face_id; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
5861 |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
5862 #endif /* not HAVE_WINDOW_SYSTEM */ |
| 24995 | 5863 } |
| 5864 | |
| 5865 | |
| 5866 /* Return a face for charset ASCII that is like the face with id | |
| 5867 FACE_ID on frame F, but has height HEIGHT. */ | |
|
2795
e97e96fb0cb8
(compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents:
2784
diff
changeset
|
5868 |
|
2730
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
5869 int |
| 24995 | 5870 face_with_height (f, face_id, height) |
| 5871 struct frame *f; | |
| 5872 int face_id; | |
| 5873 int height; | |
| 5874 { | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
5875 #ifdef HAVE_WINDOW_SYSTEM |
| 24995 | 5876 struct face *face; |
| 5877 Lisp_Object attrs[LFACE_VECTOR_SIZE]; | |
| 5878 | |
| 5879 if (FRAME_TERMCAP_P (f) | |
| 5880 || height <= 0) | |
| 5881 return face_id; | |
| 5882 | |
| 5883 face = FACE_FROM_ID (f, face_id); | |
| 5884 bcopy (face->lface, attrs, sizeof attrs); | |
| 5885 attrs[LFACE_HEIGHT_INDEX] = make_number (height); | |
| 88907 | 5886 face_id = lookup_face (f, attrs); |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
5887 #endif /* HAVE_WINDOW_SYSTEM */ |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
5888 |
| 24995 | 5889 return face_id; |
| 5890 } | |
| 5891 | |
|
33275
8c453c73a11b
(lookup_named_face): If default face isn't realized,
Gerd Moellmann <gerd@gnu.org>
parents:
33082
diff
changeset
|
5892 |
|
25114
be5d3e21fbd7
(load_color): Remove static from definition and remove
Eli Zaretskii <eliz@gnu.org>
parents:
25092
diff
changeset
|
5893 /* Return the face id of the realized face for named face SYMBOL on |
| 88907 | 5894 frame F suitable for displaying ASCII characters, and use |
| 5895 attributes of the face FACE_ID for attributes that aren't | |
| 5896 completely specified by SYMBOL. This is like lookup_named_face, | |
| 5897 except that the default attributes come from FACE_ID, not from the | |
| 5898 default face. FACE_ID is assumed to be already realized. */ | |
|
25114
be5d3e21fbd7
(load_color): Remove static from definition and remove
Eli Zaretskii <eliz@gnu.org>
parents:
25092
diff
changeset
|
5899 |
|
be5d3e21fbd7
(load_color): Remove static from definition and remove
Eli Zaretskii <eliz@gnu.org>
parents:
25092
diff
changeset
|
5900 int |
| 88907 | 5901 lookup_derived_face (f, symbol, face_id) |
|
25114
be5d3e21fbd7
(load_color): Remove static from definition and remove
Eli Zaretskii <eliz@gnu.org>
parents:
25092
diff
changeset
|
5902 struct frame *f; |
|
be5d3e21fbd7
(load_color): Remove static from definition and remove
Eli Zaretskii <eliz@gnu.org>
parents:
25092
diff
changeset
|
5903 Lisp_Object symbol; |
|
be5d3e21fbd7
(load_color): Remove static from definition and remove
Eli Zaretskii <eliz@gnu.org>
parents:
25092
diff
changeset
|
5904 int face_id; |
|
be5d3e21fbd7
(load_color): Remove static from definition and remove
Eli Zaretskii <eliz@gnu.org>
parents:
25092
diff
changeset
|
5905 { |
|
be5d3e21fbd7
(load_color): Remove static from definition and remove
Eli Zaretskii <eliz@gnu.org>
parents:
25092
diff
changeset
|
5906 Lisp_Object attrs[LFACE_VECTOR_SIZE]; |
|
be5d3e21fbd7
(load_color): Remove static from definition and remove
Eli Zaretskii <eliz@gnu.org>
parents:
25092
diff
changeset
|
5907 Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE]; |
|
be5d3e21fbd7
(load_color): Remove static from definition and remove
Eli Zaretskii <eliz@gnu.org>
parents:
25092
diff
changeset
|
5908 struct face *default_face = FACE_FROM_ID (f, face_id); |
|
be5d3e21fbd7
(load_color): Remove static from definition and remove
Eli Zaretskii <eliz@gnu.org>
parents:
25092
diff
changeset
|
5909 |
|
be5d3e21fbd7
(load_color): Remove static from definition and remove
Eli Zaretskii <eliz@gnu.org>
parents:
25092
diff
changeset
|
5910 if (!default_face) |
|
be5d3e21fbd7
(load_color): Remove static from definition and remove
Eli Zaretskii <eliz@gnu.org>
parents:
25092
diff
changeset
|
5911 abort (); |
|
be5d3e21fbd7
(load_color): Remove static from definition and remove
Eli Zaretskii <eliz@gnu.org>
parents:
25092
diff
changeset
|
5912 |
|
be5d3e21fbd7
(load_color): Remove static from definition and remove
Eli Zaretskii <eliz@gnu.org>
parents:
25092
diff
changeset
|
5913 get_lface_attributes (f, symbol, symbol_attrs, 1); |
|
be5d3e21fbd7
(load_color): Remove static from definition and remove
Eli Zaretskii <eliz@gnu.org>
parents:
25092
diff
changeset
|
5914 bcopy (default_face->lface, attrs, sizeof attrs); |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
5915 merge_face_vectors (f, symbol_attrs, attrs, 0); |
| 88907 | 5916 return lookup_face (f, attrs); |
|
25114
be5d3e21fbd7
(load_color): Remove static from definition and remove
Eli Zaretskii <eliz@gnu.org>
parents:
25092
diff
changeset
|
5917 } |
|
be5d3e21fbd7
(load_color): Remove static from definition and remove
Eli Zaretskii <eliz@gnu.org>
parents:
25092
diff
changeset
|
5918 |
|
40278
6ee20fddfbc5
(Fface_attributes_as_vector): New function.
Richard M. Stallman <rms@gnu.org>
parents:
40226
diff
changeset
|
5919 DEFUN ("face-attributes-as-vector", Fface_attributes_as_vector, |
|
6ee20fddfbc5
(Fface_attributes_as_vector): New function.
Richard M. Stallman <rms@gnu.org>
parents:
40226
diff
changeset
|
5920 Sface_attributes_as_vector, 1, 1, 0, |
|
41010
edd3b39a7cd1
(Fface_attributes_as_vector): Doc fix.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40991
diff
changeset
|
5921 doc: /* Return a vector of face attributes corresponding to PLIST. */) |
|
40278
6ee20fddfbc5
(Fface_attributes_as_vector): New function.
Richard M. Stallman <rms@gnu.org>
parents:
40226
diff
changeset
|
5922 (plist) |
|
6ee20fddfbc5
(Fface_attributes_as_vector): New function.
Richard M. Stallman <rms@gnu.org>
parents:
40226
diff
changeset
|
5923 Lisp_Object plist; |
|
6ee20fddfbc5
(Fface_attributes_as_vector): New function.
Richard M. Stallman <rms@gnu.org>
parents:
40226
diff
changeset
|
5924 { |
|
6ee20fddfbc5
(Fface_attributes_as_vector): New function.
Richard M. Stallman <rms@gnu.org>
parents:
40226
diff
changeset
|
5925 Lisp_Object lface; |
|
6ee20fddfbc5
(Fface_attributes_as_vector): New function.
Richard M. Stallman <rms@gnu.org>
parents:
40226
diff
changeset
|
5926 lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE), |
|
6ee20fddfbc5
(Fface_attributes_as_vector): New function.
Richard M. Stallman <rms@gnu.org>
parents:
40226
diff
changeset
|
5927 Qunspecified); |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
5928 merge_face_ref (XFRAME (selected_frame), plist, XVECTOR (lface)->contents, |
|
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
5929 1, 0); |
|
40278
6ee20fddfbc5
(Fface_attributes_as_vector): New function.
Richard M. Stallman <rms@gnu.org>
parents:
40226
diff
changeset
|
5930 return lface; |
|
6ee20fddfbc5
(Fface_attributes_as_vector): New function.
Richard M. Stallman <rms@gnu.org>
parents:
40226
diff
changeset
|
5931 } |
|
6ee20fddfbc5
(Fface_attributes_as_vector): New function.
Richard M. Stallman <rms@gnu.org>
parents:
40226
diff
changeset
|
5932 |
| 24995 | 5933 |
| 5934 | |
| 5935 /*********************************************************************** | |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5936 Face capability testing |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5937 ***********************************************************************/ |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5938 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5939 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5940 /* If the distance (as returned by color_distance) between two colors is |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5941 less than this, then they are considered the same, for determining |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5942 whether a color is supported or not. The range of values is 0-65535. */ |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5943 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5944 #define TTY_SAME_COLOR_THRESHOLD 10000 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5945 |
|
55903
822bab94f6a3
(x_supports_face_attributes_p): Make this function
Eli Zaretskii <eliz@gnu.org>
parents:
55901
diff
changeset
|
5946 #ifdef HAVE_WINDOW_SYSTEM |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5947 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5948 /* Return non-zero if all the face attributes in ATTRS are supported |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5949 on the window-system frame F. |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5950 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5951 The definition of `supported' is somewhat heuristic, but basically means |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5952 that a face containing all the attributes in ATTRS, when merged with the |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5953 default face for display, can be represented in a way that's |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5954 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5955 \(1) different in appearance than the default face, and |
|
55912
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
5956 \(2) `close in spirit' to what the attributes specify, if not exact. */ |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5957 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5958 static int |
|
55912
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
5959 x_supports_face_attributes_p (f, attrs, def_face) |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5960 struct frame *f; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5961 Lisp_Object *attrs; |
|
55912
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
5962 struct face *def_face; |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
5963 { |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
5964 Lisp_Object *def_attrs = def_face->lface; |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5965 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5966 /* Check that other specified attributes are different that the default |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5967 face. */ |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5968 if ((!UNSPECIFIEDP (attrs[LFACE_UNDERLINE_INDEX]) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5969 && face_attr_equal_p (attrs[LFACE_UNDERLINE_INDEX], |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5970 def_attrs[LFACE_UNDERLINE_INDEX])) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5971 || (!UNSPECIFIEDP (attrs[LFACE_INVERSE_INDEX]) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5972 && face_attr_equal_p (attrs[LFACE_INVERSE_INDEX], |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5973 def_attrs[LFACE_INVERSE_INDEX])) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5974 || (!UNSPECIFIEDP (attrs[LFACE_FOREGROUND_INDEX]) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5975 && face_attr_equal_p (attrs[LFACE_FOREGROUND_INDEX], |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5976 def_attrs[LFACE_FOREGROUND_INDEX])) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5977 || (!UNSPECIFIEDP (attrs[LFACE_BACKGROUND_INDEX]) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5978 && face_attr_equal_p (attrs[LFACE_BACKGROUND_INDEX], |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5979 def_attrs[LFACE_BACKGROUND_INDEX])) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5980 || (!UNSPECIFIEDP (attrs[LFACE_STIPPLE_INDEX]) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5981 && face_attr_equal_p (attrs[LFACE_STIPPLE_INDEX], |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5982 def_attrs[LFACE_STIPPLE_INDEX])) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5983 || (!UNSPECIFIEDP (attrs[LFACE_OVERLINE_INDEX]) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5984 && face_attr_equal_p (attrs[LFACE_OVERLINE_INDEX], |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5985 def_attrs[LFACE_OVERLINE_INDEX])) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5986 || (!UNSPECIFIEDP (attrs[LFACE_STRIKE_THROUGH_INDEX]) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5987 && face_attr_equal_p (attrs[LFACE_STRIKE_THROUGH_INDEX], |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5988 def_attrs[LFACE_STRIKE_THROUGH_INDEX])) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5989 || (!UNSPECIFIEDP (attrs[LFACE_BOX_INDEX]) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5990 && face_attr_equal_p (attrs[LFACE_BOX_INDEX], |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5991 def_attrs[LFACE_BOX_INDEX]))) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5992 return 0; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5993 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5994 /* Check font-related attributes, as those are the most commonly |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5995 "unsupported" on a window-system (because of missing fonts). */ |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5996 if (!UNSPECIFIEDP (attrs[LFACE_FAMILY_INDEX]) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5997 || !UNSPECIFIEDP (attrs[LFACE_HEIGHT_INDEX]) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5998 || !UNSPECIFIEDP (attrs[LFACE_WEIGHT_INDEX]) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
5999 || !UNSPECIFIEDP (attrs[LFACE_SLANT_INDEX]) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6000 || !UNSPECIFIEDP (attrs[LFACE_SWIDTH_INDEX]) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6001 || !UNSPECIFIEDP (attrs[LFACE_AVGWIDTH_INDEX])) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6002 { |
|
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
6003 int face_id; |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6004 struct face *face; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6005 Lisp_Object merged_attrs[LFACE_VECTOR_SIZE]; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6006 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6007 bcopy (def_attrs, merged_attrs, sizeof merged_attrs); |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6008 |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
6009 merge_face_vectors (f, attrs, merged_attrs, 0); |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6010 |
|
89943
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
6011 face_id = lookup_face (f, merged_attrs); |
|
4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Miles Bader <miles@gnu.org>
diff
changeset
|
6012 face = FACE_FROM_ID (f, face_id); |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6013 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6014 if (! face) |
|
56296
075ad6932e06
(x_supports_face_attributes_p)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56176
diff
changeset
|
6015 error ("cannot make face"); |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6016 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6017 /* If the font is the same, then not supported. */ |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6018 if (face->font == def_face->font) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6019 return 0; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6020 } |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6021 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6022 /* Everything checks out, this face is supported. */ |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6023 return 1; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6024 } |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6025 |
|
55903
822bab94f6a3
(x_supports_face_attributes_p): Make this function
Eli Zaretskii <eliz@gnu.org>
parents:
55901
diff
changeset
|
6026 #endif /* HAVE_WINDOW_SYSTEM */ |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6027 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6028 /* Return non-zero if all the face attributes in ATTRS are supported |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6029 on the tty frame F. |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6030 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6031 The definition of `supported' is somewhat heuristic, but basically means |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6032 that a face containing all the attributes in ATTRS, when merged |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6033 with the default face for display, can be represented in a way that's |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6034 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6035 \(1) different in appearance than the default face, and |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6036 \(2) `close in spirit' to what the attributes specify, if not exact. |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6037 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6038 Point (2) implies that a `:weight black' attribute will be satisfied |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6039 by any terminal that can display bold, and a `:foreground "yellow"' as |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6040 long as the terminal can display a yellowish color, but `:slant italic' |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6041 will _not_ be satisfied by the tty display code's automatic |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6042 substitution of a `dim' face for italic. */ |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6043 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6044 static int |
|
55912
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6045 tty_supports_face_attributes_p (f, attrs, def_face) |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6046 struct frame *f; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6047 Lisp_Object *attrs; |
|
55912
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6048 struct face *def_face; |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6049 { |
|
56296
075ad6932e06
(x_supports_face_attributes_p)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56176
diff
changeset
|
6050 int weight; |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6051 Lisp_Object val, fg, bg; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6052 XColor fg_tty_color, fg_std_color; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6053 XColor bg_tty_color, bg_std_color; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6054 unsigned test_caps = 0; |
|
55912
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6055 Lisp_Object *def_attrs = def_face->lface; |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6056 |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6057 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6058 /* First check some easy-to-check stuff; ttys support none of the |
|
55912
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6059 following attributes, so we can just return false if any are requested |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6060 (even if `nominal' values are specified, we should still return false, |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6061 as that will be the same value that the default face uses). We |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6062 consider :slant unsupportable on ttys, even though the face code |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6063 actually `fakes' them using a dim attribute if possible. This is |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6064 because the faked result is too different from what the face |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6065 specifies. */ |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6066 if (!UNSPECIFIEDP (attrs[LFACE_FAMILY_INDEX]) |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6067 || !UNSPECIFIEDP (attrs[LFACE_STIPPLE_INDEX]) |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6068 || !UNSPECIFIEDP (attrs[LFACE_HEIGHT_INDEX]) |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6069 || !UNSPECIFIEDP (attrs[LFACE_SWIDTH_INDEX]) |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6070 || !UNSPECIFIEDP (attrs[LFACE_OVERLINE_INDEX]) |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6071 || !UNSPECIFIEDP (attrs[LFACE_STRIKE_THROUGH_INDEX]) |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6072 || !UNSPECIFIEDP (attrs[LFACE_BOX_INDEX]) |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6073 || !UNSPECIFIEDP (attrs[LFACE_SLANT_INDEX])) |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6074 return 0; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6075 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6076 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6077 /* Test for terminal `capabilities' (non-color character attributes). */ |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6078 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6079 /* font weight (bold/dim) */ |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6080 weight = face_numeric_weight (attrs[LFACE_WEIGHT_INDEX]); |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6081 if (weight >= 0) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6082 { |
|
55912
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6083 int def_weight = face_numeric_weight (def_attrs[LFACE_WEIGHT_INDEX]); |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6084 |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6085 if (weight > XLFD_WEIGHT_MEDIUM) |
|
55912
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6086 { |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6087 if (def_weight > XLFD_WEIGHT_MEDIUM) |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6088 return 0; /* same as default */ |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6089 test_caps = TTY_CAP_BOLD; |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6090 } |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6091 else if (weight < XLFD_WEIGHT_MEDIUM) |
|
55912
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6092 { |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6093 if (def_weight < XLFD_WEIGHT_MEDIUM) |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6094 return 0; /* same as default */ |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6095 test_caps = TTY_CAP_DIM; |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6096 } |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6097 else if (def_weight == XLFD_WEIGHT_MEDIUM) |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6098 return 0; /* same as default */ |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6099 } |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6100 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6101 /* underlining */ |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6102 val = attrs[LFACE_UNDERLINE_INDEX]; |
|
55912
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6103 if (!UNSPECIFIEDP (val)) |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6104 { |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6105 if (STRINGP (val)) |
|
55912
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6106 return 0; /* ttys can't use colored underlines */ |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6107 else if (face_attr_equal_p (val, def_attrs[LFACE_UNDERLINE_INDEX])) |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6108 return 0; /* same as default */ |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6109 else |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6110 test_caps |= TTY_CAP_UNDERLINE; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6111 } |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6112 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6113 /* inverse video */ |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6114 val = attrs[LFACE_INVERSE_INDEX]; |
|
55912
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6115 if (!UNSPECIFIEDP (val)) |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6116 { |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6117 if (face_attr_equal_p (val, def_attrs[LFACE_UNDERLINE_INDEX])) |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6118 return 0; /* same as default */ |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6119 else |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6120 test_caps |= TTY_CAP_INVERSE; |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6121 } |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6122 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6123 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6124 /* Color testing. */ |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6125 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6126 /* Default the color indices in FG_TTY_COLOR and BG_TTY_COLOR, since |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6127 we use them when calling `tty_capable_p' below, even if the face |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6128 specifies no colors. */ |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6129 fg_tty_color.pixel = FACE_TTY_DEFAULT_FG_COLOR; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6130 bg_tty_color.pixel = FACE_TTY_DEFAULT_BG_COLOR; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6131 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6132 /* Check if foreground color is close enough. */ |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6133 fg = attrs[LFACE_FOREGROUND_INDEX]; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6134 if (STRINGP (fg)) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6135 { |
|
55912
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6136 Lisp_Object def_fg = def_attrs[LFACE_FOREGROUND_INDEX]; |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6137 |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6138 if (face_attr_equal_p (fg, def_fg)) |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6139 return 0; /* same as default */ |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6140 else if (! tty_lookup_color (f, fg, &fg_tty_color, &fg_std_color)) |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6141 return 0; /* not a valid color */ |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6142 else if (color_distance (&fg_tty_color, &fg_std_color) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6143 > TTY_SAME_COLOR_THRESHOLD) |
|
55912
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6144 return 0; /* displayed color is too different */ |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6145 else |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6146 /* Make sure the color is really different than the default. */ |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6147 { |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6148 XColor def_fg_color; |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6149 if (tty_lookup_color (f, def_fg, &def_fg_color, 0) |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6150 && (color_distance (&fg_tty_color, &def_fg_color) |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6151 <= TTY_SAME_COLOR_THRESHOLD)) |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6152 return 0; |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6153 } |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6154 } |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6155 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6156 /* Check if background color is close enough. */ |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6157 bg = attrs[LFACE_BACKGROUND_INDEX]; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6158 if (STRINGP (bg)) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6159 { |
|
55912
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6160 Lisp_Object def_bg = def_attrs[LFACE_FOREGROUND_INDEX]; |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6161 |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6162 if (face_attr_equal_p (bg, def_bg)) |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6163 return 0; /* same as default */ |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6164 else if (! tty_lookup_color (f, bg, &bg_tty_color, &bg_std_color)) |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6165 return 0; /* not a valid color */ |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6166 else if (color_distance (&bg_tty_color, &bg_std_color) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6167 > TTY_SAME_COLOR_THRESHOLD) |
|
55912
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6168 return 0; /* displayed color is too different */ |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6169 else |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6170 /* Make sure the color is really different than the default. */ |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6171 { |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6172 XColor def_bg_color; |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6173 if (tty_lookup_color (f, def_bg, &def_bg_color, 0) |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6174 && (color_distance (&bg_tty_color, &def_bg_color) |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6175 <= TTY_SAME_COLOR_THRESHOLD)) |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6176 return 0; |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6177 } |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6178 } |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6179 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6180 /* If both foreground and background are requested, see if the |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6181 distance between them is OK. We just check to see if the distance |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6182 between the tty's foreground and background is close enough to the |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6183 distance between the standard foreground and background. */ |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6184 if (STRINGP (fg) && STRINGP (bg)) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6185 { |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6186 int delta_delta |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6187 = (color_distance (&fg_std_color, &bg_std_color) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6188 - color_distance (&fg_tty_color, &bg_tty_color)); |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6189 if (delta_delta > TTY_SAME_COLOR_THRESHOLD |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6190 || delta_delta < -TTY_SAME_COLOR_THRESHOLD) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6191 return 0; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6192 } |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6193 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6194 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6195 /* See if the capabilities we selected above are supported, with the |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6196 given colors. */ |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6197 if (test_caps != 0 && |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6198 ! tty_capable_p (f, test_caps, fg_tty_color.pixel, bg_tty_color.pixel)) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6199 return 0; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6200 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6201 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6202 /* Hmmm, everything checks out, this terminal must support this face. */ |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6203 return 1; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6204 } |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6205 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6206 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6207 DEFUN ("display-supports-face-attributes-p", |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6208 Fdisplay_supports_face_attributes_p, Sdisplay_supports_face_attributes_p, |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6209 1, 2, 0, |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6210 doc: /* Return non-nil if all the face attributes in ATTRIBUTES are supported. |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6211 The optional argument DISPLAY can be a display name, a frame, or |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6212 nil (meaning the selected frame's display) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6213 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6214 The definition of `supported' is somewhat heuristic, but basically means |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6215 that a face containing all the attributes in ATTRIBUTES, when merged |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6216 with the default face for display, can be represented in a way that's |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6217 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6218 \(1) different in appearance than the default face, and |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6219 \(2) `close in spirit' to what the attributes specify, if not exact. |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6220 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6221 Point (2) implies that a `:weight black' attribute will be satisfied by |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6222 any display that can display bold, and a `:foreground \"yellow\"' as long |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6223 as it can display a yellowish color, but `:slant italic' will _not_ be |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6224 satisfied by the tty display code's automatic substitution of a `dim' |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6225 face for italic. */) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6226 (attributes, display) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6227 Lisp_Object attributes, display; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6228 { |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6229 int supports, i; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6230 Lisp_Object frame; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6231 struct frame *f; |
|
55912
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6232 struct face *def_face; |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6233 Lisp_Object attrs[LFACE_VECTOR_SIZE]; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6234 |
|
55949
50599d471b66
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-377
Miles Bader <miles@gnu.org>
parents:
55912
diff
changeset
|
6235 if (noninteractive || !initialized) |
|
50599d471b66
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-377
Miles Bader <miles@gnu.org>
parents:
55912
diff
changeset
|
6236 /* We may not be able to access low-level face information in batch |
|
50599d471b66
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-377
Miles Bader <miles@gnu.org>
parents:
55912
diff
changeset
|
6237 mode, or before being dumped, and this function is not going to |
|
50599d471b66
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-377
Miles Bader <miles@gnu.org>
parents:
55912
diff
changeset
|
6238 be very useful in those cases anyway, so just give up. */ |
|
50599d471b66
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-377
Miles Bader <miles@gnu.org>
parents:
55912
diff
changeset
|
6239 return Qnil; |
|
50599d471b66
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-377
Miles Bader <miles@gnu.org>
parents:
55912
diff
changeset
|
6240 |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6241 if (NILP (display)) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6242 frame = selected_frame; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6243 else if (FRAMEP (display)) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6244 frame = display; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6245 else |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6246 { |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6247 /* Find any frame on DISPLAY. */ |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6248 Lisp_Object fl_tail; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6249 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6250 frame = Qnil; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6251 for (fl_tail = Vframe_list; CONSP (fl_tail); fl_tail = XCDR (fl_tail)) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6252 { |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6253 frame = XCAR (fl_tail); |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6254 if (!NILP (Fequal (Fcdr (Fassq (Qdisplay, |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6255 XFRAME (frame)->param_alist)), |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6256 display))) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6257 break; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6258 } |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6259 } |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6260 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6261 CHECK_LIVE_FRAME (frame); |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6262 f = XFRAME (frame); |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6263 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6264 for (i = 0; i < LFACE_VECTOR_SIZE; i++) |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6265 attrs[i] = Qunspecified; |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
6266 merge_face_ref (f, attributes, attrs, 1, 0); |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6267 |
|
55912
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6268 def_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6269 if (def_face == NULL) |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6270 { |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6271 if (! realize_basic_faces (f)) |
|
56296
075ad6932e06
(x_supports_face_attributes_p)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56176
diff
changeset
|
6272 error ("Cannot realize default face"); |
|
55912
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6273 def_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6274 } |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6275 |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6276 /* Dispatch to the appropriate handler. */ |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6277 if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)) |
|
55912
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6278 supports = tty_supports_face_attributes_p (f, attrs, def_face); |
|
55903
822bab94f6a3
(x_supports_face_attributes_p): Make this function
Eli Zaretskii <eliz@gnu.org>
parents:
55901
diff
changeset
|
6279 #ifdef HAVE_WINDOW_SYSTEM |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6280 else |
|
55912
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6281 supports = x_supports_face_attributes_p (f, attrs, def_face); |
|
0b7bab25fcec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
Miles Bader <miles@gnu.org>
parents:
55903
diff
changeset
|
6282 #endif |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6283 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6284 return supports ? Qt : Qnil; |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6285 } |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6286 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6287 |
|
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
6288 /*********************************************************************** |
| 24995 | 6289 Font selection |
| 6290 ***********************************************************************/ | |
| 6291 | |
| 89483 | 6292 DEFUN ("internal-set-font-selection-order", |
| 24995 | 6293 Finternal_set_font_selection_order, |
| 6294 Sinternal_set_font_selection_order, 1, 1, 0, | |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
6295 doc: /* Set font selection order for face font selection to ORDER. |
|
39914
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
6296 ORDER must be a list of length 4 containing the symbols `:width', |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
6297 `:height', `:weight', and `:slant'. Face attributes appearing |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
6298 first in ORDER are matched first, e.g. if `:height' appears before |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
6299 `:weight' in ORDER, font selection first tries to find a font with |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
6300 a suitable height, and then tries to match the font weight. |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
6301 Value is ORDER. */) |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
6302 (order) |
|
39914
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
6303 Lisp_Object order; |
| 24995 | 6304 { |
| 6305 Lisp_Object list; | |
| 6306 int i; | |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6307 int indices[DIM (font_sort_order)]; |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
6308 |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
6309 CHECK_LIST (order); |
| 24995 | 6310 bzero (indices, sizeof indices); |
| 6311 i = 0; | |
| 6312 | |
| 6313 for (list = order; | |
| 6314 CONSP (list) && i < DIM (indices); | |
| 6315 list = XCDR (list), ++i) | |
| 6316 { | |
| 6317 Lisp_Object attr = XCAR (list); | |
| 6318 int xlfd; | |
| 6319 | |
| 6320 if (EQ (attr, QCwidth)) | |
| 6321 xlfd = XLFD_SWIDTH; | |
| 6322 else if (EQ (attr, QCheight)) | |
| 6323 xlfd = XLFD_POINT_SIZE; | |
| 6324 else if (EQ (attr, QCweight)) | |
| 6325 xlfd = XLFD_WEIGHT; | |
| 6326 else if (EQ (attr, QCslant)) | |
| 6327 xlfd = XLFD_SLANT; | |
| 6328 else | |
| 6329 break; | |
| 6330 | |
| 6331 if (indices[i] != 0) | |
| 6332 break; | |
| 6333 indices[i] = xlfd; | |
| 6334 } | |
| 6335 | |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6336 if (!NILP (list) || i != DIM (indices)) |
| 24995 | 6337 signal_error ("Invalid font sort order", order); |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6338 for (i = 0; i < DIM (font_sort_order); ++i) |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6339 if (indices[i] == 0) |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6340 signal_error ("Invalid font sort order", order); |
| 24995 | 6341 |
| 6342 if (bcmp (indices, font_sort_order, sizeof indices) != 0) | |
| 6343 { | |
| 6344 bcopy (indices, font_sort_order, sizeof font_sort_order); | |
| 6345 free_all_realized_faces (Qnil); | |
| 6346 } | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
6347 |
| 24995 | 6348 return Qnil; |
| 6349 } | |
| 6350 | |
| 6351 | |
| 6352 DEFUN ("internal-set-alternative-font-family-alist", | |
| 6353 Finternal_set_alternative_font_family_alist, | |
| 6354 Sinternal_set_alternative_font_family_alist, 1, 1, 0, | |
|
40991
566c75efb733
(Finternal_set_alternative_font_family_alist): Reindent.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40838
diff
changeset
|
6355 doc: /* Define alternative font families to try in face font selection. |
|
39914
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
6356 ALIST is an alist of (FAMILY ALTERNATIVE1 ALTERNATIVE2 ...) entries. |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
6357 Each ALTERNATIVE is tried in order if no fonts of font family FAMILY can |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
6358 be found. Value is ALIST. */) |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
6359 (alist) |
| 24995 | 6360 Lisp_Object alist; |
| 6361 { | |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
6362 CHECK_LIST (alist); |
| 24995 | 6363 Vface_alternative_font_family_alist = alist; |
| 6364 free_all_realized_faces (Qnil); | |
| 6365 return alist; | |
| 6366 } | |
| 6367 | |
| 6368 | |
|
33372
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
6369 DEFUN ("internal-set-alternative-font-registry-alist", |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
6370 Finternal_set_alternative_font_registry_alist, |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
6371 Sinternal_set_alternative_font_registry_alist, 1, 1, 0, |
|
40598
7f3db64c7d42
(Finternal_merge_in_global_face): Reindent.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40555
diff
changeset
|
6372 doc: /* Define alternative font registries to try in face font selection. |
|
39914
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
6373 ALIST is an alist of (REGISTRY ALTERNATIVE1 ALTERNATIVE2 ...) entries. |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
6374 Each ALTERNATIVE is tried in order if no fonts of font registry REGISTRY can |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
6375 be found. Value is ALIST. */) |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
6376 (alist) |
|
33372
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
6377 Lisp_Object alist; |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
6378 { |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
6379 CHECK_LIST (alist); |
|
33372
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
6380 Vface_alternative_font_registry_alist = alist; |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
6381 free_all_realized_faces (Qnil); |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
6382 return alist; |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
6383 } |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
6384 |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
6385 |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
6386 #ifdef HAVE_WINDOW_SYSTEM |
| 24995 | 6387 |
| 6388 /* Value is non-zero if FONT is the name of a scalable font. The | |
| 6389 X11R6 XLFD spec says that point size, pixel size, and average width | |
| 6390 are zero for scalable fonts. Intlfonts contain at least one | |
| 6391 scalable font ("*-muleindian-1") for which this isn't true, so we | |
| 6392 just test average width. */ | |
| 6393 | |
| 6394 static int | |
| 6395 font_scalable_p (font) | |
| 6396 struct font_name *font; | |
| 6397 { | |
| 6398 char *s = font->fields[XLFD_AVGWIDTH]; | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
6399 return (*s == '0' && *(s + 1) == '\0') |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
6400 #ifdef WINDOWSNT |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
6401 /* Windows implementation of XLFD is slightly broken for backward |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
6402 compatibility with previous broken versions, so test for |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
6403 wildcards as well as 0. */ |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
6404 || *s == '*' |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
6405 #endif |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
6406 ; |
| 24995 | 6407 } |
| 6408 | |
| 6409 | |
|
34160
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
6410 /* Ignore the difference of font point size less than this value. */ |
|
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
6411 |
|
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
6412 #define FONT_POINT_SIZE_QUANTUM 5 |
|
bb9ec0151423
(struct font_name): New member registry_priority.
Kenichi Handa <handa@m17n.org>
parents:
33853
diff
changeset
|
6413 |
| 24995 | 6414 /* Value is non-zero if FONT1 is a better match for font attributes |
| 6415 VALUES than FONT2. VALUES is an array of face attribute values in | |
| 6416 font sort order. COMPARE_PT_P zero means don't compare point | |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6417 sizes. AVGWIDTH, if not zero, is a specified font average width |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6418 to compare with. */ |
| 24995 | 6419 |
| 6420 static int | |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6421 better_font_p (values, font1, font2, compare_pt_p, avgwidth) |
| 24995 | 6422 int *values; |
| 6423 struct font_name *font1, *font2; | |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6424 int compare_pt_p, avgwidth; |
| 24995 | 6425 { |
| 6426 int i; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
6427 |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6428 for (i = 0; i < DIM (font_sort_order); ++i) |
| 24995 | 6429 { |
| 6430 int xlfd_idx = font_sort_order[i]; | |
| 6431 | |
| 6432 if (compare_pt_p || xlfd_idx != XLFD_POINT_SIZE) | |
| 6433 { | |
|
50515
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
6434 int delta1, delta2; |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
6435 |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
6436 if (xlfd_idx == XLFD_POINT_SIZE) |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
6437 { |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
6438 delta1 = abs (values[i] - (font1->numeric[xlfd_idx] |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
6439 / font1->rescale_ratio)); |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
6440 delta2 = abs (values[i] - (font2->numeric[xlfd_idx] |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
6441 / font2->rescale_ratio)); |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
6442 if (abs (delta1 - delta2) < FONT_POINT_SIZE_QUANTUM) |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
6443 continue; |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
6444 } |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
6445 else |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
6446 { |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
6447 delta1 = abs (values[i] - font1->numeric[xlfd_idx]); |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
6448 delta2 = abs (values[i] - font2->numeric[xlfd_idx]); |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
6449 } |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
6450 |
| 24995 | 6451 if (delta1 > delta2) |
| 6452 return 0; | |
| 6453 else if (delta1 < delta2) | |
| 6454 return 1; | |
| 6455 else | |
| 6456 { | |
| 6457 /* The difference may be equal because, e.g., the face | |
| 6458 specifies `italic' but we have only `regular' and | |
| 6459 `oblique'. Prefer `oblique' in this case. */ | |
| 6460 if ((xlfd_idx == XLFD_WEIGHT || xlfd_idx == XLFD_SLANT) | |
| 6461 && font1->numeric[xlfd_idx] > values[i] | |
| 6462 && font2->numeric[xlfd_idx] < values[i]) | |
| 6463 return 1; | |
| 6464 } | |
| 6465 } | |
| 6466 } | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
6467 |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6468 if (avgwidth) |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6469 { |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6470 int delta1 = abs (avgwidth - font1->numeric[XLFD_AVGWIDTH]); |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6471 int delta2 = abs (avgwidth - font2->numeric[XLFD_AVGWIDTH]); |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6472 if (delta1 > delta2) |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6473 return 0; |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6474 else if (delta1 < delta2) |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6475 return 1; |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6476 } |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6477 |
|
52200
b154b2a09262
* xfaces.c (better_font_p): Prefer a real scalable font; i.e. not
Kenichi Handa <handa@m17n.org>
parents:
51665
diff
changeset
|
6478 if (! compare_pt_p) |
|
b154b2a09262
* xfaces.c (better_font_p): Prefer a real scalable font; i.e. not
Kenichi Handa <handa@m17n.org>
parents:
51665
diff
changeset
|
6479 { |
|
b154b2a09262
* xfaces.c (better_font_p): Prefer a real scalable font; i.e. not
Kenichi Handa <handa@m17n.org>
parents:
51665
diff
changeset
|
6480 /* We prefer a real scalable font; i.e. not what autoscaled. */ |
|
b154b2a09262
* xfaces.c (better_font_p): Prefer a real scalable font; i.e. not
Kenichi Handa <handa@m17n.org>
parents:
51665
diff
changeset
|
6481 int auto_scaled_1 = (font1->numeric[XLFD_POINT_SIZE] == 0 |
|
b154b2a09262
* xfaces.c (better_font_p): Prefer a real scalable font; i.e. not
Kenichi Handa <handa@m17n.org>
parents:
51665
diff
changeset
|
6482 && font1->numeric[XLFD_RESY] > 0); |
|
b154b2a09262
* xfaces.c (better_font_p): Prefer a real scalable font; i.e. not
Kenichi Handa <handa@m17n.org>
parents:
51665
diff
changeset
|
6483 int auto_scaled_2 = (font2->numeric[XLFD_POINT_SIZE] == 0 |
|
b154b2a09262
* xfaces.c (better_font_p): Prefer a real scalable font; i.e. not
Kenichi Handa <handa@m17n.org>
parents:
51665
diff
changeset
|
6484 && font2->numeric[XLFD_RESY] > 0); |
|
b154b2a09262
* xfaces.c (better_font_p): Prefer a real scalable font; i.e. not
Kenichi Handa <handa@m17n.org>
parents:
51665
diff
changeset
|
6485 |
|
b154b2a09262
* xfaces.c (better_font_p): Prefer a real scalable font; i.e. not
Kenichi Handa <handa@m17n.org>
parents:
51665
diff
changeset
|
6486 if (auto_scaled_1 != auto_scaled_2) |
|
b154b2a09262
* xfaces.c (better_font_p): Prefer a real scalable font; i.e. not
Kenichi Handa <handa@m17n.org>
parents:
51665
diff
changeset
|
6487 return auto_scaled_2; |
|
b154b2a09262
* xfaces.c (better_font_p): Prefer a real scalable font; i.e. not
Kenichi Handa <handa@m17n.org>
parents:
51665
diff
changeset
|
6488 } |
|
b154b2a09262
* xfaces.c (better_font_p): Prefer a real scalable font; i.e. not
Kenichi Handa <handa@m17n.org>
parents:
51665
diff
changeset
|
6489 |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6490 return font1->registry_priority < font2->registry_priority; |
| 24995 | 6491 } |
| 6492 | |
| 6493 | |
| 6494 /* Value is non-zero if FONT is an exact match for face attributes in | |
| 6495 SPECIFIED. SPECIFIED is an array of face attribute values in font | |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6496 sort order. AVGWIDTH, if non-zero, is an average width to compare |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6497 with. */ |
| 24995 | 6498 |
| 6499 static int | |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6500 exact_face_match_p (specified, font, avgwidth) |
| 24995 | 6501 int *specified; |
| 6502 struct font_name *font; | |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6503 int avgwidth; |
| 24995 | 6504 { |
| 6505 int i; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
6506 |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6507 for (i = 0; i < DIM (font_sort_order); ++i) |
| 24995 | 6508 if (specified[i] != font->numeric[font_sort_order[i]]) |
| 6509 break; | |
| 6510 | |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6511 return (i == DIM (font_sort_order) |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6512 && (avgwidth <= 0 |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6513 || avgwidth == font->numeric[XLFD_AVGWIDTH])); |
| 24995 | 6514 } |
| 6515 | |
| 6516 | |
| 6517 /* Value is the name of a scaled font, generated from scalable font | |
| 6518 FONT on frame F. SPECIFIED_PT is the point-size to scale FONT to. | |
| 6519 Value is allocated from heap. */ | |
| 6520 | |
| 6521 static char * | |
| 6522 build_scalable_font_name (f, font, specified_pt) | |
| 6523 struct frame *f; | |
| 6524 struct font_name *font; | |
| 6525 int specified_pt; | |
| 6526 { | |
|
51237
ed40623b1ca6
(build_scalable_font_name): Remove `unused var pixel_size' warning.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51210
diff
changeset
|
6527 char pixel_size[20]; |
| 24995 | 6528 int pixel_value; |
| 6529 double resy = FRAME_X_DISPLAY_INFO (f)->resy; | |
| 6530 double pt; | |
| 6531 | |
|
89844
02a959f3ee57
(build_scalable_font_name): If the scalable font is requested for
Kenichi Handa <handa@m17n.org>
parents:
89838
diff
changeset
|
6532 if (font->numeric[XLFD_PIXEL_SIZE] != 0 |
|
02a959f3ee57
(build_scalable_font_name): If the scalable font is requested for
Kenichi Handa <handa@m17n.org>
parents:
89838
diff
changeset
|
6533 || font->numeric[XLFD_POINT_SIZE] != 0) |
|
02a959f3ee57
(build_scalable_font_name): If the scalable font is requested for
Kenichi Handa <handa@m17n.org>
parents:
89838
diff
changeset
|
6534 /* This is a scalable font but is requested for a specific size. |
|
02a959f3ee57
(build_scalable_font_name): If the scalable font is requested for
Kenichi Handa <handa@m17n.org>
parents:
89838
diff
changeset
|
6535 We should not change that size. */ |
|
02a959f3ee57
(build_scalable_font_name): If the scalable font is requested for
Kenichi Handa <handa@m17n.org>
parents:
89838
diff
changeset
|
6536 return build_font_name (font); |
|
02a959f3ee57
(build_scalable_font_name): If the scalable font is requested for
Kenichi Handa <handa@m17n.org>
parents:
89838
diff
changeset
|
6537 |
| 24995 | 6538 /* If scalable font is for a specific resolution, compute |
| 6539 the point size we must specify from the resolution of | |
| 6540 the display and the specified resolution of the font. */ | |
| 6541 if (font->numeric[XLFD_RESY] != 0) | |
| 6542 { | |
| 6543 pt = resy / font->numeric[XLFD_RESY] * specified_pt + 0.5; | |
| 34882 | 6544 pixel_value = font->numeric[XLFD_RESY] / (PT_PER_INCH * 10.0) * pt; |
| 24995 | 6545 } |
| 6546 else | |
| 6547 { | |
| 6548 pt = specified_pt; | |
| 34882 | 6549 pixel_value = resy / (PT_PER_INCH * 10.0) * pt; |
| 24995 | 6550 } |
|
50515
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
6551 /* We may need a font of the different size. */ |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
6552 pixel_value *= font->rescale_ratio; |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
6553 |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
6554 /* We should keep POINT_SIZE 0. Otherwise, X server can't open a |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
6555 font of the specified PIXEL_SIZE. */ |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
6556 #if 0 |
|
51237
ed40623b1ca6
(build_scalable_font_name): Remove `unused var pixel_size' warning.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51210
diff
changeset
|
6557 { /* Set point size of the font. */ |
|
ed40623b1ca6
(build_scalable_font_name): Remove `unused var pixel_size' warning.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51210
diff
changeset
|
6558 char point_size[20]; |
|
ed40623b1ca6
(build_scalable_font_name): Remove `unused var pixel_size' warning.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51210
diff
changeset
|
6559 sprintf (point_size, "%d", (int) pt); |
|
ed40623b1ca6
(build_scalable_font_name): Remove `unused var pixel_size' warning.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51210
diff
changeset
|
6560 font->fields[XLFD_POINT_SIZE] = point_size; |
|
ed40623b1ca6
(build_scalable_font_name): Remove `unused var pixel_size' warning.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51210
diff
changeset
|
6561 font->numeric[XLFD_POINT_SIZE] = pt; |
|
ed40623b1ca6
(build_scalable_font_name): Remove `unused var pixel_size' warning.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51210
diff
changeset
|
6562 } |
|
50515
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
6563 #endif |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
6564 |
| 24995 | 6565 /* Set pixel size. */ |
| 6566 sprintf (pixel_size, "%d", pixel_value); | |
| 6567 font->fields[XLFD_PIXEL_SIZE] = pixel_size; | |
| 6568 font->numeric[XLFD_PIXEL_SIZE] = pixel_value; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
6569 |
| 24995 | 6570 /* If font doesn't specify its resolution, use the |
| 6571 resolution of the display. */ | |
| 6572 if (font->numeric[XLFD_RESY] == 0) | |
| 6573 { | |
| 6574 char buffer[20]; | |
| 6575 sprintf (buffer, "%d", (int) resy); | |
| 6576 font->fields[XLFD_RESY] = buffer; | |
| 6577 font->numeric[XLFD_RESY] = resy; | |
| 6578 } | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
6579 |
| 24995 | 6580 if (strcmp (font->fields[XLFD_RESX], "0") == 0) |
| 6581 { | |
| 6582 char buffer[20]; | |
| 6583 int resx = FRAME_X_DISPLAY_INFO (f)->resx; | |
| 6584 sprintf (buffer, "%d", resx); | |
| 6585 font->fields[XLFD_RESX] = buffer; | |
| 6586 font->numeric[XLFD_RESX] = resx; | |
| 6587 } | |
| 6588 | |
| 6589 return build_font_name (font); | |
| 6590 } | |
| 6591 | |
| 6592 | |
| 6593 /* Value is non-zero if we are allowed to use scalable font FONT. We | |
| 6594 can't run a Lisp function here since this function may be called | |
| 6595 with input blocked. */ | |
| 6596 | |
| 6597 static int | |
|
37186
e47810283f6b
(best_matching_font): Remove unused parameter PATTERN.
Gerd Moellmann <gerd@gnu.org>
parents:
37036
diff
changeset
|
6598 may_use_scalable_font_p (font) |
|
46556
71e205b50a3e
(may_use_scalable_font_p): Argument now points to
Ken Raeburn <raeburn@raeburn.org>
parents:
46478
diff
changeset
|
6599 const char *font; |
| 24995 | 6600 { |
| 6601 if (EQ (Vscalable_fonts_allowed, Qt)) | |
| 6602 return 1; | |
| 6603 else if (CONSP (Vscalable_fonts_allowed)) | |
| 6604 { | |
| 6605 Lisp_Object tail, regexp; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
6606 |
| 24995 | 6607 for (tail = Vscalable_fonts_allowed; CONSP (tail); tail = XCDR (tail)) |
| 6608 { | |
| 6609 regexp = XCAR (tail); | |
| 6610 if (STRINGP (regexp) | |
|
37186
e47810283f6b
(best_matching_font): Remove unused parameter PATTERN.
Gerd Moellmann <gerd@gnu.org>
parents:
37036
diff
changeset
|
6611 && fast_c_string_match_ignore_case (regexp, font) >= 0) |
| 24995 | 6612 return 1; |
| 6613 } | |
| 6614 } | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
6615 |
| 24995 | 6616 return 0; |
| 6617 } | |
| 6618 | |
| 6619 | |
| 6620 | |
|
36066
ea51e9f7266e
(best_matching_font): New parameter width_ratio.
Gerd Moellmann <gerd@gnu.org>
parents:
36006
diff
changeset
|
6621 /* Return the name of the best matching font for face attributes ATTRS |
|
ea51e9f7266e
(best_matching_font): New parameter width_ratio.
Gerd Moellmann <gerd@gnu.org>
parents:
36006
diff
changeset
|
6622 in the array of font_name structures FONTS which contains NFONTS |
|
ea51e9f7266e
(best_matching_font): New parameter width_ratio.
Gerd Moellmann <gerd@gnu.org>
parents:
36006
diff
changeset
|
6623 elements. WIDTH_RATIO is a factor with which to multiply average |
|
ea51e9f7266e
(best_matching_font): New parameter width_ratio.
Gerd Moellmann <gerd@gnu.org>
parents:
36006
diff
changeset
|
6624 widths if ATTRS specifies such a width. |
|
ea51e9f7266e
(best_matching_font): New parameter width_ratio.
Gerd Moellmann <gerd@gnu.org>
parents:
36006
diff
changeset
|
6625 |
|
ea51e9f7266e
(best_matching_font): New parameter width_ratio.
Gerd Moellmann <gerd@gnu.org>
parents:
36006
diff
changeset
|
6626 Value is a font name which is allocated from the heap. FONTS is |
|
48384
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
6627 freed by this function. |
|
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
6628 |
|
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
6629 If NEEDS_OVERSTRIKE is non-zero, a boolean is returned in it to |
|
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
6630 indicate whether the resulting font should be drawn using overstrike |
|
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
6631 to simulate bold-face. */ |
| 24995 | 6632 |
| 6633 static char * | |
|
48384
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
6634 best_matching_font (f, attrs, fonts, nfonts, width_ratio, needs_overstrike) |
| 24995 | 6635 struct frame *f; |
| 6636 Lisp_Object *attrs; | |
| 6637 struct font_name *fonts; | |
| 6638 int nfonts; | |
|
36066
ea51e9f7266e
(best_matching_font): New parameter width_ratio.
Gerd Moellmann <gerd@gnu.org>
parents:
36006
diff
changeset
|
6639 int width_ratio; |
|
48384
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
6640 int *needs_overstrike; |
| 24995 | 6641 { |
| 6642 char *font_name; | |
| 6643 struct font_name *best; | |
|
31507
ac6d049932e9
(Finternal_merge_in_global_face): Return a Lisp object.
Gerd Moellmann <gerd@gnu.org>
parents:
31483
diff
changeset
|
6644 int i, pt = 0; |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6645 int specified[5]; |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6646 int exact_p, avgwidth; |
| 24995 | 6647 |
| 6648 if (nfonts == 0) | |
| 6649 return NULL; | |
| 6650 | |
| 6651 /* Make specified font attributes available in `specified', | |
| 6652 indexed by sort order. */ | |
| 6653 for (i = 0; i < DIM (font_sort_order); ++i) | |
| 6654 { | |
| 6655 int xlfd_idx = font_sort_order[i]; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
6656 |
| 24995 | 6657 if (xlfd_idx == XLFD_SWIDTH) |
| 6658 specified[i] = face_numeric_swidth (attrs[LFACE_SWIDTH_INDEX]); | |
| 6659 else if (xlfd_idx == XLFD_POINT_SIZE) | |
| 6660 specified[i] = pt = XFASTINT (attrs[LFACE_HEIGHT_INDEX]); | |
| 6661 else if (xlfd_idx == XLFD_WEIGHT) | |
| 6662 specified[i] = face_numeric_weight (attrs[LFACE_WEIGHT_INDEX]); | |
| 6663 else if (xlfd_idx == XLFD_SLANT) | |
| 6664 specified[i] = face_numeric_slant (attrs[LFACE_SLANT_INDEX]); | |
| 6665 else | |
| 6666 abort (); | |
| 6667 } | |
| 6668 | |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6669 avgwidth = (UNSPECIFIEDP (attrs[LFACE_AVGWIDTH_INDEX]) |
|
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6670 ? 0 |
|
36066
ea51e9f7266e
(best_matching_font): New parameter width_ratio.
Gerd Moellmann <gerd@gnu.org>
parents:
36006
diff
changeset
|
6671 : XFASTINT (attrs[LFACE_AVGWIDTH_INDEX]) * width_ratio); |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6672 |
| 24995 | 6673 exact_p = 0; |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
6674 |
|
48384
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
6675 if (needs_overstrike) |
|
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
6676 *needs_overstrike = 0; |
|
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
6677 |
| 24995 | 6678 /* Start with the first non-scalable font in the list. */ |
| 6679 for (i = 0; i < nfonts; ++i) | |
| 6680 if (!font_scalable_p (fonts + i)) | |
| 6681 break; | |
| 6682 | |
| 6683 /* Find the best match among the non-scalable fonts. */ | |
| 6684 if (i < nfonts) | |
| 6685 { | |
| 6686 best = fonts + i; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
6687 |
| 24995 | 6688 for (i = 1; i < nfonts; ++i) |
| 6689 if (!font_scalable_p (fonts + i) | |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6690 && better_font_p (specified, fonts + i, best, 1, avgwidth)) |
| 24995 | 6691 { |
| 6692 best = fonts + i; | |
| 6693 | |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6694 exact_p = exact_face_match_p (specified, best, avgwidth); |
| 24995 | 6695 if (exact_p) |
| 6696 break; | |
| 6697 } | |
| 6698 } | |
| 6699 else | |
| 6700 best = NULL; | |
| 6701 | |
| 6702 /* Unless we found an exact match among non-scalable fonts, see if | |
| 6703 we can find a better match among scalable fonts. */ | |
| 6704 if (!exact_p) | |
| 6705 { | |
| 6706 /* A scalable font is better if | |
| 6707 | |
| 6708 1. its weight, slant, swidth attributes are better, or. | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
6709 |
| 24995 | 6710 2. the best non-scalable font doesn't have the required |
| 6711 point size, and the scalable fonts weight, slant, swidth | |
| 6712 isn't worse. */ | |
| 6713 | |
| 6714 int non_scalable_has_exact_height_p; | |
| 6715 | |
| 6716 if (best && best->numeric[XLFD_POINT_SIZE] == pt) | |
| 6717 non_scalable_has_exact_height_p = 1; | |
| 6718 else | |
| 6719 non_scalable_has_exact_height_p = 0; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
6720 |
| 24995 | 6721 for (i = 0; i < nfonts; ++i) |
| 6722 if (font_scalable_p (fonts + i)) | |
| 6723 { | |
| 6724 if (best == NULL | |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6725 || better_font_p (specified, fonts + i, best, 0, 0) |
| 24995 | 6726 || (!non_scalable_has_exact_height_p |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
6727 && !better_font_p (specified, best, fonts + i, 0, 0))) |
|
52200
b154b2a09262
* xfaces.c (better_font_p): Prefer a real scalable font; i.e. not
Kenichi Handa <handa@m17n.org>
parents:
51665
diff
changeset
|
6728 { |
|
b154b2a09262
* xfaces.c (better_font_p): Prefer a real scalable font; i.e. not
Kenichi Handa <handa@m17n.org>
parents:
51665
diff
changeset
|
6729 non_scalable_has_exact_height_p = 1; |
|
b154b2a09262
* xfaces.c (better_font_p): Prefer a real scalable font; i.e. not
Kenichi Handa <handa@m17n.org>
parents:
51665
diff
changeset
|
6730 best = fonts + i; |
|
b154b2a09262
* xfaces.c (better_font_p): Prefer a real scalable font; i.e. not
Kenichi Handa <handa@m17n.org>
parents:
51665
diff
changeset
|
6731 } |
| 24995 | 6732 } |
|
48384
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
6733 |
|
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
6734 if (needs_overstrike) |
|
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
6735 { |
|
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
6736 enum xlfd_weight want_weight = specified[XLFD_WEIGHT]; |
|
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
6737 enum xlfd_weight got_weight = best->numeric[XLFD_WEIGHT]; |
|
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
6738 |
|
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
6739 if (want_weight > XLFD_WEIGHT_MEDIUM && want_weight > got_weight) |
|
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
6740 { |
|
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
6741 /* We want a bold font, but didn't get one; try to use |
|
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
6742 overstriking instead to simulate bold-face. However, |
|
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
6743 don't overstrike an already-bold fontn unless the |
|
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
6744 desired weight grossly exceeds the available weight. */ |
|
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
6745 if (got_weight > XLFD_WEIGHT_MEDIUM) |
|
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
6746 *needs_overstrike = (got_weight - want_weight) > 2; |
|
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
6747 else |
|
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
6748 *needs_overstrike = 1; |
|
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
6749 } |
|
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
6750 } |
| 24995 | 6751 } |
| 6752 | |
| 6753 if (font_scalable_p (best)) | |
| 6754 font_name = build_scalable_font_name (f, best, pt); | |
| 6755 else | |
| 6756 font_name = build_font_name (best); | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
6757 |
| 24995 | 6758 /* Free font_name structures. */ |
| 6759 free_font_names (fonts, nfonts); | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
6760 |
| 24995 | 6761 return font_name; |
| 6762 } | |
| 6763 | |
| 6764 | |
|
37724
3a5a6cd7ee9a
(try_alternative_families): First try the FAMILY.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37716
diff
changeset
|
6765 /* Get a list of matching fonts on frame F, considering FAMILY |
|
3a5a6cd7ee9a
(try_alternative_families): First try the FAMILY.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37716
diff
changeset
|
6766 and alternative font families from Vface_alternative_font_registry_alist. |
|
37679
13efa6105da9
(try_alternative_families): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37433
diff
changeset
|
6767 |
|
13efa6105da9
(try_alternative_families): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37433
diff
changeset
|
6768 FAMILY is the font family whose alternatives are considered. |
|
13efa6105da9
(try_alternative_families): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37433
diff
changeset
|
6769 |
|
13efa6105da9
(try_alternative_families): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37433
diff
changeset
|
6770 REGISTRY, if a string, specifies a font registry and encoding to |
|
13efa6105da9
(try_alternative_families): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37433
diff
changeset
|
6771 match. A value of nil means include fonts of any registry and |
|
13efa6105da9
(try_alternative_families): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37433
diff
changeset
|
6772 encoding. |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48384
diff
changeset
|
6773 |
|
37679
13efa6105da9
(try_alternative_families): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37433
diff
changeset
|
6774 Return in *FONTS a pointer to a vector of font_name structures for |
|
13efa6105da9
(try_alternative_families): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37433
diff
changeset
|
6775 the fonts matched. Value is the number of fonts found. */ |
|
13efa6105da9
(try_alternative_families): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37433
diff
changeset
|
6776 |
|
13efa6105da9
(try_alternative_families): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37433
diff
changeset
|
6777 static int |
|
13efa6105da9
(try_alternative_families): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37433
diff
changeset
|
6778 try_alternative_families (f, family, registry, fonts) |
|
13efa6105da9
(try_alternative_families): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37433
diff
changeset
|
6779 struct frame *f; |
|
13efa6105da9
(try_alternative_families): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37433
diff
changeset
|
6780 Lisp_Object family, registry; |
|
13efa6105da9
(try_alternative_families): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37433
diff
changeset
|
6781 struct font_name **fonts; |
|
13efa6105da9
(try_alternative_families): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37433
diff
changeset
|
6782 { |
|
13efa6105da9
(try_alternative_families): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37433
diff
changeset
|
6783 Lisp_Object alter; |
|
13efa6105da9
(try_alternative_families): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37433
diff
changeset
|
6784 int nfonts = 0; |
|
13efa6105da9
(try_alternative_families): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37433
diff
changeset
|
6785 |
|
37724
3a5a6cd7ee9a
(try_alternative_families): First try the FAMILY.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37716
diff
changeset
|
6786 nfonts = font_list (f, Qnil, family, registry, fonts); |
|
3a5a6cd7ee9a
(try_alternative_families): First try the FAMILY.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37716
diff
changeset
|
6787 if (nfonts == 0) |
|
3a5a6cd7ee9a
(try_alternative_families): First try the FAMILY.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37716
diff
changeset
|
6788 { |
|
3a5a6cd7ee9a
(try_alternative_families): First try the FAMILY.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37716
diff
changeset
|
6789 /* Try alternative font families. */ |
|
3a5a6cd7ee9a
(try_alternative_families): First try the FAMILY.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37716
diff
changeset
|
6790 alter = Fassoc (family, Vface_alternative_font_family_alist); |
|
3a5a6cd7ee9a
(try_alternative_families): First try the FAMILY.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37716
diff
changeset
|
6791 if (CONSP (alter)) |
|
37679
13efa6105da9
(try_alternative_families): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37433
diff
changeset
|
6792 { |
|
37724
3a5a6cd7ee9a
(try_alternative_families): First try the FAMILY.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37716
diff
changeset
|
6793 for (alter = XCDR (alter); |
|
3a5a6cd7ee9a
(try_alternative_families): First try the FAMILY.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37716
diff
changeset
|
6794 CONSP (alter) && nfonts == 0; |
|
3a5a6cd7ee9a
(try_alternative_families): First try the FAMILY.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37716
diff
changeset
|
6795 alter = XCDR (alter)) |
|
3a5a6cd7ee9a
(try_alternative_families): First try the FAMILY.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37716
diff
changeset
|
6796 { |
|
3a5a6cd7ee9a
(try_alternative_families): First try the FAMILY.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37716
diff
changeset
|
6797 if (STRINGP (XCAR (alter))) |
|
3a5a6cd7ee9a
(try_alternative_families): First try the FAMILY.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37716
diff
changeset
|
6798 nfonts = font_list (f, Qnil, XCAR (alter), registry, fonts); |
|
3a5a6cd7ee9a
(try_alternative_families): First try the FAMILY.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37716
diff
changeset
|
6799 } |
|
37679
13efa6105da9
(try_alternative_families): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37433
diff
changeset
|
6800 } |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48384
diff
changeset
|
6801 |
|
49864
a2add8cdc33a
(try_alternative_families): Try all scalable fonts if
Kenichi Handa <handa@m17n.org>
parents:
49863
diff
changeset
|
6802 /* Try all scalable fonts before giving up. */ |
|
a2add8cdc33a
(try_alternative_families): Try all scalable fonts if
Kenichi Handa <handa@m17n.org>
parents:
49863
diff
changeset
|
6803 if (nfonts == 0 && ! EQ (Vscalable_fonts_allowed, Qt)) |
|
37724
3a5a6cd7ee9a
(try_alternative_families): First try the FAMILY.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37716
diff
changeset
|
6804 { |
|
46285
3f111801efb4
Rename BINDING_STACK_SIZE to SPECPDL_INDEX.
Juanma Barranquero <lekktu@gmail.com>
parents:
45848
diff
changeset
|
6805 int count = SPECPDL_INDEX (); |
|
37724
3a5a6cd7ee9a
(try_alternative_families): First try the FAMILY.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37716
diff
changeset
|
6806 specbind (Qscalable_fonts_allowed, Qt); |
|
3a5a6cd7ee9a
(try_alternative_families): First try the FAMILY.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37716
diff
changeset
|
6807 nfonts = try_alternative_families (f, family, registry, fonts); |
|
3a5a6cd7ee9a
(try_alternative_families): First try the FAMILY.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37716
diff
changeset
|
6808 unbind_to (count, Qnil); |
|
3a5a6cd7ee9a
(try_alternative_families): First try the FAMILY.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37716
diff
changeset
|
6809 } |
|
3a5a6cd7ee9a
(try_alternative_families): First try the FAMILY.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37716
diff
changeset
|
6810 } |
|
37679
13efa6105da9
(try_alternative_families): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37433
diff
changeset
|
6811 return nfonts; |
|
13efa6105da9
(try_alternative_families): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37433
diff
changeset
|
6812 } |
|
13efa6105da9
(try_alternative_families): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37433
diff
changeset
|
6813 |
|
13efa6105da9
(try_alternative_families): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37433
diff
changeset
|
6814 |
|
37186
e47810283f6b
(best_matching_font): Remove unused parameter PATTERN.
Gerd Moellmann <gerd@gnu.org>
parents:
37036
diff
changeset
|
6815 /* Get a list of matching fonts on frame F. |
|
e47810283f6b
(best_matching_font): Remove unused parameter PATTERN.
Gerd Moellmann <gerd@gnu.org>
parents:
37036
diff
changeset
|
6816 |
| 88907 | 6817 PATTERN, if a string, specifies a font name pattern to match while |
| 6818 ignoring FAMILY and REGISTRY. | |
| 6819 | |
| 6820 FAMILY, if a list, specifies a list of font families to try. | |
| 6821 | |
| 6822 REGISTRY, if a list, specifies a list of font registries and | |
| 6823 encodinging to try. | |
|
47618
e620377a0596
(try_font_list): New arg PREFER_FACE_FAMILY. If it is
Kenichi Handa <handa@m17n.org>
parents:
47471
diff
changeset
|
6824 |
|
37186
e47810283f6b
(best_matching_font): Remove unused parameter PATTERN.
Gerd Moellmann <gerd@gnu.org>
parents:
37036
diff
changeset
|
6825 Return in *FONTS a pointer to a vector of font_name structures for |
|
e47810283f6b
(best_matching_font): Remove unused parameter PATTERN.
Gerd Moellmann <gerd@gnu.org>
parents:
37036
diff
changeset
|
6826 the fonts matched. Value is the number of fonts found. */ |
| 24995 | 6827 |
| 6828 static int | |
| 88907 | 6829 try_font_list (f, pattern, family, registry, fonts) |
| 24995 | 6830 struct frame *f; |
|
88939
13e20ef7c935
(font_name_registry, choose_face_font): Delete unused
Dave Love <fx@gnu.org>
parents:
88907
diff
changeset
|
6831 Lisp_Object pattern, family, registry; |
| 24995 | 6832 struct font_name **fonts; |
| 6833 { | |
|
37679
13efa6105da9
(try_alternative_families): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37433
diff
changeset
|
6834 int nfonts = 0; |
| 88907 | 6835 |
| 6836 if (STRINGP (pattern)) | |
|
89844
02a959f3ee57
(build_scalable_font_name): If the scalable font is requested for
Kenichi Handa <handa@m17n.org>
parents:
89838
diff
changeset
|
6837 { |
|
02a959f3ee57
(build_scalable_font_name): If the scalable font is requested for
Kenichi Handa <handa@m17n.org>
parents:
89838
diff
changeset
|
6838 nfonts = font_list (f, pattern, Qnil, Qnil, fonts); |
|
02a959f3ee57
(build_scalable_font_name): If the scalable font is requested for
Kenichi Handa <handa@m17n.org>
parents:
89838
diff
changeset
|
6839 if (nfonts == 0 && ! EQ (Vscalable_fonts_allowed, Qt)) |
|
02a959f3ee57
(build_scalable_font_name): If the scalable font is requested for
Kenichi Handa <handa@m17n.org>
parents:
89838
diff
changeset
|
6840 { |
|
02a959f3ee57
(build_scalable_font_name): If the scalable font is requested for
Kenichi Handa <handa@m17n.org>
parents:
89838
diff
changeset
|
6841 int count = SPECPDL_INDEX (); |
|
02a959f3ee57
(build_scalable_font_name): If the scalable font is requested for
Kenichi Handa <handa@m17n.org>
parents:
89838
diff
changeset
|
6842 specbind (Qscalable_fonts_allowed, Qt); |
|
02a959f3ee57
(build_scalable_font_name): If the scalable font is requested for
Kenichi Handa <handa@m17n.org>
parents:
89838
diff
changeset
|
6843 nfonts = font_list (f, pattern, Qnil, Qnil, fonts); |
|
02a959f3ee57
(build_scalable_font_name): If the scalable font is requested for
Kenichi Handa <handa@m17n.org>
parents:
89838
diff
changeset
|
6844 unbind_to (count, Qnil); |
|
02a959f3ee57
(build_scalable_font_name): If the scalable font is requested for
Kenichi Handa <handa@m17n.org>
parents:
89838
diff
changeset
|
6845 } |
|
02a959f3ee57
(build_scalable_font_name): If the scalable font is requested for
Kenichi Handa <handa@m17n.org>
parents:
89838
diff
changeset
|
6846 } |
| 88907 | 6847 else |
| 6848 { | |
| 6849 Lisp_Object tail; | |
| 6850 | |
| 6851 if (NILP (family)) | |
| 6852 nfonts = font_list (f, Qnil, Qnil, registry, fonts); | |
|
37724
3a5a6cd7ee9a
(try_alternative_families): First try the FAMILY.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37716
diff
changeset
|
6853 else |
| 88907 | 6854 for (tail = family; ! nfonts && CONSP (tail); tail = XCDR (tail)) |
| 6855 nfonts = try_alternative_families (f, XCAR (tail), registry, fonts); | |
| 6856 | |
| 6857 /* Try font family of the default face or "fixed". */ | |
| 6858 if (nfonts == 0 && !NILP (family)) | |
| 6859 { | |
| 6860 struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); | |
| 6861 if (default_face) | |
| 6862 family = default_face->lface[LFACE_FAMILY_INDEX]; | |
| 6863 else | |
| 6864 family = build_string ("fixed"); | |
| 89483 | 6865 nfonts = try_alternative_families (f, family, registry, fonts); |
| 88907 | 6866 } |
| 89483 | 6867 |
| 88907 | 6868 /* Try any family with the given registry. */ |
| 6869 if (nfonts == 0 && !NILP (family)) | |
| 89483 | 6870 nfonts = try_alternative_families (f, Qnil, registry, fonts); |
| 88907 | 6871 } |
| 24995 | 6872 |
| 6873 return nfonts; | |
| 6874 } | |
| 6875 | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
6876 |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
6877 /* Return the fontset id of the base fontset name or alias name given |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
6878 by the fontset attribute of ATTRS. Value is -1 if the fontset |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
6879 attribute of ATTRS doesn't name a fontset. */ |
| 24995 | 6880 |
| 6881 static int | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
6882 face_fontset (attrs) |
| 24995 | 6883 Lisp_Object *attrs; |
| 6884 { | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
6885 Lisp_Object name; |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
6886 |
|
89047
3b6234eb229c
(QCfontset): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88939
diff
changeset
|
6887 name = attrs[LFACE_FONTSET_INDEX]; |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
6888 if (!STRINGP (name)) |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
6889 return -1; |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
6890 return fs_query_fontset (name, 0); |
| 24995 | 6891 } |
| 6892 | |
| 6893 | |
| 88907 | 6894 /* Choose a name of font to use on frame F to display characters with |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
6895 Lisp face attributes specified by ATTRS. The font name is |
| 88907 | 6896 determined by the font-related attributes in ATTRS and FONT-SPEC |
| 6897 (if specified). | |
| 6898 | |
| 6899 When we are choosing a font for ASCII characters, FONT-SPEC is | |
| 6900 always nil. Otherwise FONT-SPEC is a list | |
| 6901 [ FAMILY WEIGHT SLANT SWIDTH ADSTYLE REGISTRY ] | |
| 6902 or a string specifying a font name pattern. | |
| 6903 | |
| 89483 | 6904 If NEEDS_OVERSTRIKE is not NULL, a boolean is returned in it to |
| 6905 indicate whether the resulting font should be drawn using | |
| 6906 overstrike to simulate bold-face. | |
| 6907 | |
| 88907 | 6908 Value is the font name which is allocated from the heap and must be |
| 6909 freed by the caller. */ | |
| 6910 | |
| 6911 char * | |
| 89483 | 6912 choose_face_font (f, attrs, font_spec, needs_overstrike) |
| 24995 | 6913 struct frame *f; |
| 6914 Lisp_Object *attrs; | |
| 88907 | 6915 Lisp_Object font_spec; |
|
48384
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
6916 int *needs_overstrike; |
| 24995 | 6917 { |
| 88907 | 6918 Lisp_Object pattern, family, adstyle, registry; |
| 24995 | 6919 char *font_name = NULL; |
| 6920 struct font_name *fonts; | |
| 88907 | 6921 int nfonts; |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
6922 |
|
50412
49cba7ce673a
(choose_face_font): Make sure *NEEDS_OVERSTRIKE is always set.
Miles Bader <miles@gnu.org>
parents:
50369
diff
changeset
|
6923 if (needs_overstrike) |
|
49cba7ce673a
(choose_face_font): Make sure *NEEDS_OVERSTRIKE is always set.
Miles Bader <miles@gnu.org>
parents:
50369
diff
changeset
|
6924 *needs_overstrike = 0; |
|
49cba7ce673a
(choose_face_font): Make sure *NEEDS_OVERSTRIKE is always set.
Miles Bader <miles@gnu.org>
parents:
50369
diff
changeset
|
6925 |
| 88907 | 6926 /* If we are choosing an ASCII font and a font name is explicitly |
| 6927 specified in ATTRS, return it. */ | |
| 6928 if (NILP (font_spec) && STRINGP (attrs[LFACE_FONT_INDEX])) | |
| 89483 | 6929 return xstrdup (SDATA (attrs[LFACE_FONT_INDEX])); |
|
88394
b954eee715da
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
43270
diff
changeset
|
6930 |
| 88907 | 6931 if (NILP (attrs[LFACE_FAMILY_INDEX])) |
|
88394
b954eee715da
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
43270
diff
changeset
|
6932 family = Qnil; |
| 88907 | 6933 else |
| 6934 family = Fcons (attrs[LFACE_FAMILY_INDEX], Qnil); | |
| 6935 | |
|
89348
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
6936 /* Decide FAMILY, ADSTYLE, and REGISTRY from FONT_SPEC. But, |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
6937 ADSTYLE is not used in the font selector for the moment. */ |
| 88907 | 6938 if (VECTORP (font_spec)) |
| 6939 { | |
| 6940 pattern = Qnil; | |
| 6941 if (STRINGP (AREF (font_spec, FONT_SPEC_FAMILY_INDEX))) | |
| 6942 family = Fcons (AREF (font_spec, FONT_SPEC_FAMILY_INDEX), family); | |
| 6943 adstyle = AREF (font_spec, FONT_SPEC_ADSTYLE_INDEX); | |
|
89348
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
6944 registry = Fcons (AREF (font_spec, FONT_SPEC_REGISTRY_INDEX), Qnil); |
| 88907 | 6945 } |
| 6946 else if (STRINGP (font_spec)) | |
| 6947 { | |
| 6948 pattern = font_spec; | |
| 6949 family = Qnil; | |
| 6950 adstyle = Qnil; | |
| 6951 registry = Qnil; | |
| 6952 } | |
| 6953 else | |
| 6954 { | |
|
89348
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
6955 /* We are choosing an ASCII font. By default, use the registry |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
6956 name "iso8859-1". But, if the registry name of the ASCII |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
6957 font specified in the fontset of ATTRS is not "iso8859-1" |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
6958 (e.g "iso10646-1"), use also that name with higher |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
6959 priority. */ |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
6960 int fontset = face_fontset (attrs); |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
6961 Lisp_Object ascii; |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
6962 int len; |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
6963 struct font_name font; |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
6964 |
| 88907 | 6965 pattern = Qnil; |
| 6966 adstyle = Qnil; | |
|
89348
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
6967 registry = Fcons (build_string ("iso8859-1"), Qnil); |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
6968 |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
6969 ascii = fontset_ascii (fontset); |
| 89483 | 6970 len = SBYTES (ascii); |
|
89348
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
6971 if (len < 9 |
| 89483 | 6972 || strcmp (SDATA (ascii) + len - 9, "iso8859-1")) |
|
89348
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
6973 { |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
6974 font.name = LSTRDUPA (ascii); |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
6975 /* Check if the name is in XLFD. */ |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
6976 if (split_font_name (f, &font, 0)) |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
6977 { |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
6978 font.fields[XLFD_ENCODING][-1] = '-'; |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
6979 registry = Fcons (build_string (font.fields[XLFD_REGISTRY]), |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
6980 registry); |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
6981 } |
|
e4ea90e23f57
(generate_ascii_font_name): Moved to fontset.c.
Kenichi Handa <handa@m17n.org>
parents:
89260
diff
changeset
|
6982 } |
| 88907 | 6983 } |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
6984 |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
6985 /* Get a list of fonts matching that pattern and choose the |
| 24995 | 6986 best match for the specified face attributes from it. */ |
| 88907 | 6987 nfonts = try_font_list (f, pattern, family, registry, &fonts); |
| 89483 | 6988 font_name = best_matching_font (f, attrs, fonts, nfonts, NILP (font_spec), |
|
48384
acfaa904eb56
(load_face_font): Set `face->overstrike' based on result from
Miles Bader <miles@gnu.org>
parents:
47983
diff
changeset
|
6989 needs_overstrike); |
| 24995 | 6990 return font_name; |
| 6991 } | |
| 6992 | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
6993 #endif /* HAVE_WINDOW_SYSTEM */ |
| 24995 | 6994 |
| 6995 | |
| 6996 | |
| 6997 /*********************************************************************** | |
| 6998 Face Realization | |
| 6999 ***********************************************************************/ | |
| 7000 | |
| 7001 /* Realize basic faces on frame F. Value is zero if frame parameters | |
| 7002 of F don't contain enough information needed to realize the default | |
| 7003 face. */ | |
| 7004 | |
| 7005 static int | |
| 7006 realize_basic_faces (f) | |
| 2342 | 7007 struct frame *f; |
| 24995 | 7008 { |
| 7009 int success_p = 0; | |
|
46285
3f111801efb4
Rename BINDING_STACK_SIZE to SPECPDL_INDEX.
Juanma Barranquero <lekktu@gmail.com>
parents:
45848
diff
changeset
|
7010 int count = SPECPDL_INDEX (); |
|
28461
b6b552188c57
(realize_basic_faces): Block input while realizing
Gerd Moellmann <gerd@gnu.org>
parents:
28412
diff
changeset
|
7011 |
|
38802
7ca6f1c8e014
(x_update_menu_appearance): Save and restore value of
Gerd Moellmann <gerd@gnu.org>
parents:
38435
diff
changeset
|
7012 /* Block input here so that we won't be surprised by an X expose |
|
7ca6f1c8e014
(x_update_menu_appearance): Save and restore value of
Gerd Moellmann <gerd@gnu.org>
parents:
38435
diff
changeset
|
7013 event, for instance, without having the faces set up. */ |
|
28461
b6b552188c57
(realize_basic_faces): Block input while realizing
Gerd Moellmann <gerd@gnu.org>
parents:
28412
diff
changeset
|
7014 BLOCK_INPUT; |
|
37394
7847d9b8bbff
(Qscalable_fonts_allowed): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37206
diff
changeset
|
7015 specbind (Qscalable_fonts_allowed, Qt); |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
7016 |
| 24995 | 7017 if (realize_default_face (f)) |
| 7018 { | |
|
25661
a6e2ae7964fb
(Fx_family_fonts): Replaces Fx_font_list.
Gerd Moellmann <gerd@gnu.org>
parents:
25592
diff
changeset
|
7019 realize_named_face (f, Qmode_line, MODE_LINE_FACE_ID); |
|
43203
dd98ef3675e5
(Qmode_line_inactive): New face variable for mode-line
Kim F. Storm <storm@cua.dk>
parents:
43069
diff
changeset
|
7020 realize_named_face (f, Qmode_line_inactive, MODE_LINE_INACTIVE_FACE_ID); |
|
25544
693ca9ba497a
Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents:
25389
diff
changeset
|
7021 realize_named_face (f, Qtool_bar, TOOL_BAR_FACE_ID); |
| 41129 | 7022 realize_named_face (f, Qfringe, FRINGE_FACE_ID); |
| 25546 | 7023 realize_named_face (f, Qheader_line, HEADER_LINE_FACE_ID); |
|
25592
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
7024 realize_named_face (f, Qscroll_bar, SCROLL_BAR_FACE_ID); |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
7025 realize_named_face (f, Qborder, BORDER_FACE_ID); |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
7026 realize_named_face (f, Qcursor, CURSOR_FACE_ID); |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
7027 realize_named_face (f, Qmouse, MOUSE_FACE_ID); |
|
25883
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
7028 realize_named_face (f, Qmenu, MENU_FACE_ID); |
|
33082
5ab6f3e1f5c8
(menu_face_change_count): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33070
diff
changeset
|
7029 |
|
33275
8c453c73a11b
(lookup_named_face): If default face isn't realized,
Gerd Moellmann <gerd@gnu.org>
parents:
33082
diff
changeset
|
7030 /* Reflect changes in the `menu' face in menu bars. */ |
|
38905
70ef1eb656a6
(menu_face_changed_default): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38818
diff
changeset
|
7031 if (FRAME_FACE_CACHE (f)->menu_face_changed_p) |
|
33082
5ab6f3e1f5c8
(menu_face_change_count): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33070
diff
changeset
|
7032 { |
|
38905
70ef1eb656a6
(menu_face_changed_default): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38818
diff
changeset
|
7033 FRAME_FACE_CACHE (f)->menu_face_changed_p = 0; |
|
33082
5ab6f3e1f5c8
(menu_face_change_count): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33070
diff
changeset
|
7034 #ifdef USE_X_TOOLKIT |
|
36942
98755810fe71
(x_update_menu_appearance): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
36936
diff
changeset
|
7035 x_update_menu_appearance (f); |
|
36936
bda3649d35fd
(x_set_menu_resources_from_menu_face) [USE_X_TOOLKIT]:
Gerd Moellmann <gerd@gnu.org>
parents:
36932
diff
changeset
|
7036 #endif |
|
33082
5ab6f3e1f5c8
(menu_face_change_count): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33070
diff
changeset
|
7037 } |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48384
diff
changeset
|
7038 |
| 24995 | 7039 success_p = 1; |
| 7040 } | |
| 7041 | |
|
37394
7847d9b8bbff
(Qscalable_fonts_allowed): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37206
diff
changeset
|
7042 unbind_to (count, Qnil); |
|
28461
b6b552188c57
(realize_basic_faces): Block input while realizing
Gerd Moellmann <gerd@gnu.org>
parents:
28412
diff
changeset
|
7043 UNBLOCK_INPUT; |
| 24995 | 7044 return success_p; |
| 7045 } | |
| 7046 | |
| 7047 | |
| 7048 /* Realize the default face on frame F. If the face is not fully | |
| 7049 specified, make it fully-specified. Attributes of the default face | |
| 7050 that are not explicitly specified are taken from frame parameters. */ | |
| 7051 | |
| 7052 static int | |
| 7053 realize_default_face (f) | |
| 7054 struct frame *f; | |
| 7055 { | |
| 7056 struct face_cache *c = FRAME_FACE_CACHE (f); | |
| 7057 Lisp_Object lface; | |
| 7058 Lisp_Object attrs[LFACE_VECTOR_SIZE]; | |
| 7059 Lisp_Object frame_font; | |
| 7060 struct face *face; | |
| 7061 | |
| 7062 /* If the `default' face is not yet known, create it. */ | |
| 7063 lface = lface_from_face_name (f, Qdefault, 0); | |
| 7064 if (NILP (lface)) | |
|
51315
7156fc3b3571
(realize_default_face): Do not abort if lface is non-existent -
Glenn Morris <rgm@gnu.org>
parents:
51237
diff
changeset
|
7065 { |
|
7156fc3b3571
(realize_default_face): Do not abort if lface is non-existent -
Glenn Morris <rgm@gnu.org>
parents:
51237
diff
changeset
|
7066 Lisp_Object frame; |
|
7156fc3b3571
(realize_default_face): Do not abort if lface is non-existent -
Glenn Morris <rgm@gnu.org>
parents:
51237
diff
changeset
|
7067 XSETFRAME (frame, f); |
|
7156fc3b3571
(realize_default_face): Do not abort if lface is non-existent -
Glenn Morris <rgm@gnu.org>
parents:
51237
diff
changeset
|
7068 lface = Finternal_make_lisp_face (Qdefault, frame); |
|
7156fc3b3571
(realize_default_face): Do not abort if lface is non-existent -
Glenn Morris <rgm@gnu.org>
parents:
51237
diff
changeset
|
7069 } |
|
7156fc3b3571
(realize_default_face): Do not abort if lface is non-existent -
Glenn Morris <rgm@gnu.org>
parents:
51237
diff
changeset
|
7070 |
| 24995 | 7071 |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
7072 #ifdef HAVE_WINDOW_SYSTEM |
|
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
7073 if (FRAME_WINDOW_P (f)) |
| 24995 | 7074 { |
| 7075 /* Set frame_font to the value of the `font' frame parameter. */ | |
| 7076 frame_font = Fassq (Qfont, f->param_alist); | |
| 7077 xassert (CONSP (frame_font) && STRINGP (XCDR (frame_font))); | |
| 7078 frame_font = XCDR (frame_font); | |
|
51665
c1f65dfc56eb
Fix some of the font/face problems.
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
51500
diff
changeset
|
7079 set_lface_from_font_name (f, lface, frame_font, |
|
c1f65dfc56eb
Fix some of the font/face problems.
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
51500
diff
changeset
|
7080 f->default_face_done_p, 1); |
|
c1f65dfc56eb
Fix some of the font/face problems.
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
51500
diff
changeset
|
7081 f->default_face_done_p = 1; |
| 24995 | 7082 } |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
7083 #endif /* HAVE_WINDOW_SYSTEM */ |
| 24995 | 7084 |
|
25114
be5d3e21fbd7
(load_color): Remove static from definition and remove
Eli Zaretskii <eliz@gnu.org>
parents:
25092
diff
changeset
|
7085 if (!FRAME_WINDOW_P (f)) |
| 24995 | 7086 { |
| 7087 LFACE_FAMILY (lface) = build_string ("default"); | |
| 7088 LFACE_SWIDTH (lface) = Qnormal; | |
| 7089 LFACE_HEIGHT (lface) = make_number (1); | |
|
43069
e1291f1c4a5b
(realize_default_face): Don't set the weight and slant
Eli Zaretskii <eliz@gnu.org>
parents:
42206
diff
changeset
|
7090 if (UNSPECIFIEDP (LFACE_WEIGHT (lface))) |
|
e1291f1c4a5b
(realize_default_face): Don't set the weight and slant
Eli Zaretskii <eliz@gnu.org>
parents:
42206
diff
changeset
|
7091 LFACE_WEIGHT (lface) = Qnormal; |
|
e1291f1c4a5b
(realize_default_face): Don't set the weight and slant
Eli Zaretskii <eliz@gnu.org>
parents:
42206
diff
changeset
|
7092 if (UNSPECIFIEDP (LFACE_SLANT (lface))) |
|
e1291f1c4a5b
(realize_default_face): Don't set the weight and slant
Eli Zaretskii <eliz@gnu.org>
parents:
42206
diff
changeset
|
7093 LFACE_SLANT (lface) = Qnormal; |
|
35913
d3591f4747d7
(split_font_name): Compute numeric value of
Gerd Moellmann <gerd@gnu.org>
parents:
35843
diff
changeset
|
7094 LFACE_AVGWIDTH (lface) = Qunspecified; |
| 24995 | 7095 } |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
7096 |
| 24995 | 7097 if (UNSPECIFIEDP (LFACE_UNDERLINE (lface))) |
| 7098 LFACE_UNDERLINE (lface) = Qnil; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
7099 |
| 24995 | 7100 if (UNSPECIFIEDP (LFACE_OVERLINE (lface))) |
| 7101 LFACE_OVERLINE (lface) = Qnil; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
7102 |
| 24995 | 7103 if (UNSPECIFIEDP (LFACE_STRIKE_THROUGH (lface))) |
| 7104 LFACE_STRIKE_THROUGH (lface) = Qnil; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
7105 |
| 24995 | 7106 if (UNSPECIFIEDP (LFACE_BOX (lface))) |
| 7107 LFACE_BOX (lface) = Qnil; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
7108 |
| 24995 | 7109 if (UNSPECIFIEDP (LFACE_INVERSE (lface))) |
| 7110 LFACE_INVERSE (lface) = Qnil; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
7111 |
| 24995 | 7112 if (UNSPECIFIEDP (LFACE_FOREGROUND (lface))) |
| 7113 { | |
| 7114 /* This function is called so early that colors are not yet | |
| 7115 set in the frame parameter list. */ | |
| 7116 Lisp_Object color = Fassq (Qforeground_color, f->param_alist); | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
7117 |
| 24995 | 7118 if (CONSP (color) && STRINGP (XCDR (color))) |
| 7119 LFACE_FOREGROUND (lface) = XCDR (color); | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
7120 else if (FRAME_WINDOW_P (f)) |
| 24995 | 7121 return 0; |
| 35443 | 7122 else if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)) |
|
27114
4efa5e54e9a9
(Qunspecified_fg, Qunspecified_bg): Remove.
Eli Zaretskii <eliz@gnu.org>
parents:
27100
diff
changeset
|
7123 LFACE_FOREGROUND (lface) = build_string (unspecified_fg); |
|
26902
264b83a3a688
Changes for separate unspecified foreground and background colors
Eli Zaretskii <eliz@gnu.org>
parents:
26875
diff
changeset
|
7124 else |
| 24995 | 7125 abort (); |
| 7126 } | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
7127 |
| 24995 | 7128 if (UNSPECIFIEDP (LFACE_BACKGROUND (lface))) |
| 7129 { | |
| 7130 /* This function is called so early that colors are not yet | |
| 7131 set in the frame parameter list. */ | |
| 7132 Lisp_Object color = Fassq (Qbackground_color, f->param_alist); | |
| 7133 if (CONSP (color) && STRINGP (XCDR (color))) | |
| 7134 LFACE_BACKGROUND (lface) = XCDR (color); | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
7135 else if (FRAME_WINDOW_P (f)) |
| 24995 | 7136 return 0; |
| 35443 | 7137 else if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)) |
|
27114
4efa5e54e9a9
(Qunspecified_fg, Qunspecified_bg): Remove.
Eli Zaretskii <eliz@gnu.org>
parents:
27100
diff
changeset
|
7138 LFACE_BACKGROUND (lface) = build_string (unspecified_bg); |
|
26902
264b83a3a688
Changes for separate unspecified foreground and background colors
Eli Zaretskii <eliz@gnu.org>
parents:
26875
diff
changeset
|
7139 else |
| 24995 | 7140 abort (); |
| 7141 } | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
7142 |
| 24995 | 7143 if (UNSPECIFIEDP (LFACE_STIPPLE (lface))) |
| 7144 LFACE_STIPPLE (lface) = Qnil; | |
| 7145 | |
| 7146 /* Realize the face; it must be fully-specified now. */ | |
| 7147 xassert (lface_fully_specified_p (XVECTOR (lface)->contents)); | |
| 7148 check_lface (lface); | |
| 7149 bcopy (XVECTOR (lface)->contents, attrs, sizeof attrs); | |
| 88907 | 7150 face = realize_face (c, attrs, DEFAULT_FACE_ID); |
| 24995 | 7151 return 1; |
| 7152 } | |
| 7153 | |
| 7154 | |
| 7155 /* Realize basic faces other than the default face in face cache C. | |
| 7156 SYMBOL is the face name, ID is the face id the realized face must | |
| 7157 have. The default face must have been realized already. */ | |
| 7158 | |
| 7159 static void | |
| 7160 realize_named_face (f, symbol, id) | |
| 7161 struct frame *f; | |
| 7162 Lisp_Object symbol; | |
| 7163 int id; | |
| 7164 { | |
| 7165 struct face_cache *c = FRAME_FACE_CACHE (f); | |
| 7166 Lisp_Object lface = lface_from_face_name (f, symbol, 0); | |
| 7167 Lisp_Object attrs[LFACE_VECTOR_SIZE]; | |
| 7168 Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE]; | |
| 7169 struct face *new_face; | |
| 7170 | |
| 7171 /* The default face must exist and be fully specified. */ | |
| 7172 get_lface_attributes (f, Qdefault, attrs, 1); | |
| 7173 check_lface_attrs (attrs); | |
| 7174 xassert (lface_fully_specified_p (attrs)); | |
| 7175 | |
| 7176 /* If SYMBOL isn't know as a face, create it. */ | |
| 7177 if (NILP (lface)) | |
| 7178 { | |
| 7179 Lisp_Object frame; | |
| 7180 XSETFRAME (frame, f); | |
| 7181 lface = Finternal_make_lisp_face (symbol, frame); | |
| 7182 } | |
| 7183 | |
| 7184 /* Merge SYMBOL's face with the default face. */ | |
| 7185 get_lface_attributes (f, symbol, symbol_attrs, 1); | |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
7186 merge_face_vectors (f, symbol_attrs, attrs, 0); |
| 24995 | 7187 |
| 7188 /* Realize the face. */ | |
| 88907 | 7189 new_face = realize_face (c, attrs, id); |
| 24995 | 7190 } |
| 7191 | |
| 7192 | |
| 7193 /* Realize the fully-specified face with attributes ATTRS in face | |
| 88907 | 7194 cache CACHE for ASCII characters. If FORMER_FACE_ID is |
| 7195 non-negative, it is an ID of face to remove before caching the new | |
| 7196 face. Value is a pointer to the newly created realized face. */ | |
| 24995 | 7197 |
| 7198 static struct face * | |
| 88907 | 7199 realize_face (cache, attrs, former_face_id) |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7200 struct face_cache *cache; |
| 24995 | 7201 Lisp_Object *attrs; |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7202 int former_face_id; |
| 24995 | 7203 { |
| 7204 struct face *face; | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
7205 |
| 24995 | 7206 /* LFACE must be fully specified. */ |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7207 xassert (cache != NULL); |
| 24995 | 7208 check_lface_attrs (attrs); |
| 7209 | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7210 if (former_face_id >= 0 && cache->used > former_face_id) |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7211 { |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7212 /* Remove the former face. */ |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7213 struct face *former_face = cache->faces_by_id[former_face_id]; |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7214 uncache_face (cache, former_face); |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7215 free_realized_face (cache->f, former_face); |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7216 } |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7217 |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7218 if (FRAME_WINDOW_P (cache->f)) |
| 88907 | 7219 face = realize_x_face (cache, attrs); |
| 35443 | 7220 else if (FRAME_TERMCAP_P (cache->f) || FRAME_MSDOS_P (cache->f)) |
| 88907 | 7221 face = realize_tty_face (cache, attrs); |
| 24995 | 7222 else |
| 7223 abort (); | |
| 7224 | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7225 /* Insert the new face. */ |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7226 cache_face (cache, face, lface_hash (attrs)); |
| 88907 | 7227 return face; |
| 7228 } | |
| 7229 | |
| 7230 | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7231 #ifdef HAVE_WINDOW_SYSTEM |
| 88907 | 7232 /* Realize the fully-specified face that has the same attributes as |
| 7233 BASE_FACE except for the font on frame F. If FONT_ID is not | |
| 7234 negative, it is an ID number of an already opened font that should | |
| 7235 be used by the face. If FONT_ID is negative, the face has no font, | |
| 7236 i.e., characters are displayed by empty boxes. */ | |
| 7237 | |
| 7238 static struct face * | |
| 7239 realize_non_ascii_face (f, font_id, base_face) | |
| 7240 struct frame *f; | |
| 7241 int font_id; | |
| 7242 struct face *base_face; | |
| 7243 { | |
| 7244 struct face_cache *cache = FRAME_FACE_CACHE (f); | |
| 89483 | 7245 struct face *face; |
| 88907 | 7246 struct font_info *font_info; |
| 7247 | |
| 7248 face = (struct face *) xmalloc (sizeof *face); | |
| 7249 *face = *base_face; | |
| 7250 face->gc = 0; | |
| 7251 | |
| 7252 /* Don't try to free the colors copied bitwise from BASE_FACE. */ | |
| 7253 face->colors_copied_bitwise_p = 1; | |
| 7254 | |
| 7255 face->font_info_id = font_id; | |
| 7256 if (font_id >= 0) | |
| 7257 { | |
| 7258 font_info = FONT_INFO_FROM_ID (f, font_id); | |
| 7259 face->font = font_info->font; | |
| 7260 face->font_name = font_info->full_name; | |
| 7261 } | |
| 7262 else | |
| 7263 { | |
| 7264 face->font = NULL; | |
| 7265 face->font_name = NULL; | |
| 7266 } | |
| 7267 | |
| 7268 face->gc = 0; | |
| 7269 | |
| 7270 cache_face (cache, face, face->hash); | |
| 7271 | |
| 24995 | 7272 return face; |
| 7273 } | |
|
89950
ad8c5c667a14
(split_font_name_into_vector, build_font_name_from_vector)
Kenichi Handa <handa@m17n.org>
parents:
89948
diff
changeset
|
7274 #endif /* HAVE_WINDOW_SYSTEM */ |
| 24995 | 7275 |
| 7276 | |
| 7277 /* Realize the fully-specified face with attributes ATTRS in face | |
| 88907 | 7278 cache CACHE for ASCII characters. Do it for X frame CACHE->f. If |
| 7279 the new face doesn't share font with the default face, a fontname | |
| 7280 is allocated from the heap and set in `font_name' of the new face, | |
| 7281 but it is not yet loaded here. Value is a pointer to the newly | |
| 7282 created realized face. */ | |
| 24995 | 7283 |
| 7284 static struct face * | |
| 88907 | 7285 realize_x_face (cache, attrs) |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7286 struct face_cache *cache; |
| 24995 | 7287 Lisp_Object *attrs; |
| 7288 { | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
7289 #ifdef HAVE_WINDOW_SYSTEM |
| 24995 | 7290 struct face *face, *default_face; |
|
26875
d6aa11f2a4af
(choose_face_fontset_font): Delete codes for a
Kenichi Handa <handa@m17n.org>
parents:
26759
diff
changeset
|
7291 struct frame *f; |
| 24995 | 7292 Lisp_Object stipple, overline, strike_through, box; |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7293 |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7294 xassert (FRAME_WINDOW_P (cache->f)); |
| 24995 | 7295 |
| 7296 /* Allocate a new realized face. */ | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7297 face = make_realized_face (attrs); |
| 88907 | 7298 face->ascii_face = face; |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7299 |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7300 f = cache->f; |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7301 |
| 24995 | 7302 /* Determine the font to use. Most of the time, the font will be |
| 7303 the same as the font of the default face, so try that first. */ | |
| 7304 default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); | |
| 7305 if (default_face | |
| 7306 && lface_same_font_attributes_p (default_face->lface, attrs)) | |
| 7307 { | |
| 7308 face->font = default_face->font; | |
| 7309 face->font_info_id = default_face->font_info_id; | |
| 7310 face->font_name = default_face->font_name; | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7311 face->fontset |
| 88907 | 7312 = make_fontset_for_ascii_face (f, default_face->fontset, face); |
| 24995 | 7313 } |
| 7314 else | |
| 7315 { | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7316 /* If the face attribute ATTRS specifies a fontset, use it as |
|
30211
8d8aa26c6884
(realize_x_face): Make fontset using the base of the
Kenichi Handa <handa@m17n.org>
parents:
30174
diff
changeset
|
7317 the base of a new realized fontset. Otherwise, use the same |
|
8d8aa26c6884
(realize_x_face): Make fontset using the base of the
Kenichi Handa <handa@m17n.org>
parents:
30174
diff
changeset
|
7318 base fontset as of the default face. The base determines |
|
8d8aa26c6884
(realize_x_face): Make fontset using the base of the
Kenichi Handa <handa@m17n.org>
parents:
30174
diff
changeset
|
7319 registry and encoding of a font. It may also determine |
|
8d8aa26c6884
(realize_x_face): Make fontset using the base of the
Kenichi Handa <handa@m17n.org>
parents:
30174
diff
changeset
|
7320 foundry and family. The other fields of font name pattern |
|
8d8aa26c6884
(realize_x_face): Make fontset using the base of the
Kenichi Handa <handa@m17n.org>
parents:
30174
diff
changeset
|
7321 are constructed from ATTRS. */ |
|
8d8aa26c6884
(realize_x_face): Make fontset using the base of the
Kenichi Handa <handa@m17n.org>
parents:
30174
diff
changeset
|
7322 int fontset = face_fontset (attrs); |
|
8d8aa26c6884
(realize_x_face): Make fontset using the base of the
Kenichi Handa <handa@m17n.org>
parents:
30174
diff
changeset
|
7323 |
| 88907 | 7324 /* If we are realizing the default face, ATTRS should specify a |
| 7325 fontset. In other words, if FONTSET is -1, we are not | |
| 7326 realizing the default face, thus the default face should have | |
| 7327 already been realized. */ | |
| 7328 if (fontset == -1) | |
|
30211
8d8aa26c6884
(realize_x_face): Make fontset using the base of the
Kenichi Handa <handa@m17n.org>
parents:
30174
diff
changeset
|
7329 fontset = default_face->fontset; |
| 88907 | 7330 if (fontset == -1) |
| 7331 abort (); | |
| 89483 | 7332 load_face_font (f, face); |
| 88907 | 7333 face->fontset = make_fontset_for_ascii_face (f, fontset, face); |
| 24995 | 7334 } |
| 7335 | |
| 7336 /* Load colors, and set remaining attributes. */ | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
7337 |
| 24995 | 7338 load_face_colors (f, face, attrs); |
| 7339 | |
| 7340 /* Set up box. */ | |
| 7341 box = attrs[LFACE_BOX_INDEX]; | |
| 7342 if (STRINGP (box)) | |
| 7343 { | |
| 7344 /* A simple box of line width 1 drawn in color given by | |
| 7345 the string. */ | |
| 7346 face->box_color = load_color (f, face, attrs[LFACE_BOX_INDEX], | |
| 7347 LFACE_BOX_INDEX); | |
| 7348 face->box = FACE_SIMPLE_BOX; | |
| 7349 face->box_line_width = 1; | |
| 7350 } | |
| 7351 else if (INTEGERP (box)) | |
| 7352 { | |
| 7353 /* Simple box of specified line width in foreground color of the | |
| 7354 face. */ | |
|
36006
a9d75e8a6cb9
(Finternal_set_lisp_face_attribute): The value of :box
Kenichi Handa <handa@m17n.org>
parents:
35913
diff
changeset
|
7355 xassert (XINT (box) != 0); |
| 24995 | 7356 face->box = FACE_SIMPLE_BOX; |
|
36006
a9d75e8a6cb9
(Finternal_set_lisp_face_attribute): The value of :box
Kenichi Handa <handa@m17n.org>
parents:
35913
diff
changeset
|
7357 face->box_line_width = XINT (box); |
| 24995 | 7358 face->box_color = face->foreground; |
| 7359 face->box_color_defaulted_p = 1; | |
| 7360 } | |
| 7361 else if (CONSP (box)) | |
| 7362 { | |
| 7363 /* `(:width WIDTH :color COLOR :shadow SHADOW)'. SHADOW | |
| 7364 being one of `raised' or `sunken'. */ | |
| 7365 face->box = FACE_SIMPLE_BOX; | |
| 7366 face->box_color = face->foreground; | |
| 7367 face->box_color_defaulted_p = 1; | |
| 7368 face->box_line_width = 1; | |
| 7369 | |
| 7370 while (CONSP (box)) | |
| 7371 { | |
| 7372 Lisp_Object keyword, value; | |
| 7373 | |
| 7374 keyword = XCAR (box); | |
| 7375 box = XCDR (box); | |
| 7376 | |
| 7377 if (!CONSP (box)) | |
| 7378 break; | |
| 7379 value = XCAR (box); | |
| 7380 box = XCDR (box); | |
| 7381 | |
| 7382 if (EQ (keyword, QCline_width)) | |
| 7383 { | |
|
36006
a9d75e8a6cb9
(Finternal_set_lisp_face_attribute): The value of :box
Kenichi Handa <handa@m17n.org>
parents:
35913
diff
changeset
|
7384 if (INTEGERP (value) && XINT (value) != 0) |
|
a9d75e8a6cb9
(Finternal_set_lisp_face_attribute): The value of :box
Kenichi Handa <handa@m17n.org>
parents:
35913
diff
changeset
|
7385 face->box_line_width = XINT (value); |
| 24995 | 7386 } |
| 7387 else if (EQ (keyword, QCcolor)) | |
| 7388 { | |
| 7389 if (STRINGP (value)) | |
| 7390 { | |
| 7391 face->box_color = load_color (f, face, value, | |
| 7392 LFACE_BOX_INDEX); | |
| 7393 face->use_box_color_for_shadows_p = 1; | |
| 7394 } | |
| 7395 } | |
| 7396 else if (EQ (keyword, QCstyle)) | |
| 7397 { | |
| 7398 if (EQ (value, Qreleased_button)) | |
| 7399 face->box = FACE_RAISED_BOX; | |
| 7400 else if (EQ (value, Qpressed_button)) | |
| 7401 face->box = FACE_SUNKEN_BOX; | |
| 7402 } | |
| 7403 } | |
| 7404 } | |
| 7405 | |
| 7406 /* Text underline, overline, strike-through. */ | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
7407 |
| 24995 | 7408 if (EQ (attrs[LFACE_UNDERLINE_INDEX], Qt)) |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
7409 { |
| 24995 | 7410 /* Use default color (same as foreground color). */ |
| 7411 face->underline_p = 1; | |
| 7412 face->underline_defaulted_p = 1; | |
| 7413 face->underline_color = 0; | |
| 7414 } | |
| 7415 else if (STRINGP (attrs[LFACE_UNDERLINE_INDEX])) | |
| 7416 { | |
| 7417 /* Use specified color. */ | |
| 7418 face->underline_p = 1; | |
| 7419 face->underline_defaulted_p = 0; | |
| 7420 face->underline_color | |
| 7421 = load_color (f, face, attrs[LFACE_UNDERLINE_INDEX], | |
| 7422 LFACE_UNDERLINE_INDEX); | |
| 7423 } | |
| 7424 else if (NILP (attrs[LFACE_UNDERLINE_INDEX])) | |
| 7425 { | |
| 7426 face->underline_p = 0; | |
| 7427 face->underline_defaulted_p = 0; | |
| 7428 face->underline_color = 0; | |
| 7429 } | |
| 7430 | |
| 7431 overline = attrs[LFACE_OVERLINE_INDEX]; | |
| 7432 if (STRINGP (overline)) | |
| 7433 { | |
| 7434 face->overline_color | |
| 7435 = load_color (f, face, attrs[LFACE_OVERLINE_INDEX], | |
| 7436 LFACE_OVERLINE_INDEX); | |
| 7437 face->overline_p = 1; | |
| 7438 } | |
| 7439 else if (EQ (overline, Qt)) | |
| 7440 { | |
| 7441 face->overline_color = face->foreground; | |
| 7442 face->overline_color_defaulted_p = 1; | |
| 7443 face->overline_p = 1; | |
| 7444 } | |
| 7445 | |
| 7446 strike_through = attrs[LFACE_STRIKE_THROUGH_INDEX]; | |
| 7447 if (STRINGP (strike_through)) | |
| 7448 { | |
| 7449 face->strike_through_color | |
| 7450 = load_color (f, face, attrs[LFACE_STRIKE_THROUGH_INDEX], | |
| 7451 LFACE_STRIKE_THROUGH_INDEX); | |
| 7452 face->strike_through_p = 1; | |
| 7453 } | |
| 7454 else if (EQ (strike_through, Qt)) | |
| 7455 { | |
| 7456 face->strike_through_color = face->foreground; | |
| 7457 face->strike_through_color_defaulted_p = 1; | |
| 7458 face->strike_through_p = 1; | |
| 7459 } | |
| 7460 | |
| 7461 stipple = attrs[LFACE_STIPPLE_INDEX]; | |
| 7462 if (!NILP (stipple)) | |
| 7463 face->stipple = load_pixmap (f, stipple, &face->pixmap_w, &face->pixmap_h); | |
| 7464 | |
| 7465 return face; | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
7466 #endif /* HAVE_WINDOW_SYSTEM */ |
| 24995 | 7467 } |
| 7468 | |
| 7469 | |
|
30973
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7470 /* Map a specified color of face FACE on frame F to a tty color index. |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7471 IDX is either LFACE_FOREGROUND_INDEX or LFACE_BACKGROUND_INDEX, and |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7472 specifies which color to map. Set *DEFAULTED to 1 if mapping to the |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7473 default foreground/background colors. */ |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7474 |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7475 static void |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7476 map_tty_color (f, face, idx, defaulted) |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7477 struct frame *f; |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7478 struct face *face; |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7479 enum lface_attribute_index idx; |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7480 int *defaulted; |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7481 { |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7482 Lisp_Object frame, color, def; |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7483 int foreground_p = idx == LFACE_FOREGROUND_INDEX; |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7484 unsigned long default_pixel, default_other_pixel, pixel; |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7485 |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7486 xassert (idx == LFACE_FOREGROUND_INDEX || idx == LFACE_BACKGROUND_INDEX); |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7487 |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7488 if (foreground_p) |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7489 { |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7490 pixel = default_pixel = FACE_TTY_DEFAULT_FG_COLOR; |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7491 default_other_pixel = FACE_TTY_DEFAULT_BG_COLOR; |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7492 } |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7493 else |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7494 { |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7495 pixel = default_pixel = FACE_TTY_DEFAULT_BG_COLOR; |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7496 default_other_pixel = FACE_TTY_DEFAULT_FG_COLOR; |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7497 } |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48384
diff
changeset
|
7498 |
|
30973
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7499 XSETFRAME (frame, f); |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7500 color = face->lface[idx]; |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48384
diff
changeset
|
7501 |
|
30973
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7502 if (STRINGP (color) |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
7503 && SCHARS (color) |
|
30973
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7504 && CONSP (Vtty_defined_color_alist) |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7505 && (def = assq_no_quit (color, call1 (Qtty_color_alist, frame)), |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7506 CONSP (def))) |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7507 { |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7508 /* Associations in tty-defined-color-alist are of the form |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7509 (NAME INDEX R G B). We need the INDEX part. */ |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7510 pixel = XINT (XCAR (XCDR (def))); |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7511 } |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7512 |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7513 if (pixel == default_pixel && STRINGP (color)) |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7514 { |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7515 pixel = load_color (f, face, color, idx); |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7516 |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7517 #if defined (MSDOS) || defined (WINDOWSNT) |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7518 /* If the foreground of the default face is the default color, |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7519 use the foreground color defined by the frame. */ |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7520 #ifdef MSDOS |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7521 if (FRAME_MSDOS_P (f)) |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7522 { |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7523 #endif /* MSDOS */ |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7524 if (pixel == default_pixel |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7525 || pixel == FACE_TTY_DEFAULT_COLOR) |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7526 { |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7527 if (foreground_p) |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7528 pixel = FRAME_FOREGROUND_PIXEL (f); |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7529 else |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7530 pixel = FRAME_BACKGROUND_PIXEL (f); |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7531 face->lface[idx] = tty_color_name (f, pixel); |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7532 *defaulted = 1; |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7533 } |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7534 else if (pixel == default_other_pixel) |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7535 { |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7536 if (foreground_p) |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7537 pixel = FRAME_BACKGROUND_PIXEL (f); |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7538 else |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7539 pixel = FRAME_FOREGROUND_PIXEL (f); |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7540 face->lface[idx] = tty_color_name (f, pixel); |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7541 *defaulted = 1; |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7542 } |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7543 #ifdef MSDOS |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7544 } |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7545 #endif |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7546 #endif /* MSDOS or WINDOWSNT */ |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7547 } |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7548 |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7549 if (foreground_p) |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7550 face->foreground = pixel; |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7551 else |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7552 face->background = pixel; |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7553 } |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7554 |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7555 |
| 24995 | 7556 /* Realize the fully-specified face with attributes ATTRS in face |
| 88907 | 7557 cache CACHE for ASCII characters. Do it for TTY frame CACHE->f. |
| 7558 Value is a pointer to the newly created realized face. */ | |
| 24995 | 7559 |
| 7560 static struct face * | |
| 88907 | 7561 realize_tty_face (cache, attrs) |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7562 struct face_cache *cache; |
| 24995 | 7563 Lisp_Object *attrs; |
| 7564 { | |
| 7565 struct face *face; | |
| 7566 int weight, slant; | |
|
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
7567 int face_colors_defaulted = 0; |
|
30973
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7568 struct frame *f = cache->f; |
| 24995 | 7569 |
| 7570 /* Frame must be a termcap frame. */ | |
| 35443 | 7571 xassert (FRAME_TERMCAP_P (cache->f) || FRAME_MSDOS_P (cache->f)); |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
7572 |
| 24995 | 7573 /* Allocate a new realized face. */ |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7574 face = make_realized_face (attrs); |
| 35443 | 7575 face->font_name = FRAME_MSDOS_P (cache->f) ? "ms-dos" : "tty"; |
| 24995 | 7576 |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
7577 /* Map face attributes to TTY appearances. We map slant to |
| 24995 | 7578 dimmed text because we want italic text to appear differently |
| 7579 and because dimmed text is probably used infrequently. */ | |
| 7580 weight = face_numeric_weight (attrs[LFACE_WEIGHT_INDEX]); | |
| 7581 slant = face_numeric_slant (attrs[LFACE_SLANT_INDEX]); | |
| 7582 | |
| 7583 if (weight > XLFD_WEIGHT_MEDIUM) | |
| 7584 face->tty_bold_p = 1; | |
| 7585 if (weight < XLFD_WEIGHT_MEDIUM || slant != XLFD_SLANT_ROMAN) | |
| 7586 face->tty_dim_p = 1; | |
| 7587 if (!NILP (attrs[LFACE_UNDERLINE_INDEX])) | |
| 7588 face->tty_underline_p = 1; | |
| 7589 if (!NILP (attrs[LFACE_INVERSE_INDEX])) | |
| 7590 face->tty_reverse_p = 1; | |
| 7591 | |
| 7592 /* Map color names to color indices. */ | |
|
30973
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7593 map_tty_color (f, face, LFACE_FOREGROUND_INDEX, &face_colors_defaulted); |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
7594 map_tty_color (f, face, LFACE_BACKGROUND_INDEX, &face_colors_defaulted); |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48384
diff
changeset
|
7595 |
|
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
7596 /* Swap colors if face is inverse-video. If the colors are taken |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
7597 from the frame colors, they are already inverted, since the |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
7598 frame-creation function calls x-handle-reverse-video. */ |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
7599 if (face->tty_reverse_p && !face_colors_defaulted) |
|
25114
be5d3e21fbd7
(load_color): Remove static from definition and remove
Eli Zaretskii <eliz@gnu.org>
parents:
25092
diff
changeset
|
7600 { |
|
be5d3e21fbd7
(load_color): Remove static from definition and remove
Eli Zaretskii <eliz@gnu.org>
parents:
25092
diff
changeset
|
7601 unsigned long tem = face->foreground; |
|
be5d3e21fbd7
(load_color): Remove static from definition and remove
Eli Zaretskii <eliz@gnu.org>
parents:
25092
diff
changeset
|
7602 face->foreground = face->background; |
|
be5d3e21fbd7
(load_color): Remove static from definition and remove
Eli Zaretskii <eliz@gnu.org>
parents:
25092
diff
changeset
|
7603 face->background = tem; |
|
be5d3e21fbd7
(load_color): Remove static from definition and remove
Eli Zaretskii <eliz@gnu.org>
parents:
25092
diff
changeset
|
7604 } |
|
be5d3e21fbd7
(load_color): Remove static from definition and remove
Eli Zaretskii <eliz@gnu.org>
parents:
25092
diff
changeset
|
7605 |
|
28529
b8ac36c58391
(tty_suppress_bold_inverse_default_colors_p): New
Gerd Moellmann <gerd@gnu.org>
parents:
28464
diff
changeset
|
7606 if (tty_suppress_bold_inverse_default_colors_p |
|
b8ac36c58391
(tty_suppress_bold_inverse_default_colors_p): New
Gerd Moellmann <gerd@gnu.org>
parents:
28464
diff
changeset
|
7607 && face->tty_bold_p |
|
b8ac36c58391
(tty_suppress_bold_inverse_default_colors_p): New
Gerd Moellmann <gerd@gnu.org>
parents:
28464
diff
changeset
|
7608 && face->background == FACE_TTY_DEFAULT_FG_COLOR |
|
b8ac36c58391
(tty_suppress_bold_inverse_default_colors_p): New
Gerd Moellmann <gerd@gnu.org>
parents:
28464
diff
changeset
|
7609 && face->foreground == FACE_TTY_DEFAULT_BG_COLOR) |
|
b8ac36c58391
(tty_suppress_bold_inverse_default_colors_p): New
Gerd Moellmann <gerd@gnu.org>
parents:
28464
diff
changeset
|
7610 face->tty_bold_p = 0; |
|
b8ac36c58391
(tty_suppress_bold_inverse_default_colors_p): New
Gerd Moellmann <gerd@gnu.org>
parents:
28464
diff
changeset
|
7611 |
| 24995 | 7612 return face; |
| 7613 } | |
| 7614 | |
| 7615 | |
|
28529
b8ac36c58391
(tty_suppress_bold_inverse_default_colors_p): New
Gerd Moellmann <gerd@gnu.org>
parents:
28464
diff
changeset
|
7616 DEFUN ("tty-suppress-bold-inverse-default-colors", |
|
b8ac36c58391
(tty_suppress_bold_inverse_default_colors_p): New
Gerd Moellmann <gerd@gnu.org>
parents:
28464
diff
changeset
|
7617 Ftty_suppress_bold_inverse_default_colors, |
|
b8ac36c58391
(tty_suppress_bold_inverse_default_colors_p): New
Gerd Moellmann <gerd@gnu.org>
parents:
28464
diff
changeset
|
7618 Stty_suppress_bold_inverse_default_colors, 1, 1, 0, |
|
40598
7f3db64c7d42
(Finternal_merge_in_global_face): Reindent.
Pavel Jan?k <Pavel@Janik.cz>
parents:
40555
diff
changeset
|
7619 doc: /* Suppress/allow boldness of faces with inverse default colors. |
|
39914
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
7620 SUPPRESS non-nil means suppress it. |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
7621 This affects bold faces on TTYs whose foreground is the default background |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
7622 color of the display and whose background is the default foreground color. |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
7623 For such faces, the bold face attribute is ignored if this variable |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
7624 is non-nil. */) |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
7625 (suppress) |
|
28529
b8ac36c58391
(tty_suppress_bold_inverse_default_colors_p): New
Gerd Moellmann <gerd@gnu.org>
parents:
28464
diff
changeset
|
7626 Lisp_Object suppress; |
|
b8ac36c58391
(tty_suppress_bold_inverse_default_colors_p): New
Gerd Moellmann <gerd@gnu.org>
parents:
28464
diff
changeset
|
7627 { |
|
b8ac36c58391
(tty_suppress_bold_inverse_default_colors_p): New
Gerd Moellmann <gerd@gnu.org>
parents:
28464
diff
changeset
|
7628 tty_suppress_bold_inverse_default_colors_p = !NILP (suppress); |
|
b8ac36c58391
(tty_suppress_bold_inverse_default_colors_p): New
Gerd Moellmann <gerd@gnu.org>
parents:
28464
diff
changeset
|
7629 ++face_change_count; |
|
b8ac36c58391
(tty_suppress_bold_inverse_default_colors_p): New
Gerd Moellmann <gerd@gnu.org>
parents:
28464
diff
changeset
|
7630 return suppress; |
|
b8ac36c58391
(tty_suppress_bold_inverse_default_colors_p): New
Gerd Moellmann <gerd@gnu.org>
parents:
28464
diff
changeset
|
7631 } |
|
b8ac36c58391
(tty_suppress_bold_inverse_default_colors_p): New
Gerd Moellmann <gerd@gnu.org>
parents:
28464
diff
changeset
|
7632 |
|
b8ac36c58391
(tty_suppress_bold_inverse_default_colors_p): New
Gerd Moellmann <gerd@gnu.org>
parents:
28464
diff
changeset
|
7633 |
| 24995 | 7634 |
| 7635 /*********************************************************************** | |
| 7636 Computing Faces | |
| 7637 ***********************************************************************/ | |
| 7638 | |
| 7639 /* Return the ID of the face to use to display character CH with face | |
| 7640 property PROP on frame F in current_buffer. */ | |
| 7641 | |
| 7642 int | |
| 7643 compute_char_face (f, ch, prop) | |
| 7644 struct frame *f; | |
| 7645 int ch; | |
| 7646 Lisp_Object prop; | |
| 7647 { | |
| 7648 int face_id; | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7649 |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7650 if (NILP (current_buffer->enable_multibyte_characters)) |
|
37433
94967574484c
(compute_char_face): If buffer is unibyte, set CH to
Gerd Moellmann <gerd@gnu.org>
parents:
37394
diff
changeset
|
7651 ch = 0; |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
7652 |
| 24995 | 7653 if (NILP (prop)) |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7654 { |
|
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7655 struct face *face = FACE_FROM_ID (f, DEFAULT_FACE_ID); |
|
89701
a1d897828f2f
(compute_char_face): Call FACE_FOR_CHAR with POS and OBJECT args.
Kenichi Handa <handa@m17n.org>
parents:
89620
diff
changeset
|
7656 face_id = FACE_FOR_CHAR (f, face, ch, -1, Qnil); |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7657 } |
| 24995 | 7658 else |
| 7659 { | |
| 7660 Lisp_Object attrs[LFACE_VECTOR_SIZE]; | |
| 7661 struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); | |
| 7662 bcopy (default_face->lface, attrs, sizeof attrs); | |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
7663 merge_face_ref (f, prop, attrs, 1, 0); |
| 88907 | 7664 face_id = lookup_face (f, attrs); |
| 24995 | 7665 } |
| 7666 | |
| 7667 return face_id; | |
| 7668 } | |
| 7669 | |
| 7670 /* Return the face ID associated with buffer position POS for | |
| 7671 displaying ASCII characters. Return in *ENDPTR the position at | |
| 7672 which a different face is needed, as far as text properties and | |
| 7673 overlays are concerned. W is a window displaying current_buffer. | |
| 7674 | |
| 7675 REGION_BEG, REGION_END delimit the region, so it can be | |
| 7676 highlighted. | |
| 7677 | |
| 7678 LIMIT is a position not to scan beyond. That is to limit the time | |
| 7679 this function can take. | |
| 7680 | |
| 7681 If MOUSE is non-zero, use the character's mouse-face, not its face. | |
| 7682 | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7683 The face returned is suitable for displaying ASCII characters. */ |
| 24995 | 7684 |
| 7685 int | |
| 7686 face_at_buffer_position (w, pos, region_beg, region_end, | |
| 7687 endptr, limit, mouse) | |
| 2391 | 7688 struct window *w; |
| 2342 | 7689 int pos; |
|
2795
e97e96fb0cb8
(compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents:
2784
diff
changeset
|
7690 int region_beg, region_end; |
| 2342 | 7691 int *endptr; |
|
5084
863e092a5891
(compute_char_face): Accept new arg LIMIT.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
7692 int limit; |
|
6615
96ddf85642d1
(compute_char_face): New arg MOUSE.
Richard M. Stallman <rms@gnu.org>
parents:
5858
diff
changeset
|
7693 int mouse; |
| 2342 | 7694 { |
| 24995 | 7695 struct frame *f = XFRAME (w->frame); |
| 7696 Lisp_Object attrs[LFACE_VECTOR_SIZE]; | |
|
2767
482fa0725db6
* xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents:
2743
diff
changeset
|
7697 Lisp_Object prop, position; |
| 24995 | 7698 int i, noverlays; |
| 2342 | 7699 Lisp_Object *overlay_vec; |
| 2391 | 7700 Lisp_Object frame; |
|
2784
f8c6796b7777
* xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents:
2767
diff
changeset
|
7701 int endpos; |
| 24995 | 7702 Lisp_Object propname = mouse ? Qmouse_face : Qface; |
| 7703 Lisp_Object limit1, end; | |
| 7704 struct face *default_face; | |
|
2784
f8c6796b7777
* xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents:
2767
diff
changeset
|
7705 |
|
f8c6796b7777
* xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents:
2767
diff
changeset
|
7706 /* W must display the current buffer. We could write this function |
|
f8c6796b7777
* xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents:
2767
diff
changeset
|
7707 to use the frame and buffer of W, but right now it doesn't. */ |
|
25359
14135aa647e2
(face_at_buffer_position): Don't xassert that
Gerd Moellmann <gerd@gnu.org>
parents:
25301
diff
changeset
|
7708 /* xassert (XBUFFER (w->buffer) == current_buffer); */ |
| 2391 | 7709 |
|
9284
a969e0eefaf5
(compute_char_face): Use new accessor macros instead of calling XSET directly.
Karl Heuer <kwzh@gnu.org>
parents:
9186
diff
changeset
|
7710 XSETFRAME (frame, f); |
| 24995 | 7711 XSETFASTINT (position, pos); |
| 2342 | 7712 |
|
2784
f8c6796b7777
* xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents:
2767
diff
changeset
|
7713 endpos = ZV; |
|
2795
e97e96fb0cb8
(compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents:
2784
diff
changeset
|
7714 if (pos < region_beg && region_beg < endpos) |
|
e97e96fb0cb8
(compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents:
2784
diff
changeset
|
7715 endpos = region_beg; |
|
2784
f8c6796b7777
* xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents:
2767
diff
changeset
|
7716 |
| 24995 | 7717 /* Get the `face' or `mouse_face' text property at POS, and |
| 7718 determine the next position at which the property changes. */ | |
|
6615
96ddf85642d1
(compute_char_face): New arg MOUSE.
Richard M. Stallman <rms@gnu.org>
parents:
5858
diff
changeset
|
7719 prop = Fget_text_property (position, propname, w->buffer); |
| 24995 | 7720 XSETFASTINT (limit1, (limit < endpos ? limit : endpos)); |
| 7721 end = Fnext_single_property_change (position, propname, w->buffer, limit1); | |
| 7722 if (INTEGERP (end)) | |
| 7723 endpos = XINT (end); | |
| 7724 | |
| 7725 /* Look at properties from overlays. */ | |
|
2767
482fa0725db6
* xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents:
2743
diff
changeset
|
7726 { |
|
2784
f8c6796b7777
* xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents:
2767
diff
changeset
|
7727 int next_overlay; |
|
55654
edc2b57535e5
(face_at_buffer_position): Use GET_OVERLAYS_AT.
Kim F. Storm <storm@cua.dk>
parents:
55560
diff
changeset
|
7728 |
|
edc2b57535e5
(face_at_buffer_position): Use GET_OVERLAYS_AT.
Kim F. Storm <storm@cua.dk>
parents:
55560
diff
changeset
|
7729 GET_OVERLAYS_AT (pos, overlay_vec, noverlays, &next_overlay, 0); |
|
2784
f8c6796b7777
* xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents:
2767
diff
changeset
|
7730 if (next_overlay < endpos) |
|
f8c6796b7777
* xfaces.c (compute_char_face): When merging the overlays,
Jim Blandy <jimb@redhat.com>
parents:
2767
diff
changeset
|
7731 endpos = next_overlay; |
|
2767
482fa0725db6
* xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents:
2743
diff
changeset
|
7732 } |
|
482fa0725db6
* xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents:
2743
diff
changeset
|
7733 |
|
482fa0725db6
* xfaces.c (intern_frame_face): Exchange order of arguments, to
Jim Blandy <jimb@redhat.com>
parents:
2743
diff
changeset
|
7734 *endptr = endpos; |
| 2342 | 7735 |
| 24995 | 7736 default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
7737 |
| 24995 | 7738 /* Optimize common cases where we can use the default face. */ |
| 7739 if (noverlays == 0 | |
| 7740 && NILP (prop) | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7741 && !(pos >= region_beg && pos < region_end)) |
| 24995 | 7742 return DEFAULT_FACE_ID; |
| 7743 | |
| 7744 /* Begin with attributes from the default face. */ | |
| 7745 bcopy (default_face->lface, attrs, sizeof attrs); | |
| 7746 | |
| 7747 /* Merge in attributes specified via text properties. */ | |
| 7748 if (!NILP (prop)) | |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
7749 merge_face_ref (f, prop, attrs, 1, 0); |
| 24995 | 7750 |
| 7751 /* Now merge the overlay data. */ | |
|
5858
021e58905963
(compute_char_face): Extract overlay-sorting code as a separate function,
Karl Heuer <kwzh@gnu.org>
parents:
5801
diff
changeset
|
7752 noverlays = sort_overlays (overlay_vec, noverlays, w); |
| 2342 | 7753 for (i = 0; i < noverlays; i++) |
| 7754 { | |
|
19128
e789b647f15b
(merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18723
diff
changeset
|
7755 Lisp_Object oend; |
|
e789b647f15b
(merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18723
diff
changeset
|
7756 int oendpos; |
|
9186
45bac5feb065
(compute_char_face): Handle list as overlay face property.
Richard M. Stallman <rms@gnu.org>
parents:
9184
diff
changeset
|
7757 |
|
19128
e789b647f15b
(merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18723
diff
changeset
|
7758 prop = Foverlay_get (overlay_vec[i], propname); |
| 24995 | 7759 if (!NILP (prop)) |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
7760 merge_face_ref (f, prop, attrs, 1, 0); |
| 2342 | 7761 |
|
19128
e789b647f15b
(merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18723
diff
changeset
|
7762 oend = OVERLAY_END (overlay_vec[i]); |
|
e789b647f15b
(merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18723
diff
changeset
|
7763 oendpos = OVERLAY_POSITION (oend); |
|
e789b647f15b
(merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18723
diff
changeset
|
7764 if (oendpos < endpos) |
|
e789b647f15b
(merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18723
diff
changeset
|
7765 endpos = oendpos; |
| 2342 | 7766 } |
| 7767 | |
| 24995 | 7768 /* If in the region, merge in the region face. */ |
|
2795
e97e96fb0cb8
(compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents:
2784
diff
changeset
|
7769 if (pos >= region_beg && pos < region_end) |
|
e97e96fb0cb8
(compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents:
2784
diff
changeset
|
7770 { |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
7771 merge_named_face (f, Qregion, attrs, 0); |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
7772 |
|
2795
e97e96fb0cb8
(compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents:
2784
diff
changeset
|
7773 if (region_end < endpos) |
|
e97e96fb0cb8
(compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents:
2784
diff
changeset
|
7774 endpos = region_end; |
|
e97e96fb0cb8
(compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents:
2784
diff
changeset
|
7775 } |
|
e97e96fb0cb8
(compute_char_face): New args REGION_BEG, REGION_END.
Richard M. Stallman <rms@gnu.org>
parents:
2784
diff
changeset
|
7776 |
| 2342 | 7777 *endptr = endpos; |
| 7778 | |
| 24995 | 7779 /* Look up a realized face with the given face attributes, |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7780 or realize a new one for ASCII characters. */ |
| 88907 | 7781 return lookup_face (f, attrs); |
| 2342 | 7782 } |
|
19128
e789b647f15b
(merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18723
diff
changeset
|
7783 |
| 24995 | 7784 |
| 7785 /* Compute the face at character position POS in Lisp string STRING on | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7786 window W, for ASCII characters. |
| 24995 | 7787 |
| 7788 If STRING is an overlay string, it comes from position BUFPOS in | |
| 7789 current_buffer, otherwise BUFPOS is zero to indicate that STRING is | |
| 7790 not an overlay string. W must display the current buffer. | |
| 7791 REGION_BEG and REGION_END give the start and end positions of the | |
|
34289
1bf333d1b1de
(face_at_string_position): Update function comment.
Gerd Moellmann <gerd@gnu.org>
parents:
34242
diff
changeset
|
7792 region; both are -1 if no region is visible. |
|
1bf333d1b1de
(face_at_string_position): Update function comment.
Gerd Moellmann <gerd@gnu.org>
parents:
34242
diff
changeset
|
7793 |
|
1bf333d1b1de
(face_at_string_position): Update function comment.
Gerd Moellmann <gerd@gnu.org>
parents:
34242
diff
changeset
|
7794 BASE_FACE_ID is the id of a face to merge with. For strings coming |
|
1bf333d1b1de
(face_at_string_position): Update function comment.
Gerd Moellmann <gerd@gnu.org>
parents:
34242
diff
changeset
|
7795 from overlays or the `display' property it is the face at BUFPOS. |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
7796 |
|
36672
acf152adbf82
(face_at_string_position): Add parameter MOUSE_P.
Gerd Moellmann <gerd@gnu.org>
parents:
36481
diff
changeset
|
7797 If MOUSE_P is non-zero, use the character's mouse-face, not its face. |
|
acf152adbf82
(face_at_string_position): Add parameter MOUSE_P.
Gerd Moellmann <gerd@gnu.org>
parents:
36481
diff
changeset
|
7798 |
| 24995 | 7799 Set *ENDPTR to the next position where to check for faces in |
| 7800 STRING; -1 if the face is constant from POS to the end of the | |
| 7801 string. | |
| 7802 | |
| 7803 Value is the id of the face to use. The face returned is suitable | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7804 for displaying ASCII characters. */ |
| 24995 | 7805 |
| 7806 int | |
| 7807 face_at_string_position (w, string, pos, bufpos, region_beg, | |
|
36672
acf152adbf82
(face_at_string_position): Add parameter MOUSE_P.
Gerd Moellmann <gerd@gnu.org>
parents:
36481
diff
changeset
|
7808 region_end, endptr, base_face_id, mouse_p) |
| 24995 | 7809 struct window *w; |
| 7810 Lisp_Object string; | |
| 7811 int pos, bufpos; | |
| 7812 int region_beg, region_end; | |
| 7813 int *endptr; | |
| 7814 enum face_id base_face_id; | |
|
36672
acf152adbf82
(face_at_string_position): Add parameter MOUSE_P.
Gerd Moellmann <gerd@gnu.org>
parents:
36481
diff
changeset
|
7815 int mouse_p; |
|
19128
e789b647f15b
(merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18723
diff
changeset
|
7816 { |
| 24995 | 7817 Lisp_Object prop, position, end, limit; |
| 7818 struct frame *f = XFRAME (WINDOW_FRAME (w)); | |
| 7819 Lisp_Object attrs[LFACE_VECTOR_SIZE]; | |
| 7820 struct face *base_face; | |
| 7821 int multibyte_p = STRING_MULTIBYTE (string); | |
|
36672
acf152adbf82
(face_at_string_position): Add parameter MOUSE_P.
Gerd Moellmann <gerd@gnu.org>
parents:
36481
diff
changeset
|
7822 Lisp_Object prop_name = mouse_p ? Qmouse_face : Qface; |
| 24995 | 7823 |
| 7824 /* Get the value of the face property at the current position within | |
| 7825 STRING. Value is nil if there is no face property. */ | |
| 7826 XSETFASTINT (position, pos); | |
|
36672
acf152adbf82
(face_at_string_position): Add parameter MOUSE_P.
Gerd Moellmann <gerd@gnu.org>
parents:
36481
diff
changeset
|
7827 prop = Fget_text_property (position, prop_name, string); |
| 24995 | 7828 |
| 7829 /* Get the next position at which to check for faces. Value of end | |
| 7830 is nil if face is constant all the way to the end of the string. | |
| 7831 Otherwise it is a string position where to check faces next. | |
| 7832 Limit is the maximum position up to which to check for property | |
| 7833 changes in Fnext_single_property_change. Strings are usually | |
| 7834 short, so set the limit to the end of the string. */ | |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
7835 XSETFASTINT (limit, SCHARS (string)); |
|
36672
acf152adbf82
(face_at_string_position): Add parameter MOUSE_P.
Gerd Moellmann <gerd@gnu.org>
parents:
36481
diff
changeset
|
7836 end = Fnext_single_property_change (position, prop_name, string, limit); |
| 24995 | 7837 if (INTEGERP (end)) |
| 7838 *endptr = XFASTINT (end); | |
|
19128
e789b647f15b
(merge_face_list): New function.
Richard M. Stallman <rms@gnu.org>
parents:
18723
diff
changeset
|
7839 else |
| 24995 | 7840 *endptr = -1; |
| 7841 | |
| 7842 base_face = FACE_FROM_ID (f, base_face_id); | |
| 7843 xassert (base_face); | |
| 7844 | |
| 7845 /* Optimize the default case that there is no face property and we | |
| 7846 are not in the region. */ | |
| 7847 if (NILP (prop) | |
| 7848 && (base_face_id != DEFAULT_FACE_ID | |
| 7849 /* BUFPOS <= 0 means STRING is not an overlay string, so | |
| 7850 that the region doesn't have to be taken into account. */ | |
| 7851 || bufpos <= 0 | |
| 7852 || bufpos < region_beg | |
| 7853 || bufpos >= region_end) | |
| 7854 && (multibyte_p | |
| 7855 /* We can't realize faces for different charsets differently | |
| 7856 if we don't have fonts, so we can stop here if not working | |
| 7857 on a window-system frame. */ | |
| 7858 || !FRAME_WINDOW_P (f) | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7859 || FACE_SUITABLE_FOR_CHAR_P (base_face, 0))) |
| 24995 | 7860 return base_face->id; |
| 7861 | |
| 7862 /* Begin with attributes from the base face. */ | |
| 7863 bcopy (base_face->lface, attrs, sizeof attrs); | |
| 7864 | |
| 7865 /* Merge in attributes specified via text properties. */ | |
| 7866 if (!NILP (prop)) | |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
7867 merge_face_ref (f, prop, attrs, 1, 0); |
| 24995 | 7868 |
| 7869 /* If in the region, merge in the region face. */ | |
| 7870 if (bufpos | |
| 7871 && bufpos >= region_beg | |
| 7872 && bufpos < region_end) | |
|
55966
b9f354f2c61f
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Miles Bader <miles@gnu.org>
parents:
55949
diff
changeset
|
7873 merge_named_face (f, Qregion, attrs, 0); |
| 24995 | 7874 |
| 7875 /* Look up a realized face with the given face attributes, | |
|
28230
8e330f701881
(Qx_charset_registry, Vface_default_registry):
Kenichi Handa <handa@m17n.org>
parents:
27984
diff
changeset
|
7876 or realize a new one for ASCII characters. */ |
| 88907 | 7877 return lookup_face (f, attrs); |
|
3074
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
7878 } |
|
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
7879 |
|
96b4623fdeb3
* xterm.h: New section for declarations for xfaces.c.
Jim Blandy <jimb@redhat.com>
parents:
3065
diff
changeset
|
7880 |
| 2336 | 7881 |
| 24995 | 7882 /*********************************************************************** |
| 7883 Tests | |
| 7884 ***********************************************************************/ | |
| 7885 | |
| 7886 #if GLYPH_DEBUG | |
| 7887 | |
| 7888 /* Print the contents of the realized face FACE to stderr. */ | |
| 7889 | |
| 7890 static void | |
| 7891 dump_realized_face (face) | |
| 7892 struct face *face; | |
| 2336 | 7893 { |
| 24995 | 7894 fprintf (stderr, "ID: %d\n", face->id); |
| 7895 #ifdef HAVE_X_WINDOWS | |
| 7896 fprintf (stderr, "gc: %d\n", (int) face->gc); | |
| 7897 #endif | |
| 7898 fprintf (stderr, "foreground: 0x%lx (%s)\n", | |
| 7899 face->foreground, | |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
7900 SDATA (face->lface[LFACE_FOREGROUND_INDEX])); |
| 24995 | 7901 fprintf (stderr, "background: 0x%lx (%s)\n", |
| 7902 face->background, | |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
7903 SDATA (face->lface[LFACE_BACKGROUND_INDEX])); |
| 24995 | 7904 fprintf (stderr, "font_name: %s (%s)\n", |
| 7905 face->font_name, | |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
7906 SDATA (face->lface[LFACE_FAMILY_INDEX])); |
| 24995 | 7907 #ifdef HAVE_X_WINDOWS |
| 7908 fprintf (stderr, "font = %p\n", face->font); | |
| 7909 #endif | |
| 7910 fprintf (stderr, "font_info_id = %d\n", face->font_info_id); | |
| 7911 fprintf (stderr, "fontset: %d\n", face->fontset); | |
| 7912 fprintf (stderr, "underline: %d (%s)\n", | |
| 7913 face->underline_p, | |
|
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
7914 SDATA (Fsymbol_name (face->lface[LFACE_UNDERLINE_INDEX]))); |
| 24995 | 7915 fprintf (stderr, "hash: %d\n", face->hash); |
| 7916 } | |
| 7917 | |
| 7918 | |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
7919 DEFUN ("dump-face", Fdump_face, Sdump_face, 0, 1, 0, doc: /* */) |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
7920 (n) |
| 24995 | 7921 Lisp_Object n; |
| 7922 { | |
| 7923 if (NILP (n)) | |
| 2336 | 7924 { |
| 24995 | 7925 int i; |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
7926 |
| 24995 | 7927 fprintf (stderr, "font selection order: "); |
| 7928 for (i = 0; i < DIM (font_sort_order); ++i) | |
| 7929 fprintf (stderr, "%d ", font_sort_order[i]); | |
| 7930 fprintf (stderr, "\n"); | |
| 7931 | |
| 7932 fprintf (stderr, "alternative fonts: "); | |
| 7933 debug_print (Vface_alternative_font_family_alist); | |
| 7934 fprintf (stderr, "\n"); | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
7935 |
|
25678
1878f7ae0df5
(frame_or_selected_frame): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25661
diff
changeset
|
7936 for (i = 0; i < FRAME_FACE_CACHE (SELECTED_FRAME ())->used; ++i) |
| 24995 | 7937 Fdump_face (make_number (i)); |
| 2336 | 7938 } |
| 24995 | 7939 else |
| 7940 { | |
| 7941 struct face *face; | |
|
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Jan?k <Pavel@Janik.cz>
parents:
40603
diff
changeset
|
7942 CHECK_NUMBER (n); |
|
25678
1878f7ae0df5
(frame_or_selected_frame): Change for Lisp_Object
Gerd Moellmann <gerd@gnu.org>
parents:
25661
diff
changeset
|
7943 face = FACE_FROM_ID (SELECTED_FRAME (), XINT (n)); |
| 24995 | 7944 if (face == NULL) |
| 7945 error ("Not a valid face"); | |
| 7946 dump_realized_face (face); | |
| 7947 } | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
7948 |
| 2336 | 7949 return Qnil; |
| 7950 } | |
| 7951 | |
| 7952 | |
| 24995 | 7953 DEFUN ("show-face-resources", Fshow_face_resources, Sshow_face_resources, |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
7954 0, 0, 0, doc: /* */) |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
7955 () |
| 2336 | 7956 { |
| 24995 | 7957 fprintf (stderr, "number of colors = %d\n", ncolors_allocated); |
| 7958 fprintf (stderr, "number of pixmaps = %d\n", npixmaps_allocated); | |
| 7959 fprintf (stderr, "number of GCs = %d\n", ngcs); | |
| 2336 | 7960 return Qnil; |
| 7961 } | |
| 24995 | 7962 |
| 7963 #endif /* GLYPH_DEBUG != 0 */ | |
| 7964 | |
|
18083
c361afa561c5
Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents:
17047
diff
changeset
|
7965 |
|
c361afa561c5
Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents:
17047
diff
changeset
|
7966 |
| 24995 | 7967 /*********************************************************************** |
| 7968 Initialization | |
| 7969 ***********************************************************************/ | |
|
2730
139740855fa6
* xfaces.c (Fmake_face_internal): Do nothing for non-X frames.
Jim Blandy <jimb@redhat.com>
parents:
2538
diff
changeset
|
7970 |
| 2336 | 7971 void |
| 2391 | 7972 syms_of_xfaces () |
| 2336 | 7973 { |
| 2391 | 7974 Qface = intern ("face"); |
| 7975 staticpro (&Qface); | |
| 57107 | 7976 Qface_no_inherit = intern ("face-no-inherit"); |
| 7977 staticpro (&Qface_no_inherit); | |
|
25890
b10a34d40b55
(Qbitmap_spec_p): Replaces Qpixmap_spec_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25883
diff
changeset
|
7978 Qbitmap_spec_p = intern ("bitmap-spec-p"); |
|
b10a34d40b55
(Qbitmap_spec_p): Replaces Qpixmap_spec_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25883
diff
changeset
|
7979 staticpro (&Qbitmap_spec_p); |
|
25661
a6e2ae7964fb
(Fx_family_fonts): Replaces Fx_font_list.
Gerd Moellmann <gerd@gnu.org>
parents:
25592
diff
changeset
|
7980 Qframe_update_face_colors = intern ("frame-update-face-colors"); |
|
a6e2ae7964fb
(Fx_family_fonts): Replaces Fx_font_list.
Gerd Moellmann <gerd@gnu.org>
parents:
25592
diff
changeset
|
7981 staticpro (&Qframe_update_face_colors); |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
7982 |
| 24995 | 7983 /* Lisp face attribute keywords. */ |
| 7984 QCfamily = intern (":family"); | |
| 7985 staticpro (&QCfamily); | |
| 7986 QCheight = intern (":height"); | |
| 7987 staticpro (&QCheight); | |
| 7988 QCweight = intern (":weight"); | |
| 7989 staticpro (&QCweight); | |
| 7990 QCslant = intern (":slant"); | |
| 7991 staticpro (&QCslant); | |
| 7992 QCunderline = intern (":underline"); | |
| 7993 staticpro (&QCunderline); | |
| 7994 QCinverse_video = intern (":inverse-video"); | |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
7995 staticpro (&QCinverse_video); |
| 24995 | 7996 QCreverse_video = intern (":reverse-video"); |
| 7997 staticpro (&QCreverse_video); | |
| 7998 QCforeground = intern (":foreground"); | |
| 7999 staticpro (&QCforeground); | |
| 8000 QCbackground = intern (":background"); | |
| 8001 staticpro (&QCbackground); | |
| 8002 QCstipple = intern (":stipple");; | |
| 8003 staticpro (&QCstipple); | |
| 8004 QCwidth = intern (":width"); | |
| 8005 staticpro (&QCwidth); | |
| 8006 QCfont = intern (":font"); | |
| 8007 staticpro (&QCfont); | |
|
89047
3b6234eb229c
(QCfontset): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88939
diff
changeset
|
8008 QCfontset = intern (":fontset"); |
|
3b6234eb229c
(QCfontset): New variable.
Kenichi Handa <handa@m17n.org>
parents:
88939
diff
changeset
|
8009 staticpro (&QCfontset); |
| 24995 | 8010 QCbold = intern (":bold"); |
| 8011 staticpro (&QCbold); | |
| 8012 QCitalic = intern (":italic"); | |
| 8013 staticpro (&QCitalic); | |
| 8014 QCoverline = intern (":overline"); | |
| 8015 staticpro (&QCoverline); | |
| 8016 QCstrike_through = intern (":strike-through"); | |
| 8017 staticpro (&QCstrike_through); | |
| 8018 QCbox = intern (":box"); | |
| 8019 staticpro (&QCbox); | |
| 31178 | 8020 QCinherit = intern (":inherit"); |
| 8021 staticpro (&QCinherit); | |
| 24995 | 8022 |
| 8023 /* Symbols used for Lisp face attribute values. */ | |
| 8024 QCcolor = intern (":color"); | |
| 8025 staticpro (&QCcolor); | |
| 8026 QCline_width = intern (":line-width"); | |
| 8027 staticpro (&QCline_width); | |
| 8028 QCstyle = intern (":style"); | |
| 8029 staticpro (&QCstyle); | |
| 8030 Qreleased_button = intern ("released-button"); | |
| 8031 staticpro (&Qreleased_button); | |
| 8032 Qpressed_button = intern ("pressed-button"); | |
| 8033 staticpro (&Qpressed_button); | |
| 8034 Qnormal = intern ("normal"); | |
| 8035 staticpro (&Qnormal); | |
| 8036 Qultra_light = intern ("ultra-light"); | |
| 8037 staticpro (&Qultra_light); | |
| 8038 Qextra_light = intern ("extra-light"); | |
| 8039 staticpro (&Qextra_light); | |
| 8040 Qlight = intern ("light"); | |
| 8041 staticpro (&Qlight); | |
| 8042 Qsemi_light = intern ("semi-light"); | |
| 8043 staticpro (&Qsemi_light); | |
| 8044 Qsemi_bold = intern ("semi-bold"); | |
| 8045 staticpro (&Qsemi_bold); | |
| 8046 Qbold = intern ("bold"); | |
| 8047 staticpro (&Qbold); | |
| 8048 Qextra_bold = intern ("extra-bold"); | |
| 8049 staticpro (&Qextra_bold); | |
| 8050 Qultra_bold = intern ("ultra-bold"); | |
| 8051 staticpro (&Qultra_bold); | |
| 8052 Qoblique = intern ("oblique"); | |
| 8053 staticpro (&Qoblique); | |
| 8054 Qitalic = intern ("italic"); | |
| 8055 staticpro (&Qitalic); | |
| 8056 Qreverse_oblique = intern ("reverse-oblique"); | |
| 8057 staticpro (&Qreverse_oblique); | |
| 8058 Qreverse_italic = intern ("reverse-italic"); | |
| 8059 staticpro (&Qreverse_italic); | |
| 8060 Qultra_condensed = intern ("ultra-condensed"); | |
| 8061 staticpro (&Qultra_condensed); | |
| 8062 Qextra_condensed = intern ("extra-condensed"); | |
| 8063 staticpro (&Qextra_condensed); | |
| 8064 Qcondensed = intern ("condensed"); | |
| 8065 staticpro (&Qcondensed); | |
| 8066 Qsemi_condensed = intern ("semi-condensed"); | |
| 8067 staticpro (&Qsemi_condensed); | |
| 8068 Qsemi_expanded = intern ("semi-expanded"); | |
| 8069 staticpro (&Qsemi_expanded); | |
| 8070 Qexpanded = intern ("expanded"); | |
| 8071 staticpro (&Qexpanded); | |
| 8072 Qextra_expanded = intern ("extra-expanded"); | |
| 8073 staticpro (&Qextra_expanded); | |
| 8074 Qultra_expanded = intern ("ultra-expanded"); | |
| 8075 staticpro (&Qultra_expanded); | |
| 8076 Qbackground_color = intern ("background-color"); | |
| 8077 staticpro (&Qbackground_color); | |
| 8078 Qforeground_color = intern ("foreground-color"); | |
| 8079 staticpro (&Qforeground_color); | |
| 8080 Qunspecified = intern ("unspecified"); | |
| 8081 staticpro (&Qunspecified); | |
| 8082 | |
|
25661
a6e2ae7964fb
(Fx_family_fonts): Replaces Fx_font_list.
Gerd Moellmann <gerd@gnu.org>
parents:
25592
diff
changeset
|
8083 Qface_alias = intern ("face-alias"); |
|
a6e2ae7964fb
(Fx_family_fonts): Replaces Fx_font_list.
Gerd Moellmann <gerd@gnu.org>
parents:
25592
diff
changeset
|
8084 staticpro (&Qface_alias); |
| 24995 | 8085 Qdefault = intern ("default"); |
| 8086 staticpro (&Qdefault); | |
|
25544
693ca9ba497a
Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents:
25389
diff
changeset
|
8087 Qtool_bar = intern ("tool-bar"); |
|
693ca9ba497a
Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents:
25389
diff
changeset
|
8088 staticpro (&Qtool_bar); |
| 24995 | 8089 Qregion = intern ("region"); |
| 8090 staticpro (&Qregion); | |
|
25592
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
8091 Qfringe = intern ("fringe"); |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
8092 staticpro (&Qfringe); |
| 25546 | 8093 Qheader_line = intern ("header-line"); |
| 8094 staticpro (&Qheader_line); | |
|
25592
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
8095 Qscroll_bar = intern ("scroll-bar"); |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
8096 staticpro (&Qscroll_bar); |
|
25883
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
8097 Qmenu = intern ("menu"); |
|
2955c353186a
(toplevel) [USE_MOTIF]: Include some Motif headers.
Gerd Moellmann <gerd@gnu.org>
parents:
25799
diff
changeset
|
8098 staticpro (&Qmenu); |
|
25592
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
8099 Qcursor = intern ("cursor"); |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
8100 staticpro (&Qcursor); |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
8101 Qborder = intern ("border"); |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
8102 staticpro (&Qborder); |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
8103 Qmouse = intern ("mouse"); |
|
c6be980d15a6
(recompute_basic_faces): Clear face cache.
Gerd Moellmann <gerd@gnu.org>
parents:
25546
diff
changeset
|
8104 staticpro (&Qmouse); |
|
43203
dd98ef3675e5
(Qmode_line_inactive): New face variable for mode-line
Kim F. Storm <storm@cua.dk>
parents:
43069
diff
changeset
|
8105 Qmode_line_inactive = intern ("mode-line-inactive"); |
|
dd98ef3675e5
(Qmode_line_inactive): New face variable for mode-line
Kim F. Storm <storm@cua.dk>
parents:
43069
diff
changeset
|
8106 staticpro (&Qmode_line_inactive); |
|
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
8107 Qtty_color_desc = intern ("tty-color-desc"); |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
8108 staticpro (&Qtty_color_desc); |
|
45718
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
8109 Qtty_color_standard_values = intern ("tty-color-standard-values"); |
|
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
8110 staticpro (&Qtty_color_standard_values); |
|
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
8111 Qtty_color_by_index = intern ("tty-color-by-index"); |
|
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26601
diff
changeset
|
8112 staticpro (&Qtty_color_by_index); |
|
30973
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
8113 Qtty_color_alist = intern ("tty-color-alist"); |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
8114 staticpro (&Qtty_color_alist); |
|
37394
7847d9b8bbff
(Qscalable_fonts_allowed): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37206
diff
changeset
|
8115 Qscalable_fonts_allowed = intern ("scalable-fonts-allowed"); |
|
7847d9b8bbff
(Qscalable_fonts_allowed): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37206
diff
changeset
|
8116 staticpro (&Qscalable_fonts_allowed); |
| 24995 | 8117 |
|
31449
8797df6a9fa2
(Vparam_value_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
31440
diff
changeset
|
8118 Vparam_value_alist = Fcons (Fcons (Qnil, Qnil), Qnil); |
|
8797df6a9fa2
(Vparam_value_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
31440
diff
changeset
|
8119 staticpro (&Vparam_value_alist); |
|
30304
626d55ea66ef
(face-alternative-font-family-alist): Remove
Gerd Moellmann <gerd@gnu.org>
parents:
30235
diff
changeset
|
8120 Vface_alternative_font_family_alist = Qnil; |
|
626d55ea66ef
(face-alternative-font-family-alist): Remove
Gerd Moellmann <gerd@gnu.org>
parents:
30235
diff
changeset
|
8121 staticpro (&Vface_alternative_font_family_alist); |
|
33372
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
8122 Vface_alternative_font_registry_alist = Qnil; |
|
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
8123 staticpro (&Vface_alternative_font_registry_alist); |
|
30304
626d55ea66ef
(face-alternative-font-family-alist): Remove
Gerd Moellmann <gerd@gnu.org>
parents:
30235
diff
changeset
|
8124 |
| 24995 | 8125 defsubr (&Sinternal_make_lisp_face); |
| 8126 defsubr (&Sinternal_lisp_face_p); | |
| 8127 defsubr (&Sinternal_set_lisp_face_attribute); | |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
8128 #ifdef HAVE_WINDOW_SYSTEM |
| 24995 | 8129 defsubr (&Sinternal_set_lisp_face_attribute_from_resource); |
|
27137
0ade9883b546
(syms_of_xfaces): defsubr Scolor_gray_p and
Eli Zaretskii <eliz@gnu.org>
parents:
27120
diff
changeset
|
8130 #endif |
|
27120
24a08208cf3a
(syms_of_xfaces): Change Sface_color_gray_p to
Gerd Moellmann <gerd@gnu.org>
parents:
27114
diff
changeset
|
8131 defsubr (&Scolor_gray_p); |
|
24a08208cf3a
(syms_of_xfaces): Change Sface_color_gray_p to
Gerd Moellmann <gerd@gnu.org>
parents:
27114
diff
changeset
|
8132 defsubr (&Scolor_supported_p); |
|
40398
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
8133 defsubr (&Sface_attribute_relative_p); |
|
560b1c474b1a
(merge_face_heights): Handle TO being relative as well.
Miles Bader <miles@gnu.org>
parents:
40278
diff
changeset
|
8134 defsubr (&Smerge_face_attribute); |
| 24995 | 8135 defsubr (&Sinternal_get_lisp_face_attribute); |
| 8136 defsubr (&Sinternal_lisp_face_attribute_values); | |
| 8137 defsubr (&Sinternal_lisp_face_equal_p); | |
| 8138 defsubr (&Sinternal_lisp_face_empty_p); | |
| 8139 defsubr (&Sinternal_copy_lisp_face); | |
| 8140 defsubr (&Sinternal_merge_in_global_face); | |
| 8141 defsubr (&Sface_font); | |
| 8142 defsubr (&Sframe_face_alist); | |
|
55901
7814348a02ec
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Miles Bader <miles@gnu.org>
parents:
55654
diff
changeset
|
8143 defsubr (&Sdisplay_supports_face_attributes_p); |
|
45718
e495189229e4
(Ftty_supports_face_attributes_p): New function.
Miles Bader <miles@gnu.org>
parents:
45412
diff
changeset
|
8144 defsubr (&Scolor_distance); |
| 24995 | 8145 defsubr (&Sinternal_set_font_selection_order); |
| 8146 defsubr (&Sinternal_set_alternative_font_family_alist); | |
|
33372
2a665186a9e9
(Vface_alternative_font_registry_alist): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33275
diff
changeset
|
8147 defsubr (&Sinternal_set_alternative_font_registry_alist); |
|
40278
6ee20fddfbc5
(Fface_attributes_as_vector): New function.
Richard M. Stallman <rms@gnu.org>
parents:
40226
diff
changeset
|
8148 defsubr (&Sface_attributes_as_vector); |
| 24995 | 8149 #if GLYPH_DEBUG |
| 8150 defsubr (&Sdump_face); | |
| 8151 defsubr (&Sshow_face_resources); | |
| 8152 #endif /* GLYPH_DEBUG */ | |
| 8153 defsubr (&Sclear_face_cache); | |
|
28529
b8ac36c58391
(tty_suppress_bold_inverse_default_colors_p): New
Gerd Moellmann <gerd@gnu.org>
parents:
28464
diff
changeset
|
8154 defsubr (&Stty_suppress_bold_inverse_default_colors); |
| 24995 | 8155 |
|
29711
913fab478495
(syms_of_xfaces) [DEBUG_X_COLORS]: Defsubr dump_colors
Gerd Moellmann <gerd@gnu.org>
parents:
29599
diff
changeset
|
8156 #if defined DEBUG_X_COLORS && defined HAVE_X_WINDOWS |
|
29599
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
8157 defsubr (&Sdump_colors); |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
8158 #endif |
|
8a2e32f7717e
(Fdump_colors) [DEBUG_X_COLORS]: New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29394
diff
changeset
|
8159 |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
8160 DEFVAR_LISP ("font-list-limit", &Vfont_list_limit, |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
8161 doc: /* *Limit for font matching. |
|
39914
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
8162 If an integer > 0, font matching functions won't load more than |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
8163 that number of fonts when searching for a matching font. */); |
| 25270 | 8164 Vfont_list_limit = make_number (DEFAULT_FONT_LIST_LIMIT); |
| 8165 | |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
8166 DEFVAR_LISP ("face-new-frame-defaults", &Vface_new_frame_defaults, |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
8167 doc: /* List of global face definitions (for internal use only.) */); |
| 24995 | 8168 Vface_new_frame_defaults = Qnil; |
|
30235
5a0d447b7eea
check default_face before dereferencing
Sam Steingold <sds@gnu.org>
parents:
30211
diff
changeset
|
8169 |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
8170 DEFVAR_LISP ("face-default-stipple", &Vface_default_stipple, |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
8171 doc: /* *Default stipple pattern used on monochrome displays. |
|
39914
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
8172 This stipple pattern is used on monochrome displays |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
8173 instead of shades of gray for a face background color. |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
8174 See `set-face-stipple' for possible values for this variable. */); |
| 24995 | 8175 Vface_default_stipple = build_string ("gray3"); |
| 8176 | |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
8177 DEFVAR_LISP ("tty-defined-color-alist", &Vtty_defined_color_alist, |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
8178 doc: /* An alist of defined terminal colors and their RGB values. */); |
|
30973
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
8179 Vtty_defined_color_alist = Qnil; |
|
2f3dc355bcaf
(lface_equal_p): Compare strings differently.
Gerd Moellmann <gerd@gnu.org>
parents:
30707
diff
changeset
|
8180 |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
8181 DEFVAR_LISP ("scalable-fonts-allowed", &Vscalable_fonts_allowed, |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
8182 doc: /* Allowed scalable fonts. |
|
39914
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
8183 A value of nil means don't allow any scalable fonts. |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
8184 A value of t means allow any scalable font. |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
8185 Otherwise, value must be a list of regular expressions. A font may be |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
8186 scaled if its name matches a regular expression in the list. |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
8187 Note that if value is nil, a scalable font might still be used, if no |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
8188 other font of the appropriate family and registry is available. */); |
|
37724
3a5a6cd7ee9a
(try_alternative_families): First try the FAMILY.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37716
diff
changeset
|
8189 Vscalable_fonts_allowed = Qnil; |
|
18083
c361afa561c5
Include frame.h unconditionally.
Richard M. Stallman <rms@gnu.org>
parents:
17047
diff
changeset
|
8190 |
|
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
8191 DEFVAR_LISP ("face-ignored-fonts", &Vface_ignored_fonts, |
|
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39973
diff
changeset
|
8192 doc: /* List of ignored fonts. |
|
39914
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
8193 Each element is a regular expression that matches names of fonts to |
|
91951fb5b9e5
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39682
diff
changeset
|
8194 ignore. */); |
|
34629
10675adcbf6f
(Vface_ignored_fonts): New variable.
Kenichi Handa <handa@m17n.org>
parents:
34289
diff
changeset
|
8195 Vface_ignored_fonts = Qnil; |
|
10675adcbf6f
(Vface_ignored_fonts): New variable.
Kenichi Handa <handa@m17n.org>
parents:
34289
diff
changeset
|
8196 |
|
50515
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
8197 DEFVAR_LISP ("face-font-rescale-alist", &Vface_font_rescale_alist, |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
8198 doc: /* Alist of fonts vs the rescaling factors. |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
8199 Each element is a cons (FONT-NAME-PATTERN . RESCALE-RATIO), where |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
8200 FONT-NAME-PATTERN is a regular expression matching a font name, and |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
8201 RESCALE-RATIO is a floating point number to specify how much larger |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
8202 \(or smaller) font we should use. For instance, if a face requests |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
8203 a font of 10 point, we actually use a font of 10 * RESCALE-RATIO point. */); |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
8204 Vface_font_rescale_alist = Qnil; |
|
98bdd2203d85
(Vface_font_rescale_alist): New variable.
Kenichi Handa <handa@m17n.org>
parents:
50412
diff
changeset
|
8205 |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
8206 #ifdef HAVE_WINDOW_SYSTEM |
|
25890
b10a34d40b55
(Qbitmap_spec_p): Replaces Qpixmap_spec_p.
Gerd Moellmann <gerd@gnu.org>
parents:
25883
diff
changeset
|
8207 defsubr (&Sbitmap_spec_p); |
| 24995 | 8208 defsubr (&Sx_list_fonts); |
| 8209 defsubr (&Sinternal_face_x_get_resource); | |
|
25661
a6e2ae7964fb
(Fx_family_fonts): Replaces Fx_font_list.
Gerd Moellmann <gerd@gnu.org>
parents:
25592
diff
changeset
|
8210 defsubr (&Sx_family_fonts); |
| 24995 | 8211 defsubr (&Sx_font_family_list); |
|
27982
86de01dd01eb
Change many FRAME_X... macros to FRAME_WINDOW... or other
Jason Rumney <jasonr@gnu.org>
parents:
27960
diff
changeset
|
8212 #endif /* HAVE_WINDOW_SYSTEM */ |
| 2336 | 8213 } |
| 52401 | 8214 |
| 8215 /* arch-tag: 8a0f7598-5517-408d-9ab3-1da6fcd4c749 | |
| 8216 (do not change this comment) */ |
