Mercurial > emacs
annotate src/w32faces.c @ 28336:49b7af1b8e1b
(byte-compile-eval): Fix and reenable the code.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Sun, 26 Mar 2000 19:49:29 +0000 |
parents | 0f639a575917 |
children |
rev | line source |
---|---|
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1 /* xfaces.c -- "Face" primitives. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2 Copyright (C) 1993, 1994, 1998, 1999 Free Software Foundation. |
13434 | 3 |
4 This file is part of GNU Emacs. | |
5 | |
6 GNU Emacs is free software; you can redistribute it and/or modify | |
7 it under the terms of the GNU General Public License as published by | |
8 the Free Software Foundation; either version 2, or (at your option) | |
9 any later version. | |
10 | |
11 GNU Emacs is distributed in the hope that it will be useful, | |
12 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 GNU General Public License for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
17 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:
14036
diff
changeset
|
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
19 Boston, MA 02111-1307, USA. */ |
13434 | 20 |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
21 /* New face implementation by Gerd Moellmann <gerd@gnu.org>. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
22 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
23 /* Faces. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
24 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
25 When using Emacs with X, the display style of characters can be |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
26 changed by defining `faces'. Each face can specify the following |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
27 display attributes: |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
28 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
29 1. Font family or fontset alias name. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
30 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
31 2. Relative proportionate width, aka character set width or set |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
32 width (swidth), e.g. `semi-compressed'. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
33 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
34 3. Font height in 1/10pt |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
35 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
36 4. Font weight, e.g. `bold'. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
37 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
38 5. Font slant, e.g. `italic'. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
39 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
40 6. Foreground color. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
41 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
42 7. Background color. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
43 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
44 8. Whether or not characters should be underlined, and in what color. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
45 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
46 9. Whether or not characters should be displayed in inverse video. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
47 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
48 10. A background stipple, a bitmap. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
49 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
50 11. Whether or not characters should be overlined, and in what color. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
51 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
52 12. Whether or not characters should be strike-through, and in what |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
53 color. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
54 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
55 13. Whether or not a box should be drawn around characters, the box |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
56 type, and, for simple boxes, in what color. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
57 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
58 Faces are frame-local by nature because Emacs allows to define the |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
59 same named face (face names are symbols) differently for different |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
60 frames. Each frame has an alist of face definitions for all named |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
61 faces. The value of a named face in such an alist is a Lisp vector |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
62 with the symbol `face' in slot 0, and a slot for each each of the |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
63 face attributes mentioned above. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
64 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
65 There is also a global face alist `Vface_new_frame_defaults'. Face |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
66 definitions from this list are used to initialize faces of newly |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
67 created frames. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
68 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
69 A face doesn't have to specify all attributes. Those not specified |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
70 have a value of `unspecified'. Faces specifying all attributes are |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
71 called `fully-specified'. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
72 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
73 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
74 Face merging. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
75 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
76 The display style of a given character in the text is determined by |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
77 combining several faces. This process is called `face merging'. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
78 Any aspect of the display style that isn't specified by overlays or |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
79 text properties is taken from the `default' face. Since it is made |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
80 sure that the default face is always fully-specified, face merging |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
81 always results in a fully-specified face. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
82 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
83 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
84 Face realization. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
85 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
86 After all face attributes for a character have been determined by |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
87 merging faces of that character, that face is `realized'. The |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
88 realization process maps face attributes to what is physically |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
89 available on the system where Emacs runs. The result is a |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
90 `realized face' in form of a struct face which is stored in the |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
91 face cache of the frame on which it was realized. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
92 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
93 Face realization is done in the context of the charset of the |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
94 character to display because different fonts and encodings are used |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
95 for different charsets. In other words, for characters of |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
96 different charsets, different realized faces are needed to display |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
97 them. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
98 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
99 Faces are always realized for a specific character set and contain |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
100 a specific font, even if the face being realized specifies a |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
101 fontset (see `font selection' below). The reason is that the |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
102 result of the new font selection stage is better than what can be |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
103 done with statically defined font name patterns in fontsets. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
104 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
105 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
106 Unibyte text. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
107 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
108 In unibyte text, Emacs' charsets aren't applicable; function |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
109 `char-charset' reports CHARSET_ASCII for all characters, including |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
110 those > 0x7f. The X registry and encoding of fonts to use is |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
111 determined from the variable `x-unibyte-registry-and-encoding' in |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
112 this case. The variable is initialized at Emacs startup time from |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
113 the font the user specified for Emacs. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
114 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
115 Currently all unibyte text, i.e. all buffers with |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
116 enable_multibyte_characters nil are displayed with fonts of the |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
117 same registry and encoding `x-unibyte-registry-and-encoding'. This |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
118 is consistent with the fact that languages can also be set |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
119 globally, only. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
120 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
121 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
122 Font selection. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
123 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
124 Font selection tries to find the best available matching font for a |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
125 given (charset, face) combination. This is done slightly |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
126 differently for faces specifying a fontset, or a font family name. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
127 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
128 If the face specifies a fontset alias name, that fontset determines |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
129 a pattern for fonts of the given charset. If the face specifies a |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
130 font family, a font pattern is constructed. Charset symbols have a |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
131 property `x-charset-registry' for that purpose that maps a charset |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
132 to an XLFD registry and encoding in the font pattern constructed. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
133 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
134 Available fonts on the system on which Emacs runs are then matched |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
135 against the font pattern. The result of font selection is the best |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
136 match for the given face attributes in this font list. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
137 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
138 Font selection can be influenced by the user. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
139 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
140 1. The user can specify the relative importance he gives the face |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
141 attributes width, height, weight, and slant by setting |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
142 face-font-selection-order (faces.el) to a list of face attribute |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
143 names. The default is '(:width :height :weight :slant), and means |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
144 that font selection first tries to find a good match for the font |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
145 width specified by a face, then---within fonts with that |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
146 width---tries to find a best match for the specified font height, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
147 etc. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
148 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
149 2. Setting face-alternative-font-family-alist allows the user to |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
150 specify alternative font families to try if a family specified by a |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
151 face doesn't exist. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
152 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
153 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
154 Composite characters. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
155 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
156 Realized faces for composite characters are the only ones having a |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
157 fontset id >= 0. When a composite character is encoded into a |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
158 sequence of non-composite characters (in xterm.c), a suitable font |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
159 for the non-composite characters is then selected and realized, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
160 i.e. the realization process is delayed but in principle the same. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
161 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
162 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
163 Initialization of basic faces. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
164 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
165 The faces `default', `modeline' are considered `basic faces'. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
166 When redisplay happens the first time for a newly created frame, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
167 basic faces are realized for CHARSET_ASCII. Frame parameters are |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
168 used to fill in unspecified attributes of the default face. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
169 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
170 /* Define SCALABLE_FONTS to a non-zero value to enable scalable |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
171 font use. Define it to zero to disable scalable font use. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
172 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
173 Use of too many or too large scalable fonts can crash XFree86 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
174 servers. That's why I've put the code dealing with scalable fonts |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
175 in #if's. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
176 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
177 #define SCALABLE_FONTS 1 |
13434 | 178 |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25646
diff
changeset
|
179 #include <config.h> |
13434 | 180 #include <sys/types.h> |
181 #include <sys/stat.h> | |
182 #include "lisp.h" | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
183 #include "charset.h" |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
184 #include "frame.h" |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
185 |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
186 #ifdef HAVE_X_WINDOWS |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
187 #include "xterm.h" |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
188 #include "fontset.h" |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
189 #ifdef USE_MOTIF |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
190 #include <Xm/Xm.h> |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
191 #include <Xm/XmStrDefs.h> |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
192 #endif /* USE_MOTIF */ |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
193 #endif |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
194 |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
195 #ifdef MSDOS |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
196 #include "dosfns.h" |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
197 #endif |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
198 |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
199 #ifdef WINDOWSNT |
13434 | 200 #include "w32term.h" |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
201 #include "fontset.h" |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
202 #endif |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
203 |
13434 | 204 #include "buffer.h" |
205 #include "dispextern.h" | |
206 #include "blockinput.h" | |
207 #include "window.h" | |
208 #include "intervals.h" | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
209 |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
210 #ifdef HAVE_X_WINDOWS |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
211 |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
212 /* Compensate for a bug in Xos.h on some systems, on which it requires |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
213 time.h. On some such systems, Xos.h tries to redefine struct |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
214 timeval and struct timezone if USG is #defined while it is |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
215 #included. */ |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
216 |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
217 #ifdef XOS_NEEDS_TIME_H |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
218 #include <time.h> |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
219 #undef USG |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
220 #include <X11/Xos.h> |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
221 #define USG |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
222 #define __TIMEVAL__ |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
223 #else /* not XOS_NEEDS_TIME_H */ |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
224 #include <X11/Xos.h> |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
225 #endif /* not XOS_NEEDS_TIME_H */ |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
226 |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
227 #endif /* HAVE_X_WINDOWS */ |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
228 |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
229 #include <stdio.h> |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
230 #include <ctype.h> |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
231 #include "keyboard.h" |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
232 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
233 #ifndef max |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
234 #define max(A, B) ((A) > (B) ? (A) : (B)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
235 #define min(A, B) ((A) < (B) ? (A) : (B)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
236 #define abs(X) ((X) < 0 ? -(X) : (X)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
237 #endif |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
238 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
239 /* Non-zero if face attribute ATTR is unspecified. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
240 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
241 #define UNSPECIFIEDP(ATTR) EQ ((ATTR), Qunspecified) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
242 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
243 /* Value is the number of elements of VECTOR. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
244 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
245 #define DIM(VECTOR) (sizeof (VECTOR) / sizeof *(VECTOR)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
246 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
247 /* Make a copy of string S on the stack using alloca. Value is a pointer |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
248 to the copy. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
249 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
250 #define STRDUPA(S) strcpy ((char *) alloca (strlen ((S)) + 1), (S)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
251 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
252 /* Make a copy of the contents of Lisp string S on the stack using |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
253 alloca. Value is a pointer to the copy. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
254 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
255 #define LSTRDUPA(S) STRDUPA (XSTRING ((S))->data) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
256 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
257 /* Size of hash table of realized faces in face caches (should be a |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
258 prime number). */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
259 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
260 #define FACE_CACHE_BUCKETS_SIZE 1001 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
261 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
262 /* A definition of XColor for non-X frames. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
263 #ifndef HAVE_X_WINDOWS |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
264 typedef struct { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
265 unsigned long pixel; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
266 unsigned short red, green, blue; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
267 char flags; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
268 char pad; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
269 } XColor; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
270 #endif |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
271 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
272 /* Keyword symbols used for face attribute names. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
273 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
274 Lisp_Object QCfamily, QCheight, QCweight, QCslant, QCunderline; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
275 Lisp_Object QCinverse_video, QCforeground, QCbackground, QCstipple; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
276 Lisp_Object QCwidth, QCfont, QCbold, QCitalic; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
277 Lisp_Object QCreverse_video; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
278 Lisp_Object QCoverline, QCstrike_through, QCbox; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
279 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
280 /* Symbols used for attribute values. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
281 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
282 Lisp_Object Qnormal, Qbold, Qultra_light, Qextra_light, Qlight; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
283 Lisp_Object Qsemi_light, Qsemi_bold, Qextra_bold, Qultra_bold; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
284 Lisp_Object Qoblique, Qitalic, Qreverse_oblique, Qreverse_italic; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
285 Lisp_Object Qultra_condensed, Qextra_condensed, Qcondensed; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
286 Lisp_Object Qsemi_condensed, Qsemi_expanded, Qexpanded, Qextra_expanded; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
287 Lisp_Object Qultra_expanded; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
288 Lisp_Object Qreleased_button, Qpressed_button; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
289 Lisp_Object QCstyle, QCcolor, QCline_width; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
290 Lisp_Object Qunspecified; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
291 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
292 char unspecified_fg[] = "unspecified-fg", unspecified_bg[] = "unspecified-bg"; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
293 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
294 /* The symbol `x-charset-registry'. This property of charsets defines |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
295 the X registry and encoding that fonts should have that are used to |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
296 display characters of that charset. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
297 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
298 Lisp_Object Qx_charset_registry; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
299 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
300 /* The name of the function to call when the background of the frame |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
301 has changed, frame_update_face_colors. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
302 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
303 Lisp_Object Qframe_update_face_colors; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
304 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
305 /* Names of basic faces. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
306 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
307 Lisp_Object Qdefault, Qtool_bar, Qregion, Qfringe; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
308 Lisp_Object Qheader_line, Qscroll_bar, Qcursor, Qborder, Qmouse, Qmenu; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
309 extern Lisp_Object Qmode_line; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
310 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
311 /* The symbol `face-alias'. A symbols having that property is an |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
312 alias for another face. Value of the property is the name of |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
313 the aliased face. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
314 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
315 Lisp_Object Qface_alias; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
316 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
317 /* Names of frame parameters related to faces. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
318 |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
319 extern Lisp_Object Qscroll_bar_foreground, Qscroll_bar_background; |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
320 extern Lisp_Object Qborder_color, Qcursor_color, Qmouse_color; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
321 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
322 /* Default stipple pattern used on monochrome displays. This stipple |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
323 pattern is used on monochrome displays instead of shades of gray |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
324 for a face background color. See `set-face-stipple' for possible |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
325 values for this variable. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
326 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
327 Lisp_Object Vface_default_stipple; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
328 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
329 /* Default registry and encoding to use for charsets whose charset |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
330 symbols don't specify one. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
331 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
332 Lisp_Object Vface_default_registry; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
333 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
334 /* Alist of alternative font families. Each element is of the form |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
335 (FAMILY FAMILY1 FAMILY2 ...). If fonts of FAMILY can't be loaded, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
336 try FAMILY1, then FAMILY2, ... */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
337 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
338 Lisp_Object Vface_alternative_font_family_alist; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
339 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
340 /* Allowed scalable fonts. A value of nil means don't allow any |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
341 scalable fonts. A value of t means allow the use of any scalable |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
342 font. Otherwise, value must be a list of regular expressions. A |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
343 font may be scaled if its name matches a regular expression in the |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
344 list. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
345 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
346 #if SCALABLE_FONTS |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
347 Lisp_Object Vscalable_fonts_allowed; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
348 #endif |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
349 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
350 /* Maximum number of fonts to consider in font_list. If not an |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
351 integer > 0, DEFAULT_FONT_LIST_LIMIT is used instead. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
352 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
353 Lisp_Object Vfont_list_limit; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
354 #define DEFAULT_FONT_LIST_LIMIT 100 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
355 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
356 /* The symbols `foreground-color' and `background-color' which can be |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
357 used as part of a `face' property. This is for compatibility with |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
358 Emacs 20.2. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
359 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
360 Lisp_Object Qforeground_color, Qbackground_color; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
361 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
362 /* The symbols `face' and `mouse-face' used as text properties. */ |
13434 | 363 |
23623
f6c3cc94ae4f
(Qmouse_face): Replace definition with extern decl.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23505
diff
changeset
|
364 Lisp_Object Qface; |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
365 extern Lisp_Object Qmouse_face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
366 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
367 /* Error symbol for wrong_type_argument in load_pixmap. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
368 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
369 Lisp_Object Qbitmap_spec_p; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
370 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
371 /* Alist of global face definitions. Each element is of the form |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
372 (FACE . LFACE) where FACE is a symbol naming a face and LFACE |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
373 is a Lisp vector of face attributes. These faces are used |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
374 to initialize faces for new frames. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
375 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
376 Lisp_Object Vface_new_frame_defaults; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
377 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
378 /* The next ID to assign to Lisp faces. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
379 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
380 static int next_lface_id; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
381 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
382 /* A vector mapping Lisp face Id's to face names. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
383 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
384 static Lisp_Object *lface_id_to_name; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
385 static int lface_id_to_name_size; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
386 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
387 /* tty color-related functions (defined on lisp/term/tty-colors.el). */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
388 Lisp_Object Qtty_color_desc, Qtty_color_by_index; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
389 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
390 /* Counter for calls to clear_face_cache. If this counter reaches |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
391 CLEAR_FONT_TABLE_COUNT, and a frame has more than |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
392 CLEAR_FONT_TABLE_NFONTS load, unused fonts are freed. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
393 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
394 static int clear_font_table_count; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
395 #define CLEAR_FONT_TABLE_COUNT 100 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
396 #define CLEAR_FONT_TABLE_NFONTS 10 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
397 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
398 /* Non-zero means face attributes have been changed since the last |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
399 redisplay. Used in redisplay_internal. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
400 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
401 int face_change_count; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
402 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
403 /* The total number of colors currently allocated. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
404 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
405 #if GLYPH_DEBUG |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
406 static int ncolors_allocated; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
407 static int npixmaps_allocated; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
408 static int ngcs; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
409 #endif |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
410 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
411 |
13434 | 412 |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
413 /* Function prototypes. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
414 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
415 struct font_name; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
416 struct table_entry; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
417 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
418 static Lisp_Object resolve_face_name P_ ((Lisp_Object)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
419 static int may_use_scalable_font_p P_ ((struct font_name *, char *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
420 static void set_font_frame_param P_ ((Lisp_Object, Lisp_Object)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
421 static int better_font_p P_ ((int *, struct font_name *, struct font_name *, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
422 int)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
423 static int first_font_matching P_ ((struct frame *f, char *, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
424 struct font_name *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
425 static int x_face_list_fonts P_ ((struct frame *, char *, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
426 struct font_name *, int, int, int)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
427 static int font_scalable_p P_ ((struct font_name *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
428 static Lisp_Object deduce_unibyte_registry P_ ((struct frame *, char *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
429 static int get_lface_attributes P_ ((struct frame *, Lisp_Object, Lisp_Object *, int)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
430 static int load_pixmap P_ ((struct frame *, Lisp_Object, unsigned *, unsigned *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
431 static char *xstrdup P_ ((char *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
432 static unsigned char *xstrlwr P_ ((unsigned char *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
433 static void signal_error P_ ((char *, Lisp_Object)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
434 static struct frame *frame_or_selected_frame P_ ((Lisp_Object, int)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
435 static void load_face_font_or_fontset P_ ((struct frame *, struct face *, char *, int)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
436 static void load_face_colors P_ ((struct frame *, struct face *, Lisp_Object *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
437 static void free_face_colors P_ ((struct frame *, struct face *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
438 static int face_color_gray_p P_ ((struct frame *, char *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
439 static char *build_font_name P_ ((struct font_name *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
440 static void free_font_names P_ ((struct font_name *, int)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
441 static int sorted_font_list P_ ((struct frame *, char *, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
442 int (*cmpfn) P_ ((const void *, const void *)), |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
443 struct font_name **)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
444 static int font_list P_ ((struct frame *, char *, char *, char *, struct font_name **)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
445 static int try_font_list P_ ((struct frame *, Lisp_Object *, char *, char *, char *, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
446 struct font_name **)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
447 static int cmp_font_names P_ ((const void *, const void *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
448 static struct face *realize_face P_ ((struct face_cache *, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
449 Lisp_Object *, int)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
450 static struct face *realize_x_face P_ ((struct face_cache *, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
451 Lisp_Object *, int)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
452 static struct face *realize_tty_face P_ ((struct face_cache *, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
453 Lisp_Object *, int)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
454 static int realize_basic_faces P_ ((struct frame *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
455 static int realize_default_face P_ ((struct frame *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
456 static void realize_named_face P_ ((struct frame *, Lisp_Object, int)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
457 static int lface_fully_specified_p P_ ((Lisp_Object *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
458 static int lface_equal_p P_ ((Lisp_Object *, Lisp_Object *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
459 static unsigned hash_string_case_insensitive P_ ((Lisp_Object)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
460 static unsigned lface_hash P_ ((Lisp_Object *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
461 static int lface_same_font_attributes_p P_ ((Lisp_Object *, Lisp_Object *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
462 static struct face_cache *make_face_cache P_ ((struct frame *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
463 static void free_realized_face P_ ((struct frame *, struct face *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
464 static void clear_face_gcs P_ ((struct face_cache *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
465 static void free_face_cache P_ ((struct face_cache *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
466 static int face_numeric_weight P_ ((Lisp_Object)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
467 static int face_numeric_slant P_ ((Lisp_Object)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
468 static int face_numeric_swidth P_ ((Lisp_Object)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
469 static int face_fontset P_ ((struct frame *, Lisp_Object *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
470 static char *choose_face_font P_ ((struct frame *, Lisp_Object *, int, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
471 Lisp_Object)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
472 static char *choose_face_fontset_font P_ ((struct frame *, Lisp_Object *, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
473 int, int)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
474 static void merge_face_vectors P_ ((Lisp_Object *from, Lisp_Object *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
475 static void merge_face_vector_with_property P_ ((struct frame *, Lisp_Object *, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
476 Lisp_Object)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
477 static int set_lface_from_font_name P_ ((struct frame *, Lisp_Object, char *, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
478 int, int)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
479 static Lisp_Object lface_from_face_name P_ ((struct frame *, Lisp_Object, int)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
480 static struct face *make_realized_face P_ ((Lisp_Object *, int, Lisp_Object)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
481 static void free_realized_faces P_ ((struct face_cache *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
482 static char *best_matching_font P_ ((struct frame *, Lisp_Object *, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
483 struct font_name *, int)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
484 static void cache_face P_ ((struct face_cache *, struct face *, unsigned)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
485 static void uncache_face P_ ((struct face_cache *, struct face *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
486 static int xlfd_numeric_slant P_ ((struct font_name *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
487 static int xlfd_numeric_weight P_ ((struct font_name *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
488 static int xlfd_numeric_swidth P_ ((struct font_name *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
489 static Lisp_Object xlfd_symbolic_slant P_ ((struct font_name *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
490 static Lisp_Object xlfd_symbolic_weight P_ ((struct font_name *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
491 static Lisp_Object xlfd_symbolic_swidth P_ ((struct font_name *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
492 static int xlfd_fixed_p P_ ((struct font_name *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
493 static int xlfd_numeric_value P_ ((struct table_entry *, int, struct font_name *, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
494 int, int)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
495 static Lisp_Object xlfd_symbolic_value P_ ((struct table_entry *, int, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
496 struct font_name *, int, int)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
497 static struct table_entry *xlfd_lookup_field_contents P_ ((struct table_entry *, int, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
498 struct font_name *, int)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
499 |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
500 #ifdef HAVE_WINDOW_SYSTEM |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
501 |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
502 static int split_font_name P_ ((struct frame *, struct font_name *, int)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
503 static int xlfd_point_size P_ ((struct frame *, struct font_name *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
504 static void sort_fonts P_ ((struct frame *, struct font_name *, int, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
505 int (*cmpfn) P_ ((const void *, const void *)))); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
506 static GC x_create_gc P_ ((struct frame *, unsigned long, XGCValues *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
507 static void x_free_gc P_ ((struct frame *, GC)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
508 static void clear_font_table P_ ((struct frame *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
509 |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
510 #ifdef WINDOWSNT |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
511 extern Lisp_Object w32_list_fonts P_ ((struct frame *, Lisp_Object, int, int)); |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
512 #endif /* WINDOWSNT */ |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
513 |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
514 #endif /* HAVE_WINDOW_SYSTEM */ |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
515 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
516 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
517 /*********************************************************************** |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
518 Utilities |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
519 ***********************************************************************/ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
520 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
521 /* Create and return a GC for use on frame F. GC values and mask |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
522 are given by XGCV and MASK. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
523 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
524 static INLINE GC |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
525 x_create_gc (f, mask, xgcv) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
526 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
527 unsigned long mask; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
528 XGCValues *xgcv; |
13434 | 529 { |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
530 GC gc; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
531 BLOCK_INPUT; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
532 gc = XCreateGC (NULL, FRAME_W32_WINDOW (f), mask, xgcv); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
533 UNBLOCK_INPUT; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
534 IF_DEBUG (++ngcs); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
535 return gc; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
536 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
537 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
538 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
539 /* Free GC which was used on frame F. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
540 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
541 static INLINE void |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
542 x_free_gc (f, gc) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
543 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
544 GC gc; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
545 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
546 BLOCK_INPUT; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
547 xassert (--ngcs >= 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
548 xfree (gc); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
549 UNBLOCK_INPUT; |
13434 | 550 } |
551 | |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
552 |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
553 /* Like strdup, but uses xmalloc. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
554 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
555 static char * |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
556 xstrdup (s) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
557 char *s; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
558 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
559 int len = strlen (s) + 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
560 char *p = (char *) xmalloc (len); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
561 bcopy (s, p, len); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
562 return p; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
563 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
564 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
565 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
566 /* Like stricmp. Used to compare parts of font names which are in |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
567 ISO8859-1. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
568 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
569 int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
570 xstricmp (s1, s2) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
571 unsigned char *s1, *s2; |
13434 | 572 { |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
573 while (*s1 && *s2) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
574 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
575 unsigned char c1 = tolower (*s1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
576 unsigned char c2 = tolower (*s2); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
577 if (c1 != c2) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
578 return c1 < c2 ? -1 : 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
579 ++s1, ++s2; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
580 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
581 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
582 if (*s1 == 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
583 return *s2 == 0 ? 0 : -1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
584 return 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
585 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
586 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
587 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
588 /* Like strlwr, which might not always be available. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
589 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
590 static unsigned char * |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
591 xstrlwr (s) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
592 unsigned char *s; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
593 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
594 unsigned char *p = s; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
595 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
596 for (p = s; *p; ++p) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
597 *p = tolower (*p); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
598 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
599 return s; |
13434 | 600 } |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
601 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
602 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
603 /* Signal `error' with message S, and additional argument ARG. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
604 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
605 static void |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
606 signal_error (s, arg) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
607 char *s; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
608 Lisp_Object arg; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
609 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
610 Fsignal (Qerror, Fcons (build_string (s), Fcons (arg, Qnil))); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
611 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
612 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
613 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
614 /* If FRAME is nil, return a pointer to the selected frame. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
615 Otherwise, check that FRAME is a live frame, and return a pointer |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
616 to it. NPARAM is the parameter number of FRAME, for |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
617 CHECK_LIVE_FRAME. This is here because it's a frequent pattern in |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
618 Lisp function definitions. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
619 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
620 static INLINE struct frame * |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
621 frame_or_selected_frame (frame, nparam) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
622 Lisp_Object frame; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
623 int nparam; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
624 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
625 if (NILP (frame)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
626 frame = selected_frame; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
627 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
628 CHECK_LIVE_FRAME (frame, nparam); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
629 return XFRAME (frame); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
630 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
631 |
13434 | 632 |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
633 /*********************************************************************** |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
634 Frames and faces |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
635 ***********************************************************************/ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
636 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
637 /* Initialize face cache and basic faces for frame F. */ |
13434 | 638 |
639 void | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
640 init_frame_faces (f) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
641 struct frame *f; |
13434 | 642 { |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
643 /* Make a face cache, if F doesn't have one. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
644 if (FRAME_FACE_CACHE (f) == NULL) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
645 FRAME_FACE_CACHE (f) = make_face_cache (f); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
646 |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
647 #ifdef HAVE_WINDOW_SYSTEM |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
648 /* Make the image cache. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
649 if (FRAME_WINDOW_P (f)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
650 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
651 if (FRAME_X_IMAGE_CACHE (f) == NULL) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
652 FRAME_X_IMAGE_CACHE (f) = make_image_cache (); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
653 ++FRAME_X_IMAGE_CACHE (f)->refcount; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
654 } |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
655 #endif /* HAVE_WINDOW_SYSTEM */ |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
656 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
657 /* Realize basic faces. Must have enough information in frame |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
658 parameters to realize basic faces at this point. */ |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
659 #ifdef HAVE_X_WINDOWS |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
660 if (!FRAME_X_P (f) || FRAME_X_WINDOW (f)) |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
661 #endif |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
662 #ifdef WINDOWSNT |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
663 if (!FRAME_WINDOW_P (f) || FRAME_W32_WINDOW (f)) |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
664 #endif |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
665 if (!realize_basic_faces (f)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
666 abort (); |
13434 | 667 } |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
668 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
669 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
670 /* Free face cache of frame F. Called from Fdelete_frame. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
671 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
672 void |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
673 free_frame_faces (f) |
13434 | 674 struct frame *f; |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
675 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
676 struct face_cache *face_cache = FRAME_FACE_CACHE (f); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
677 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
678 if (face_cache) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
679 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
680 free_face_cache (face_cache); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
681 FRAME_FACE_CACHE (f) = NULL; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
682 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
683 |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
684 #ifdef HAVE_WINDOW_SYSTEM |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
685 if (FRAME_WINDOW_P (f)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
686 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
687 struct image_cache *image_cache = FRAME_X_IMAGE_CACHE (f); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
688 if (image_cache) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
689 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
690 --image_cache->refcount; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
691 if (image_cache->refcount == 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
692 free_image_cache (f); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
693 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
694 } |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
695 #endif /* HAVE_WINDOW_SYSTEM */ |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
696 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
697 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
698 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
699 /* Clear face caches, and recompute basic faces for frame F. Call |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
700 this after changing frame parameters on which those faces depend, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
701 or when realized faces have been freed due to changing attributes |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
702 of named faces. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
703 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
704 void |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
705 recompute_basic_faces (f) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
706 struct frame *f; |
13434 | 707 { |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
708 if (FRAME_FACE_CACHE (f)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
709 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
710 clear_face_cache (0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
711 if (!realize_basic_faces (f)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
712 abort (); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
713 } |
13434 | 714 } |
715 | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
716 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
717 /* Clear the face caches of all frames. CLEAR_FONTS_P non-zero means |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
718 try to free unused fonts, too. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
719 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
720 void |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
721 clear_face_cache (clear_fonts_p) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
722 int clear_fonts_p; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
723 { |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
724 #ifdef HAVE_WINDOW_SYSTEM |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
725 Lisp_Object tail, frame; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
726 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
727 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
728 if (clear_fonts_p |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
729 || ++clear_font_table_count == CLEAR_FONT_TABLE_COUNT) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
730 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
731 /* From time to time see if we can unload some fonts. This also |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
732 frees all realized faces on all frames. Fonts needed by |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
733 faces will be loaded again when faces are realized again. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
734 clear_font_table_count = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
735 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
736 FOR_EACH_FRAME (tail, frame) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
737 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
738 f = XFRAME (frame); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
739 if (FRAME_WINDOW_P (f) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
740 && FRAME_W32_DISPLAY_INFO (f)->n_fonts > CLEAR_FONT_TABLE_NFONTS) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
741 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
742 free_all_realized_faces (frame); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
743 clear_font_table (f); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
744 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
745 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
746 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
747 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
748 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
749 /* Clear GCs of realized faces. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
750 FOR_EACH_FRAME (tail, frame) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
751 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
752 f = XFRAME (frame); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
753 if (FRAME_WINDOW_P (f)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
754 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
755 clear_face_gcs (FRAME_FACE_CACHE (f)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
756 clear_image_cache (f, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
757 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
758 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
759 } |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
760 #endif /* HAVE_WINDOW_SYSTEM */ |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
761 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
762 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
763 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
764 DEFUN ("clear-face-cache", Fclear_face_cache, Sclear_face_cache, 0, 1, 0, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
765 "Clear face caches on all frames.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
766 Optional THOROUGHLY non-nil means try to free unused fonts, too.") |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
767 (thorougly) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
768 Lisp_Object thorougly; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
769 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
770 clear_face_cache (!NILP (thorougly)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
771 return Qnil; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
772 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
773 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
774 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
775 |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
776 #ifdef HAVE_WINDOW_SYSTEM |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
777 |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
778 |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
779 /* Remove those fonts from the font table of frame F that are not used |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
780 by fontsets. Called from clear_face_cache from time to time. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
781 |
13434 | 782 static void |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
783 clear_font_table (f) |
13434 | 784 struct frame *f; |
785 { | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
786 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
787 char *used; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
788 Lisp_Object rest, frame; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
789 int i; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
790 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
791 xassert (FRAME_WINDOW_P (f)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
792 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
793 used = (char *) alloca (dpyinfo->n_fonts * sizeof *used); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
794 bzero (used, dpyinfo->n_fonts * sizeof *used); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
795 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
796 /* For all frames with the same w32_display_info as F, record |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
797 in `used' those fonts that are in use by fontsets. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
798 FOR_EACH_FRAME (rest, frame) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
799 if (FRAME_W32_DISPLAY_INFO (XFRAME (frame)) == dpyinfo) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
800 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
801 struct frame *f = XFRAME (frame); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
802 struct fontset_data *fontset_data = FRAME_FONTSET_DATA (f); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
803 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
804 for (i = 0; i < fontset_data->n_fontsets; ++i) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
805 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
806 struct fontset_info *info = fontset_data->fontset_table[i]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
807 int j; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
808 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
809 for (j = 0; j <= MAX_CHARSET; ++j) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
810 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
811 int idx = info->font_indexes[j]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
812 if (idx >= 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
813 used[idx] = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
814 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
815 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
816 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
817 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
818 /* Free those fonts that are not used by fontsets. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
819 for (i = 0; i < dpyinfo->n_fonts; ++i) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
820 if (used[i] == 0 && dpyinfo->font_table[i].name) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
821 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
822 struct font_info *font_info = dpyinfo->font_table + i; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
823 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
824 /* Free names. In xfns.c there is a comment that full_name |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
825 should never be freed because it is always shared with |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
826 something else. I don't think this is true anymore---see |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
827 x_load_font. It's either equal to font_info->name or |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
828 allocated via xmalloc, and there seems to be no place in |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
829 the source files where full_name is transferred to another |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
830 data structure. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
831 if (font_info->full_name != font_info->name) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
832 xfree (font_info->full_name); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
833 xfree (font_info->name); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
834 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
835 /* Free the font. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
836 BLOCK_INPUT; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
837 w32_unload_font (dpyinfo, font_info->font); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
838 UNBLOCK_INPUT; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
839 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
840 /* Mark font table slot free. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
841 font_info->font = NULL; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
842 font_info->name = font_info->full_name = NULL; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
843 } |
13434 | 844 } |
845 | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
846 |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
847 #endif /* HAVE_WINDOW_SYSTEM */ |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
848 |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
849 |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
850 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
851 /*********************************************************************** |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
852 X Pixmaps |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
853 ***********************************************************************/ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
854 |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
855 #ifdef HAVE_WINDOW_SYSTEM |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
856 |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
857 DEFUN ("bitmap-spec-p", Fbitmap_spec_p, Sbitmap_spec_p, 1, 1, 0, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
858 "Value is non-nil if OBJECT is a valid bitmap specification.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
859 A bitmap specification is either a string, a filename, or a list\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
860 (WIDTH HEIGHT DATA) where WIDTH is the pixel width of the bitmap,\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
861 HEIGHT is its height, and DATA is a string containing the bits of the\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
862 bitmap. Bits are stored row by row, each row occupies\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
863 (WIDTH + 7) / 8 bytes.") |
23505
1050835fbcef
Update comments referring to obsolete structs.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21607
diff
changeset
|
864 (object) |
1050835fbcef
Update comments referring to obsolete structs.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21607
diff
changeset
|
865 Lisp_Object object; |
13434 | 866 { |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
867 int pixmap_p = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
868 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
869 if (STRINGP (object)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
870 /* If OBJECT is a string, it's a file name. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
871 pixmap_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
872 else if (CONSP (object)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
873 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
874 /* Otherwise OBJECT must be (WIDTH HEIGHT DATA), WIDTH and |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
875 HEIGHT must be integers > 0, and DATA must be string large |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
876 enough to hold a bitmap of the specified size. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
877 Lisp_Object width, height, data; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
878 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
879 height = width = data = Qnil; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
880 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
881 if (CONSP (object)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
882 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
883 width = XCAR (object); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
884 object = XCDR (object); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
885 if (CONSP (object)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
886 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
887 height = XCAR (object); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
888 object = XCDR (object); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
889 if (CONSP (object)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
890 data = XCAR (object); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
891 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
892 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
893 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
894 if (NATNUMP (width) && NATNUMP (height) && STRINGP (data)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
895 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
896 int bytes_per_row = ((XFASTINT (width) + BITS_PER_CHAR - 1) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
897 / BITS_PER_CHAR); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
898 if (STRING_BYTES (XSTRING (data)) >= bytes_per_row * height) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
899 pixmap_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
900 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
901 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
902 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
903 return pixmap_p ? Qt : Qnil; |
13434 | 904 } |
905 | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
906 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
907 /* Load a bitmap according to NAME (which is either a file name or a |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
908 pixmap spec) for use on frame F. Value is the bitmap_id (see |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
909 xfns.c). If NAME is nil, return with a bitmap id of zero. If |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
910 bitmap cannot be loaded, display a message saying so, and return |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
911 zero. Store the bitmap width in *W_PTR and its height in *H_PTR, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
912 if these pointers are not null. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
913 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
914 static int |
13434 | 915 load_pixmap (f, name, w_ptr, h_ptr) |
916 FRAME_PTR f; | |
917 Lisp_Object name; | |
918 unsigned int *w_ptr, *h_ptr; | |
919 { | |
920 int bitmap_id; | |
921 Lisp_Object tem; | |
922 | |
923 if (NILP (name)) | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
924 return 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
925 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
926 tem = Fbitmap_spec_p (name); |
13434 | 927 if (NILP (tem)) |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
928 wrong_type_argument (Qbitmap_spec_p, name); |
13434 | 929 |
930 BLOCK_INPUT; | |
931 if (CONSP (name)) | |
932 { | |
933 /* Decode a bitmap spec into a bitmap. */ | |
934 | |
935 int h, w; | |
936 Lisp_Object bits; | |
937 | |
938 w = XINT (Fcar (name)); | |
939 h = XINT (Fcar (Fcdr (name))); | |
940 bits = Fcar (Fcdr (Fcdr (name))); | |
941 | |
942 bitmap_id = x_create_bitmap_from_data (f, XSTRING (bits)->data, | |
943 w, h); | |
944 } | |
945 else | |
946 { | |
947 /* It must be a string -- a file name. */ | |
948 bitmap_id = x_create_bitmap_from_file (f, name); | |
949 } | |
950 UNBLOCK_INPUT; | |
951 | |
952 if (bitmap_id < 0) | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
953 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
954 add_to_log ("Invalid or undefined bitmap %s", name, Qnil); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
955 bitmap_id = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
956 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
957 if (w_ptr) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
958 *w_ptr = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
959 if (h_ptr) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
960 *h_ptr = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
961 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
962 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
963 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
964 #if GLYPH_DEBUG |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
965 ++npixmaps_allocated; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
966 #endif |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
967 if (w_ptr) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
968 *w_ptr = x_bitmap_width (f, bitmap_id); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
969 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
970 if (h_ptr) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
971 *h_ptr = x_bitmap_height (f, bitmap_id); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
972 } |
13434 | 973 |
974 return bitmap_id; | |
975 } | |
976 | |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
977 #endif /* HAVE_WINDOW_SYSTEM */ |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
978 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
979 |
13434 | 980 |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
981 /*********************************************************************** |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
982 Minimum font bounds |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
983 ***********************************************************************/ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
984 |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
985 #ifdef HAVE_WINDOW_SYSTEM |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
986 |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
987 /* Update the line_height of frame F. Return non-zero if line height |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
988 changes. */ |
13434 | 989 |
990 int | |
991 frame_update_line_height (f) | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
992 struct frame *f; |
13434 | 993 { |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
994 int fontset, line_height, changed_p; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
995 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
996 fontset = FRAME_FONTSET (f); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
997 if (fontset > 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
998 line_height = FRAME_FONTSET_DATA (f)->fontset_table[fontset]->height; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
999 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1000 line_height = FONT_HEIGHT (FRAME_FONT (f)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1001 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1002 changed_p = line_height != FRAME_LINE_HEIGHT (f); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1003 FRAME_LINE_HEIGHT (f) = line_height; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1004 return changed_p; |
13434 | 1005 } |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1006 |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
1007 #endif /* HAVE_WINDOW_SYSTEM */ |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
1008 |
13434 | 1009 |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1010 /*********************************************************************** |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1011 Fonts |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1012 ***********************************************************************/ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1013 |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
1014 #ifdef HAVE_WINDOW_SYSTEM |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
1015 |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1016 /* Load font or fontset of face FACE which is used on frame F. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1017 FONTSET is the fontset FACE should use or -1, if FACE doesn't use a |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1018 fontset. FONT_NAME is the name of the font to load, if no fontset |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1019 is used. It is null if no suitable font name could be determined |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1020 for the face. */ |
13434 | 1021 |
1022 static void | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1023 load_face_font_or_fontset (f, face, font_name, fontset) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1024 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1025 struct face *face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1026 char *font_name; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1027 int fontset; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1028 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1029 struct font_info *font_info = NULL; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1030 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1031 face->font_info_id = -1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1032 face->fontset = fontset; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1033 face->font = NULL; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1034 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1035 BLOCK_INPUT; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1036 if (fontset >= 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1037 font_info = FS_LOAD_FONT (f, FRAME_W32_FONT_TABLE (f), CHARSET_ASCII, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1038 NULL, fontset); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1039 else if (font_name) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1040 font_info = FS_LOAD_FONT (f, FRAME_W32_FONT_TABLE (f), face->charset, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1041 font_name, -1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1042 UNBLOCK_INPUT; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1043 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1044 if (font_info) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1045 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1046 char *s; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1047 int i; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1048 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1049 face->font_info_id = FONT_INFO_ID (f, font_info); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1050 face->font = font_info->font; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1051 face->font_name = font_info->full_name; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1052 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1053 /* Make the registry part of the font name readily accessible. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1054 The registry is used to find suitable faces for unibyte text. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1055 s = font_info->full_name + strlen (font_info->full_name); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1056 i = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1057 while (i < 2 && --s >= font_info->full_name) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1058 if (*s == '-') |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1059 ++i; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1060 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1061 if (!STRINGP (face->registry) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1062 || xstricmp (XSTRING (face->registry)->data, s + 1) != 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1063 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1064 if (STRINGP (Vface_default_registry) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1065 && !xstricmp (XSTRING (Vface_default_registry)->data, s + 1)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1066 face->registry = Vface_default_registry; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1067 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1068 face->registry = build_string (s + 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1069 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1070 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1071 else if (fontset >= 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1072 add_to_log ("Unable to load ASCII font of fontset %d", |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1073 make_number (fontset), Qnil); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1074 else if (font_name) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1075 add_to_log ("Unable to load font %s", |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1076 build_string (font_name), Qnil); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1077 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1078 |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
1079 #endif /* HAVE_WINDOW_SYSTEM */ |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
1080 |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1081 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1082 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1083 /*********************************************************************** |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1084 X Colors |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1085 ***********************************************************************/ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1086 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1087 /* A version of defined_color for non-X frames. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1088 int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1089 tty_defined_color (f, color_name, color_def, alloc) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1090 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1091 char *color_name; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1092 XColor *color_def; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1093 int alloc; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1094 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1095 Lisp_Object color_desc; |
27893
0f639a575917
(tty_defined_color): Apply xfaces.c change from 02-17.
Jason Rumney <jasonr@gnu.org>
parents:
27517
diff
changeset
|
1096 unsigned long color_idx = FACE_TTY_DEFAULT_COLOR; |
0f639a575917
(tty_defined_color): Apply xfaces.c change from 02-17.
Jason Rumney <jasonr@gnu.org>
parents:
27517
diff
changeset
|
1097 unsigned long red = 0, green = 0, blue = 0; |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1098 int status = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1099 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1100 if (*color_name && !NILP (Ffboundp (Qtty_color_desc))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1101 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1102 Lisp_Object frame; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1103 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1104 XSETFRAME (frame, f); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1105 status = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1106 color_desc = call2 (Qtty_color_desc, build_string (color_name), frame); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1107 if (CONSP (color_desc) && CONSP (XCDR (color_desc))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1108 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1109 color_idx = XINT (XCAR (XCDR (color_desc))); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1110 if (CONSP (XCDR (XCDR (color_desc)))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1111 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1112 red = XINT (XCAR (XCDR (XCDR (color_desc)))); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1113 green = XINT (XCAR (XCDR (XCDR (XCDR (color_desc))))); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1114 blue = XINT (XCAR (XCDR (XCDR (XCDR (XCDR (color_desc)))))); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1115 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1116 status = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1117 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1118 else if (NILP (Fsymbol_value (intern ("tty-defined-color-alist")))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1119 /* We were called early during startup, and the colors are not |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1120 yet set up in tty-defined-color-alist. Don't return a failure |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1121 indication, since this produces the annoying "Unable to |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1122 load color" messages in the *Messages* buffer. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1123 status = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1124 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1125 if (color_idx == FACE_TTY_DEFAULT_COLOR && *color_name) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1126 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1127 if (strcmp (color_name, "unspecified-fg") == 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1128 color_idx = FACE_TTY_DEFAULT_FG_COLOR; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1129 else if (strcmp (color_name, "unspecified-bg") == 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1130 color_idx = FACE_TTY_DEFAULT_BG_COLOR; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1131 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1132 |
27893
0f639a575917
(tty_defined_color): Apply xfaces.c change from 02-17.
Jason Rumney <jasonr@gnu.org>
parents:
27517
diff
changeset
|
1133 if (color_idx != FACE_TTY_DEFAULT_COLOR) |
0f639a575917
(tty_defined_color): Apply xfaces.c change from 02-17.
Jason Rumney <jasonr@gnu.org>
parents:
27517
diff
changeset
|
1134 status = 1; |
0f639a575917
(tty_defined_color): Apply xfaces.c change from 02-17.
Jason Rumney <jasonr@gnu.org>
parents:
27517
diff
changeset
|
1135 |
0f639a575917
(tty_defined_color): Apply xfaces.c change from 02-17.
Jason Rumney <jasonr@gnu.org>
parents:
27517
diff
changeset
|
1136 color_def->pixel = color_idx; |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1137 color_def->red = red; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1138 color_def->green = green; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1139 color_def->blue = blue; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1140 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1141 return status; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1142 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1143 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1144 /* Decide if color named COLOR is valid for the display associated |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1145 with the frame F; if so, return the rgb values in COLOR_DEF. If |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1146 ALLOC is nonzero, allocate a new colormap cell. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1147 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1148 This does the right thing for any type of frame. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1149 int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1150 defined_color (f, color_name, color_def, alloc) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1151 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1152 char *color_name; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1153 XColor *color_def; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1154 int alloc; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1155 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1156 if (!FRAME_WINDOW_P (f)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1157 return tty_defined_color (f, color_name, color_def, alloc); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1158 #ifdef HAVE_X_WINDOWS |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1159 else if (FRAME_X_P (f)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1160 return x_defined_color (f, color_name, color_def, alloc); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1161 #endif |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1162 #ifdef WINDOWSNT |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
1163 else if (FRAME_W32_P (f)) |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1164 return w32_defined_color (f, color_name, color_def, alloc); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1165 #endif |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1166 #ifdef macintosh |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1167 else if (FRAME_MAC_P (f)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1168 /* FIXME: mac_defined_color doesn't exist! */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1169 return mac_defined_color (f, color_name, color_def, alloc); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1170 #endif |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1171 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1172 abort (); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1173 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1174 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1175 /* Given the index of the tty color, return its name, a Lisp string. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1176 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1177 Lisp_Object |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1178 tty_color_name (f, idx) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1179 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1180 int idx; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1181 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1182 char *color; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1183 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1184 if (idx >= 0 && !NILP (Ffboundp (Qtty_color_by_index))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1185 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1186 Lisp_Object frame; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1187 Lisp_Object coldesc; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1188 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1189 XSETFRAME (frame, f); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1190 coldesc = call2 (Qtty_color_by_index, make_number (idx), frame); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1191 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1192 if (!NILP (coldesc)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1193 return XCAR (coldesc); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1194 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1195 #ifdef MSDOS |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1196 /* We can have an MSDOG frame under -nw for a short window of |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1197 opportunity before internal_terminal_init is called. DTRT. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1198 if (FRAME_MSDOS_P (f) && !inhibit_window_system) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1199 return msdos_stdcolor_name (idx); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1200 #endif |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1201 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1202 if (idx == FACE_TTY_DEFAULT_FG_COLOR) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1203 return build_string (unspecified_fg); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1204 if (idx == FACE_TTY_DEFAULT_BG_COLOR) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1205 return build_string (unspecified_bg); |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
1206 |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
1207 #ifdef WINDOWSNT |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
1208 return vga_stdcolor_name (idx); |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
1209 #endif |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
1210 |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1211 return Qunspecified; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1212 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1213 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1214 /* Return non-zero if COLOR_NAME is a shade of gray (or white or |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1215 black) on frame F. The algorithm is taken from 20.2 faces.el. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1216 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1217 static int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1218 face_color_gray_p (f, color_name) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1219 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1220 char *color_name; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1221 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1222 XColor color; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1223 int gray_p; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1224 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1225 if (defined_color (f, color_name, &color, 0)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1226 gray_p = ((abs (color.red - color.green) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1227 < max (color.red, color.green) / 20) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1228 && (abs (color.green - color.blue) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1229 < max (color.green, color.blue) / 20) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1230 && (abs (color.blue - color.red) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1231 < max (color.blue, color.red) / 20)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1232 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1233 gray_p = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1234 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1235 return gray_p; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1236 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1237 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1238 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1239 /* Return non-zero if color COLOR_NAME can be displayed on frame F. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1240 BACKGROUND_P non-zero means the color will be used as background |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1241 color. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1242 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1243 static int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1244 face_color_supported_p (f, color_name, background_p) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1245 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1246 char *color_name; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1247 int background_p; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1248 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1249 Lisp_Object frame; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1250 XColor not_used; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1251 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1252 XSETFRAME (frame, f); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1253 return (FRAME_WINDOW_P (f) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1254 ? (!NILP (Fxw_display_color_p (frame)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1255 || xstricmp (color_name, "black") == 0 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1256 || xstricmp (color_name, "white") == 0 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1257 || (background_p |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1258 && face_color_gray_p (f, color_name)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1259 || (!NILP (Fx_display_grayscale_p (frame)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1260 && face_color_gray_p (f, color_name))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1261 : tty_defined_color (f, color_name, ¬_used, 0)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1262 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1263 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1264 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1265 DEFUN ("color-gray-p", Fcolor_gray_p, Scolor_gray_p, 1, 2, 0, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1266 "Return non-nil if COLOR is a shade of gray (or white or black).\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1267 FRAME specifies the frame and thus the display for interpreting COLOR.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1268 If FRAME is nil or omitted, use the selected frame.") |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1269 (color, frame) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1270 Lisp_Object color, frame; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1271 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1272 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1273 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1274 CHECK_FRAME (frame, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1275 CHECK_STRING (color, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1276 f = XFRAME (frame); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1277 return face_color_gray_p (f, XSTRING (color)->data) ? Qt : Qnil; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1278 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1279 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1280 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1281 DEFUN ("color-supported-p", Fcolor_supported_p, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1282 Scolor_supported_p, 2, 3, 0, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1283 "Return non-nil if COLOR can be displayed on FRAME.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1284 BACKGROUND-P non-nil means COLOR is used as a background.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1285 If FRAME is nil or omitted, use the selected frame.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1286 COLOR must be a valid color name.") |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1287 (color, frame, background_p) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1288 Lisp_Object frame, color, background_p; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1289 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1290 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1291 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1292 CHECK_FRAME (frame, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1293 CHECK_STRING (color, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1294 f = XFRAME (frame); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1295 if (face_color_supported_p (f, XSTRING (color)->data, !NILP (background_p))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1296 return Qt; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1297 return Qnil; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1298 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1299 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1300 /* Load color with name NAME for use by face FACE on frame F. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1301 TARGET_INDEX must be one of LFACE_FOREGROUND_INDEX, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1302 LFACE_BACKGROUND_INDEX, LFACE_UNDERLINE_INDEX, LFACE_OVERLINE_INDEX, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1303 LFACE_STRIKE_THROUGH_INDEX, or LFACE_BOX_INDEX. Value is the |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1304 pixel color. If color cannot be loaded, display a message, and |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1305 return the foreground, background or underline color of F, but |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1306 record that fact in flags of the face so that we don't try to free |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1307 these colors. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1308 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1309 unsigned long |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1310 load_color (f, face, name, target_index) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1311 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1312 struct face *face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1313 Lisp_Object name; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1314 enum lface_attribute_index target_index; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1315 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1316 XColor color; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1317 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1318 xassert (STRINGP (name)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1319 xassert (target_index == LFACE_FOREGROUND_INDEX |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1320 || target_index == LFACE_BACKGROUND_INDEX |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1321 || target_index == LFACE_UNDERLINE_INDEX |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1322 || target_index == LFACE_OVERLINE_INDEX |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1323 || target_index == LFACE_STRIKE_THROUGH_INDEX |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1324 || target_index == LFACE_BOX_INDEX); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1325 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1326 /* if the color map is full, defined_color will return a best match |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1327 to the values in an existing cell. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1328 if (!defined_color (f, XSTRING (name)->data, &color, 1)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1329 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1330 add_to_log ("Unable to load color \"%s\"", name, Qnil); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1331 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1332 switch (target_index) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1333 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1334 case LFACE_FOREGROUND_INDEX: |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1335 face->foreground_defaulted_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1336 color.pixel = FRAME_FOREGROUND_PIXEL (f); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1337 break; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1338 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1339 case LFACE_BACKGROUND_INDEX: |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1340 face->background_defaulted_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1341 color.pixel = FRAME_BACKGROUND_PIXEL (f); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1342 break; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1343 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1344 case LFACE_UNDERLINE_INDEX: |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1345 face->underline_defaulted_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1346 color.pixel = FRAME_FOREGROUND_PIXEL (f); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1347 break; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1348 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1349 case LFACE_OVERLINE_INDEX: |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1350 face->overline_color_defaulted_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1351 color.pixel = FRAME_FOREGROUND_PIXEL (f); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1352 break; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1353 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1354 case LFACE_STRIKE_THROUGH_INDEX: |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1355 face->strike_through_color_defaulted_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1356 color.pixel = FRAME_FOREGROUND_PIXEL (f); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1357 break; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1358 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1359 case LFACE_BOX_INDEX: |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1360 face->box_color_defaulted_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1361 color.pixel = FRAME_FOREGROUND_PIXEL (f); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1362 break; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1363 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1364 default: |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1365 abort (); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1366 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1367 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1368 #if GLYPH_DEBUG |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1369 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1370 ++ncolors_allocated; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1371 #endif |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1372 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1373 return color.pixel; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1374 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1375 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1376 #ifdef HAVE_WINDOW_SYSTEM |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1377 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1378 /* Load colors for face FACE which is used on frame F. Colors are |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1379 specified by slots LFACE_BACKGROUND_INDEX and LFACE_FOREGROUND_INDEX |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1380 of ATTRS. If the background color specified is not supported on F, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1381 try to emulate gray colors with a stipple from Vface_default_stipple. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1382 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1383 static void |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1384 load_face_colors (f, face, attrs) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1385 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1386 struct face *face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1387 Lisp_Object *attrs; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1388 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1389 Lisp_Object fg, bg; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1390 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1391 bg = attrs[LFACE_BACKGROUND_INDEX]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1392 fg = attrs[LFACE_FOREGROUND_INDEX]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1393 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1394 /* Swap colors if face is inverse-video. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1395 if (EQ (attrs[LFACE_INVERSE_INDEX], Qt)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1396 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1397 Lisp_Object tmp; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1398 tmp = fg; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1399 fg = bg; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1400 bg = tmp; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1401 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1402 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1403 /* Check for support for foreground, not for background because |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1404 face_color_supported_p is smart enough to know that grays are |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1405 "supported" as background because we are supposed to use stipple |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1406 for them. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1407 if (!face_color_supported_p (f, XSTRING (bg)->data, 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1408 && !NILP (Fbitmap_spec_p (Vface_default_stipple))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1409 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1410 x_destroy_bitmap (f, face->stipple); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1411 face->stipple = load_pixmap (f, Vface_default_stipple, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1412 &face->pixmap_w, &face->pixmap_h); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1413 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1414 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1415 face->background = load_color (f, face, bg, LFACE_BACKGROUND_INDEX); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1416 face->foreground = load_color (f, face, fg, LFACE_FOREGROUND_INDEX); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1417 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1418 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1419 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1420 /* Free color PIXEL on frame F. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1421 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1422 void |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1423 unload_color (f, pixel) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1424 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1425 unsigned long pixel; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1426 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1427 /* Nothing to do on W32 */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1428 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1429 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1430 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1431 /* Free colors allocated for FACE. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1432 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1433 static void |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1434 free_face_colors (f, face) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1435 struct frame *f; |
13434 | 1436 struct face *face; |
1437 { | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1438 /* Nothing to do on W32 */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1439 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1440 #endif /* HAVE_WINDOW_SYSTEM */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1441 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1442 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1443 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1444 /*********************************************************************** |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1445 XLFD Font Names |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1446 ***********************************************************************/ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1447 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1448 /* An enumerator for each field of an XLFD font name. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1449 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1450 enum xlfd_field |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1451 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1452 XLFD_FOUNDRY, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1453 XLFD_FAMILY, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1454 XLFD_WEIGHT, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1455 XLFD_SLANT, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1456 XLFD_SWIDTH, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1457 XLFD_ADSTYLE, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1458 XLFD_PIXEL_SIZE, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1459 XLFD_POINT_SIZE, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1460 XLFD_RESX, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1461 XLFD_RESY, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1462 XLFD_SPACING, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1463 XLFD_AVGWIDTH, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1464 XLFD_REGISTRY, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1465 XLFD_ENCODING, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1466 XLFD_LAST |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1467 }; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1468 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1469 /* An enumerator for each possible slant value of a font. Taken from |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1470 the XLFD specification. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1471 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1472 enum xlfd_slant |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1473 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1474 XLFD_SLANT_UNKNOWN, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1475 XLFD_SLANT_ROMAN, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1476 XLFD_SLANT_ITALIC, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1477 XLFD_SLANT_OBLIQUE, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1478 XLFD_SLANT_REVERSE_ITALIC, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1479 XLFD_SLANT_REVERSE_OBLIQUE, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1480 XLFD_SLANT_OTHER |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1481 }; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1482 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1483 /* Relative font weight according to XLFD documentation. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1484 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1485 enum xlfd_weight |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1486 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1487 XLFD_WEIGHT_UNKNOWN, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1488 XLFD_WEIGHT_ULTRA_LIGHT, /* 10 */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1489 XLFD_WEIGHT_EXTRA_LIGHT, /* 20 */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1490 XLFD_WEIGHT_LIGHT, /* 30 */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1491 XLFD_WEIGHT_SEMI_LIGHT, /* 40: SemiLight, Book, ... */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1492 XLFD_WEIGHT_MEDIUM, /* 50: Medium, Normal, Regular, ... */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1493 XLFD_WEIGHT_SEMI_BOLD, /* 60: SemiBold, DemiBold, ... */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1494 XLFD_WEIGHT_BOLD, /* 70: Bold, ... */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1495 XLFD_WEIGHT_EXTRA_BOLD, /* 80: ExtraBold, Heavy, ... */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1496 XLFD_WEIGHT_ULTRA_BOLD /* 90: UltraBold, Black, ... */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1497 }; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1498 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1499 /* Relative proportionate width. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1500 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1501 enum xlfd_swidth |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1502 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1503 XLFD_SWIDTH_UNKNOWN, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1504 XLFD_SWIDTH_ULTRA_CONDENSED, /* 10 */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1505 XLFD_SWIDTH_EXTRA_CONDENSED, /* 20 */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1506 XLFD_SWIDTH_CONDENSED, /* 30: Condensed, Narrow, Compressed, ... */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1507 XLFD_SWIDTH_SEMI_CONDENSED, /* 40: semicondensed */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1508 XLFD_SWIDTH_MEDIUM, /* 50: Medium, Normal, Regular, ... */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1509 XLFD_SWIDTH_SEMI_EXPANDED, /* 60: SemiExpanded, DemiExpanded, ... */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1510 XLFD_SWIDTH_EXPANDED, /* 70: Expanded... */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1511 XLFD_SWIDTH_EXTRA_EXPANDED, /* 80: ExtraExpanded, Wide... */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1512 XLFD_SWIDTH_ULTRA_EXPANDED /* 90: UltraExpanded... */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1513 }; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1514 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1515 /* Structure used for tables mapping XLFD weight, slant, and width |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1516 names to numeric and symbolic values. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1517 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1518 struct table_entry |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1519 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1520 char *name; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1521 int numeric; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1522 Lisp_Object *symbol; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1523 }; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1524 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1525 /* Table of XLFD slant names and their numeric and symbolic |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1526 representations. This table must be sorted by slant names in |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1527 ascending order. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1528 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1529 static struct table_entry slant_table[] = |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1530 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1531 {"i", XLFD_SLANT_ITALIC, &Qitalic}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1532 {"o", XLFD_SLANT_OBLIQUE, &Qoblique}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1533 {"ot", XLFD_SLANT_OTHER, &Qitalic}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1534 {"r", XLFD_SLANT_ROMAN, &Qnormal}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1535 {"ri", XLFD_SLANT_REVERSE_ITALIC, &Qreverse_italic}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1536 {"ro", XLFD_SLANT_REVERSE_OBLIQUE, &Qreverse_oblique} |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1537 }; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1538 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1539 /* Table of XLFD weight names. This table must be sorted by weight |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1540 names in ascending order. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1541 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1542 static struct table_entry weight_table[] = |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1543 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1544 {"black", XLFD_WEIGHT_ULTRA_BOLD, &Qultra_bold}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1545 {"bold", XLFD_WEIGHT_BOLD, &Qbold}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1546 {"book", XLFD_WEIGHT_SEMI_LIGHT, &Qsemi_light}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1547 {"demibold", XLFD_WEIGHT_SEMI_BOLD, &Qsemi_bold}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1548 {"extralight", XLFD_WEIGHT_EXTRA_LIGHT, &Qextra_light}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1549 {"extrabold", XLFD_WEIGHT_EXTRA_BOLD, &Qextra_bold}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1550 {"heavy", XLFD_WEIGHT_EXTRA_BOLD, &Qextra_bold}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1551 {"light", XLFD_WEIGHT_LIGHT, &Qlight}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1552 {"medium", XLFD_WEIGHT_MEDIUM, &Qnormal}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1553 {"normal", XLFD_WEIGHT_MEDIUM, &Qnormal}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1554 {"regular", XLFD_WEIGHT_MEDIUM, &Qnormal}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1555 {"semibold", XLFD_WEIGHT_SEMI_BOLD, &Qsemi_bold}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1556 {"semilight", XLFD_WEIGHT_SEMI_LIGHT, &Qsemi_light}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1557 {"ultralight", XLFD_WEIGHT_ULTRA_LIGHT, &Qultra_light}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1558 {"ultrabold", XLFD_WEIGHT_ULTRA_BOLD, &Qultra_bold} |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1559 }; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1560 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1561 /* Table of XLFD width names. This table must be sorted by width |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1562 names in ascending order. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1563 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1564 static struct table_entry swidth_table[] = |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1565 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1566 {"compressed", XLFD_SWIDTH_CONDENSED, &Qcondensed}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1567 {"condensed", XLFD_SWIDTH_CONDENSED, &Qcondensed}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1568 {"demiexpanded", XLFD_SWIDTH_SEMI_EXPANDED, &Qsemi_expanded}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1569 {"expanded", XLFD_SWIDTH_EXPANDED, &Qexpanded}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1570 {"extracondensed", XLFD_SWIDTH_EXTRA_CONDENSED, &Qextra_condensed}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1571 {"extraexpanded", XLFD_SWIDTH_EXTRA_EXPANDED, &Qextra_expanded}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1572 {"medium", XLFD_SWIDTH_MEDIUM, &Qnormal}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1573 {"narrow", XLFD_SWIDTH_CONDENSED, &Qcondensed}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1574 {"normal", XLFD_SWIDTH_MEDIUM, &Qnormal}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1575 {"regular", XLFD_SWIDTH_MEDIUM, &Qnormal}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1576 {"semicondensed", XLFD_SWIDTH_SEMI_CONDENSED, &Qsemi_condensed}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1577 {"semiexpanded", XLFD_SWIDTH_SEMI_EXPANDED, &Qsemi_expanded}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1578 {"ultracondensed", XLFD_SWIDTH_ULTRA_CONDENSED, &Qultra_condensed}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1579 {"ultraexpanded", XLFD_SWIDTH_ULTRA_EXPANDED, &Qultra_expanded}, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1580 {"wide", XLFD_SWIDTH_EXTRA_EXPANDED, &Qextra_expanded} |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1581 }; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1582 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1583 /* Structure used to hold the result of splitting font names in XLFD |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1584 format into their fields. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1585 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1586 struct font_name |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1587 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1588 /* The original name which is modified destructively by |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1589 split_font_name. The pointer is kept here to be able to free it |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1590 if it was allocated from the heap. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1591 char *name; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1592 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1593 /* Font name fields. Each vector element points into `name' above. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1594 Fields are NUL-terminated. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1595 char *fields[XLFD_LAST]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1596 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1597 /* Numeric values for those fields that interest us. See |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1598 split_font_name for which these are. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1599 int numeric[XLFD_LAST]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1600 }; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1601 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1602 /* The frame in effect when sorting font names. Set temporarily in |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1603 sort_fonts so that it is available in font comparison functions. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1604 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1605 static struct frame *font_frame; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1606 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1607 /* Order by which font selection chooses fonts. The default values |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1608 mean `first, find a best match for the font width, then for the |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1609 font height, then for weight, then for slant.' This variable can be |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1610 set via set-face-font-sort-order. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1611 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1612 static int font_sort_order[4]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1613 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1614 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1615 /* Look up FONT.fields[FIELD_INDEX] in TABLE which has DIM entries. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1616 TABLE must be sorted by TABLE[i]->name in ascending order. Value |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1617 is a pointer to the matching table entry or null if no table entry |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1618 matches. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1619 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1620 static struct table_entry * |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1621 xlfd_lookup_field_contents (table, dim, font, field_index) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1622 struct table_entry *table; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1623 int dim; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1624 struct font_name *font; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1625 int field_index; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1626 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1627 /* Function split_font_name converts fields to lower-case, so there |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1628 is no need to use xstrlwr or xstricmp here. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1629 char *s = font->fields[field_index]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1630 int low, mid, high, cmp; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1631 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1632 low = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1633 high = dim - 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1634 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1635 while (low <= high) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1636 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1637 mid = (low + high) / 2; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1638 cmp = strcmp (table[mid].name, s); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1639 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1640 if (cmp < 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1641 low = mid + 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1642 else if (cmp > 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1643 high = mid - 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1644 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1645 return table + mid; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1646 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1647 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1648 return NULL; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1649 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1650 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1651 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1652 /* Return a numeric representation for font name field |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1653 FONT.fields[FIELD_INDEX]. The field is looked up in TABLE which |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1654 has DIM entries. Value is the numeric value found or DFLT if no |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1655 table entry matches. This function is used to translate weight, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1656 slant, and swidth names of XLFD font names to numeric values. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1657 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1658 static INLINE int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1659 xlfd_numeric_value (table, dim, font, field_index, dflt) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1660 struct table_entry *table; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1661 int dim; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1662 struct font_name *font; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1663 int field_index; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1664 int dflt; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1665 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1666 struct table_entry *p; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1667 p = xlfd_lookup_field_contents (table, dim, font, field_index); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1668 return p ? p->numeric : dflt; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1669 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1670 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1671 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1672 /* Return a symbolic representation for font name field |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1673 FONT.fields[FIELD_INDEX]. The field is looked up in TABLE which |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1674 has DIM entries. Value is the symbolic value found or DFLT if no |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1675 table entry matches. This function is used to translate weight, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1676 slant, and swidth names of XLFD font names to symbols. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1677 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1678 static INLINE Lisp_Object |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1679 xlfd_symbolic_value (table, dim, font, field_index, dflt) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1680 struct table_entry *table; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1681 int dim; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1682 struct font_name *font; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1683 int field_index; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1684 int dflt; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1685 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1686 struct table_entry *p; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1687 p = xlfd_lookup_field_contents (table, dim, font, field_index); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1688 return p ? *p->symbol : dflt; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1689 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1690 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1691 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1692 /* Return a numeric value for the slant of the font given by FONT. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1693 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1694 static INLINE int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1695 xlfd_numeric_slant (font) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1696 struct font_name *font; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1697 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1698 return xlfd_numeric_value (slant_table, DIM (slant_table), |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1699 font, XLFD_SLANT, XLFD_SLANT_ROMAN); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1700 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1701 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1702 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1703 /* Return a symbol representing the weight of the font given by FONT. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1704 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1705 static INLINE Lisp_Object |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1706 xlfd_symbolic_slant (font) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1707 struct font_name *font; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1708 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1709 return xlfd_symbolic_value (slant_table, DIM (slant_table), |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1710 font, XLFD_SLANT, Qnormal); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1711 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1712 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1713 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1714 /* Return a numeric value for the weight of the font given by FONT. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1715 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1716 static INLINE int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1717 xlfd_numeric_weight (font) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1718 struct font_name *font; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1719 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1720 return xlfd_numeric_value (weight_table, DIM (weight_table), |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1721 font, XLFD_WEIGHT, XLFD_WEIGHT_MEDIUM); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1722 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1723 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1724 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1725 /* Return a symbol representing the slant of the font given by FONT. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1726 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1727 static INLINE Lisp_Object |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1728 xlfd_symbolic_weight (font) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1729 struct font_name *font; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1730 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1731 return xlfd_symbolic_value (weight_table, DIM (weight_table), |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1732 font, XLFD_WEIGHT, Qnormal); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1733 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1734 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1735 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1736 /* Return a numeric value for the swidth of the font whose XLFD font |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1737 name fields are found in FONT. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1738 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1739 static INLINE int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1740 xlfd_numeric_swidth (font) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1741 struct font_name *font; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1742 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1743 return xlfd_numeric_value (swidth_table, DIM (swidth_table), |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1744 font, XLFD_SWIDTH, XLFD_SWIDTH_MEDIUM); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1745 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1746 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1747 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1748 /* Return a symbolic value for the swidth of FONT. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1749 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1750 static INLINE Lisp_Object |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1751 xlfd_symbolic_swidth (font) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1752 struct font_name *font; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1753 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1754 return xlfd_symbolic_value (swidth_table, DIM (swidth_table), |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1755 font, XLFD_SWIDTH, Qnormal); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1756 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1757 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1758 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1759 /* Look up the entry of SYMBOL in the vector TABLE which has DIM |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1760 entries. Value is a pointer to the matching table entry or null if |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1761 no element of TABLE contains SYMBOL. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1762 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1763 static struct table_entry * |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1764 face_value (table, dim, symbol) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1765 struct table_entry *table; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1766 int dim; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1767 Lisp_Object symbol; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1768 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1769 int i; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1770 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1771 xassert (SYMBOLP (symbol)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1772 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1773 for (i = 0; i < dim; ++i) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1774 if (EQ (*table[i].symbol, symbol)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1775 break; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1776 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1777 return i < dim ? table + i : NULL; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1778 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1779 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1780 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1781 /* Return a numeric value for SYMBOL in the vector TABLE which has DIM |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1782 entries. Value is -1 if SYMBOL is not found in TABLE. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1783 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1784 static INLINE int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1785 face_numeric_value (table, dim, symbol) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1786 struct table_entry *table; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1787 int dim; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1788 Lisp_Object symbol; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1789 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1790 struct table_entry *p = face_value (table, dim, symbol); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1791 return p ? p->numeric : -1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1792 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1793 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1794 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1795 /* Return a numeric value representing the weight specified by Lisp |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1796 symbol WEIGHT. Value is one of the enumerators of enum |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1797 xlfd_weight. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1798 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1799 static INLINE int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1800 face_numeric_weight (weight) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1801 Lisp_Object weight; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1802 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1803 return face_numeric_value (weight_table, DIM (weight_table), weight); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1804 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1805 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1806 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1807 /* Return a numeric value representing the slant specified by Lisp |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1808 symbol SLANT. Value is one of the enumerators of enum xlfd_slant. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1809 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1810 static INLINE int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1811 face_numeric_slant (slant) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1812 Lisp_Object slant; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1813 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1814 return face_numeric_value (slant_table, DIM (slant_table), slant); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1815 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1816 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1817 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1818 /* Return a numeric value representing the swidth specified by Lisp |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1819 symbol WIDTH. Value is one of the enumerators of enum xlfd_swidth. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1820 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1821 static int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1822 face_numeric_swidth (width) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1823 Lisp_Object width; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1824 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1825 return face_numeric_value (swidth_table, DIM (swidth_table), width); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1826 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1827 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1828 |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
1829 #ifdef HAVE_WINDOW_SYSTEM |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
1830 |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1831 /* Return non-zero if FONT is the name of a fixed-pitch font. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1832 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1833 static INLINE int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1834 xlfd_fixed_p (font) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1835 struct font_name *font; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1836 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1837 /* Function split_font_name converts fields to lower-case, so there |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1838 is no need to use tolower here. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1839 return *font->fields[XLFD_SPACING] != 'p'; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1840 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1841 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1842 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1843 /* Return the point size of FONT on frame F, measured in 1/10 pt. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1844 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1845 The actual height of the font when displayed on F depends on the |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1846 resolution of both the font and frame. For example, a 10pt font |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1847 designed for a 100dpi display will display larger than 10pt on a |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1848 75dpi display. (It's not unusual to use fonts not designed for the |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1849 display one is using. For example, some intlfonts are available in |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1850 72dpi versions, only.) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1851 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1852 Value is the real point size of FONT on frame F, or 0 if it cannot |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1853 be determined. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1854 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1855 static INLINE int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1856 xlfd_point_size (f, font) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1857 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1858 struct font_name *font; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1859 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1860 double resy = FRAME_W32_DISPLAY_INFO (f)->resy; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1861 double font_resy = atoi (font->fields[XLFD_RESY]); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1862 double font_pt = atoi (font->fields[XLFD_POINT_SIZE]); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1863 int real_pt; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1864 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1865 if (font_resy == 0 || font_pt == 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1866 real_pt = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1867 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1868 real_pt = (font_resy / resy) * font_pt + 0.5; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1869 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1870 return real_pt; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1871 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1872 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1873 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1874 /* Split XLFD font name FONT->name destructively into NUL-terminated, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1875 lower-case fields in FONT->fields. NUMERIC_P non-zero means |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1876 compute numeric values for fields XLFD_POINT_SIZE, XLFD_SWIDTH, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1877 XLFD_RESY, XLFD_SLANT, and XLFD_WEIGHT in FONT->numeric. Value is |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1878 zero if the font name doesn't have the format we expect. The |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1879 expected format is a font name that starts with a `-' and has |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1880 XLFD_LAST fields separated by `-'. (The XLFD specification allows |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1881 forms of font names where certain field contents are enclosed in |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1882 square brackets. We don't support that, for now. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1883 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1884 static int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1885 split_font_name (f, font, numeric_p) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1886 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1887 struct font_name *font; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1888 int numeric_p; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1889 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1890 int i = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1891 int success_p; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1892 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1893 if (*font->name == '-') |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1894 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1895 char *p = xstrlwr (font->name) + 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1896 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1897 while (i < XLFD_LAST) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1898 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1899 font->fields[i] = p; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1900 ++i; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1901 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1902 while (*p && *p != '-') |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1903 ++p; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1904 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1905 if (*p != '-') |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1906 break; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1907 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1908 *p++ = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1909 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1910 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1911 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1912 success_p = i == XLFD_LAST; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1913 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1914 /* If requested, and font name was in the expected format, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1915 compute numeric values for some fields. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1916 if (numeric_p && success_p) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1917 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1918 font->numeric[XLFD_POINT_SIZE] = xlfd_point_size (f, font); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1919 font->numeric[XLFD_RESY] = atoi (font->fields[XLFD_RESY]); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1920 font->numeric[XLFD_SLANT] = xlfd_numeric_slant (font); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1921 font->numeric[XLFD_WEIGHT] = xlfd_numeric_weight (font); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1922 font->numeric[XLFD_SWIDTH] = xlfd_numeric_swidth (font); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1923 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1924 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1925 return success_p; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1926 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1927 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1928 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1929 /* Build an XLFD font name from font name fields in FONT. Value is a |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1930 pointer to the font name, which is allocated via xmalloc. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1931 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1932 static char * |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1933 build_font_name (font) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1934 struct font_name *font; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1935 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1936 int i; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1937 int size = 100; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1938 char *font_name = (char *) xmalloc (size); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1939 int total_length = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1940 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1941 for (i = 0; i < XLFD_LAST; ++i) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1942 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1943 /* Add 1 because of the leading `-'. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1944 int len = strlen (font->fields[i]) + 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1945 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1946 /* Reallocate font_name if necessary. Add 1 for the final |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1947 NUL-byte. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1948 if (total_length + len + 1 >= size) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1949 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1950 int new_size = max (2 * size, size + len + 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1951 int sz = new_size * sizeof *font_name; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1952 font_name = (char *) xrealloc (font_name, sz); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1953 size = new_size; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1954 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1955 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1956 font_name[total_length] = '-'; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1957 bcopy (font->fields[i], font_name + total_length + 1, len - 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1958 total_length += len; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1959 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1960 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1961 font_name[total_length] = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1962 return font_name; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1963 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1964 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1965 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1966 /* Free an array FONTS of N font_name structures. This frees FONTS |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1967 itself and all `name' fields in its elements. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1968 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1969 static INLINE void |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1970 free_font_names (fonts, n) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1971 struct font_name *fonts; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1972 int n; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1973 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1974 while (n) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1975 xfree (fonts[--n].name); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1976 xfree (fonts); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1977 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1978 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1979 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1980 /* Sort vector FONTS of font_name structures which contains NFONTS |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1981 elements using qsort and comparison function CMPFN. F is the frame |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1982 on which the fonts will be used. The global variable font_frame |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1983 is temporarily set to F to make it available in CMPFN. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1984 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1985 static INLINE void |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1986 sort_fonts (f, fonts, nfonts, cmpfn) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1987 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1988 struct font_name *fonts; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1989 int nfonts; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1990 int (*cmpfn) P_ ((const void *, const void *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1991 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1992 font_frame = f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1993 qsort (fonts, nfonts, sizeof *fonts, cmpfn); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1994 font_frame = NULL; |
13434 | 1995 } |
1996 | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1997 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1998 /* Get fonts matching PATTERN on frame F. If F is null, use the first |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
1999 display in x_display_list. FONTS is a pointer to a vector of |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2000 NFONTS font_name structures. TRY_ALTERNATIVES_P non-zero means try |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2001 alternative patterns from Valternate_fontname_alist if no fonts are |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2002 found matching PATTERN. SCALABLE_FONTS_P non-zero means include |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2003 scalable fonts. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2004 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2005 For all fonts found, set FONTS[i].name to the name of the font, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2006 allocated via xmalloc, and split font names into fields. Ignore |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2007 fonts that we can't parse. Value is the number of fonts found. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2008 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2009 This is similar to x_list_fonts. The differences are: |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2010 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2011 1. It avoids consing. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2012 2. It never calls XLoadQueryFont. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2013 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2014 static int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2015 x_face_list_fonts (f, pattern, fonts, nfonts, try_alternatives_p, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2016 scalable_fonts_p) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2017 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2018 char *pattern; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2019 struct font_name *fonts; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2020 int nfonts, try_alternatives_p; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2021 int scalable_fonts_p; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2022 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2023 /* NTEMACS_TODO : currently this uses w32_list_fonts, but it may be |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2024 better to do it the other way around. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2025 int n = 0, i, j; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2026 char **names = NULL; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2027 Lisp_Object lfonts; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2028 Lisp_Object lpattern, tem; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2029 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2030 lpattern = build_string (pattern); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2031 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2032 /* Get the list of fonts matching PATTERN. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2033 BLOCK_INPUT; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2034 lfonts = w32_list_fonts (f, lpattern, 0, nfonts); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2035 UNBLOCK_INPUT; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2036 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2037 /* Count fonts returned */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2038 for (tem = lfonts; CONSP (tem); tem = XCDR (tem)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2039 n++; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2040 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2041 /* Allocate array. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2042 if (n) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2043 names = (char **) xmalloc (n * sizeof (char *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2044 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2045 /* Extract font names into char * array. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2046 tem = lfonts; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2047 for (i = 0; i < n; i++) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2048 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2049 names[i] = XSTRING (XCAR (tem))->data; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2050 tem = XCDR (tem); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2051 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2052 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2053 if (names) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2054 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2055 /* Make a copy of the font names we got from X, and |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2056 split them into fields. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2057 for (i = j = 0; i < n; ++i) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2058 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2059 /* Make a copy of the font name. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2060 fonts[j].name = xstrdup (names[i]); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2061 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2062 /* Ignore fonts having a name that we can't parse. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2063 if (!split_font_name (f, fonts + j, 1)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2064 xfree (fonts[j].name); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2065 else if (font_scalable_p (fonts + j)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2066 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2067 #if SCALABLE_FONTS |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2068 if (!scalable_fonts_p |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2069 || !may_use_scalable_font_p (fonts + j, names[i])) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2070 xfree (fonts[j].name); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2071 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2072 ++j; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2073 #else /* !SCALABLE_FONTS */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2074 /* Always ignore scalable fonts. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2075 xfree (fonts[j].name); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2076 #endif /* !SCALABLE_FONTS */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2077 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2078 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2079 ++j; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2080 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2081 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2082 n = j; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2083 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2084 /* Free font names. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2085 #if 0 /* NTEMACS_TODO : W32 equivalent? */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2086 BLOCK_INPUT; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2087 XFreeFontNames (names); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2088 UNBLOCK_INPUT; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2089 #endif /* NTEMACS_TODO */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2090 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2091 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2092 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2093 /* If no fonts found, try patterns from Valternate_fontname_alist. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2094 if (n == 0 && try_alternatives_p) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2095 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2096 Lisp_Object list = Valternate_fontname_alist; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2097 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2098 while (CONSP (list)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2099 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2100 Lisp_Object entry = XCAR (list); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2101 if (CONSP (entry) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2102 && STRINGP (XCAR (entry)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2103 && strcmp (XSTRING (XCAR (entry))->data, pattern) == 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2104 break; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2105 list = XCDR (list); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2106 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2107 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2108 if (CONSP (list)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2109 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2110 Lisp_Object patterns = XCAR (list); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2111 Lisp_Object name; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2112 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2113 while (CONSP (patterns) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2114 /* If list is screwed up, give up. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2115 && (name = XCAR (patterns), |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2116 STRINGP (name)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2117 /* Ignore patterns equal to PATTERN because we tried that |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2118 already with no success. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2119 && (strcmp (XSTRING (name)->data, pattern) == 0 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2120 || (n = x_face_list_fonts (f, XSTRING (name)->data, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2121 fonts, nfonts, 0, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2122 scalable_fonts_p), |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2123 n == 0))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2124 patterns = XCDR (patterns); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2125 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2126 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2127 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2128 return n; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2129 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2130 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2131 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2132 /* Determine the first font matching PATTERN on frame F. Return in |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2133 *FONT the matching font name, split into fields. Value is non-zero |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2134 if a match was found. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2135 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2136 static int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2137 first_font_matching (f, pattern, font) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2138 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2139 char *pattern; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2140 struct font_name *font; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2141 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2142 int nfonts = 100; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2143 struct font_name *fonts; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2144 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2145 fonts = (struct font_name *) xmalloc (nfonts * sizeof *fonts); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2146 nfonts = x_face_list_fonts (f, pattern, fonts, nfonts, 1, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2147 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2148 if (nfonts > 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2149 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2150 bcopy (&fonts[0], font, sizeof *font); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2151 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2152 fonts[0].name = NULL; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2153 free_font_names (fonts, nfonts); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2154 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2155 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2156 return nfonts > 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2157 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2158 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2159 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2160 /* Determine fonts matching PATTERN on frame F. Sort resulting fonts |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2161 using comparison function CMPFN. Value is the number of fonts |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2162 found. If value is non-zero, *FONTS is set to a vector of |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2163 font_name structures allocated from the heap containing matching |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2164 fonts. Each element of *FONTS contains a name member that is also |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2165 allocated from the heap. Font names in these structures are split |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2166 into fields. Use free_font_names to free such an array. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2167 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2168 static int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2169 sorted_font_list (f, pattern, cmpfn, fonts) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2170 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2171 char *pattern; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2172 int (*cmpfn) P_ ((const void *, const void *)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2173 struct font_name **fonts; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2174 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2175 int nfonts; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2176 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2177 /* Get the list of fonts matching pattern. 100 should suffice. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2178 nfonts = DEFAULT_FONT_LIST_LIMIT; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2179 if (INTEGERP (Vfont_list_limit) && XINT (Vfont_list_limit) > 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2180 nfonts = XFASTINT (Vfont_list_limit); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2181 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2182 *fonts = (struct font_name *) xmalloc (nfonts * sizeof **fonts); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2183 #if SCALABLE_FONTS |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2184 nfonts = x_face_list_fonts (f, pattern, *fonts, nfonts, 1, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2185 #else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2186 nfonts = x_face_list_fonts (f, pattern, *fonts, nfonts, 1, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2187 #endif |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2188 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2189 /* Sort the resulting array and return it in *FONTS. If no |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2190 fonts were found, make sure to set *FONTS to null. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2191 if (nfonts) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2192 sort_fonts (f, *fonts, nfonts, cmpfn); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2193 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2194 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2195 xfree (*fonts); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2196 *fonts = NULL; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2197 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2198 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2199 return nfonts; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2200 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2201 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2202 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2203 /* Compare two font_name structures *A and *B. Value is analogous to |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2204 strcmp. Sort order is given by the global variable |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2205 font_sort_order. Font names are sorted so that, everything else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2206 being equal, fonts with a resolution closer to that of the frame on |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2207 which they are used are listed first. The global variable |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2208 font_frame is the frame on which we operate. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2209 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2210 static int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2211 cmp_font_names (a, b) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2212 const void *a, *b; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2213 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2214 struct font_name *x = (struct font_name *) a; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2215 struct font_name *y = (struct font_name *) b; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2216 int cmp; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2217 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2218 /* All strings have been converted to lower-case by split_font_name, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2219 so we can use strcmp here. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2220 cmp = strcmp (x->fields[XLFD_FAMILY], y->fields[XLFD_FAMILY]); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2221 if (cmp == 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2222 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2223 int i; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2224 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2225 for (i = 0; i < DIM (font_sort_order) && cmp == 0; ++i) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2226 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2227 int j = font_sort_order[i]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2228 cmp = x->numeric[j] - y->numeric[j]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2229 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2230 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2231 if (cmp == 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2232 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2233 /* Everything else being equal, we prefer fonts with an |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2234 y-resolution closer to that of the frame. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2235 int resy = FRAME_W32_DISPLAY_INFO (font_frame)->resy; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2236 int x_resy = x->numeric[XLFD_RESY]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2237 int y_resy = y->numeric[XLFD_RESY]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2238 cmp = abs (resy - x_resy) - abs (resy - y_resy); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2239 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2240 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2241 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2242 return cmp; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2243 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2244 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2245 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2246 /* Get a sorted list of fonts of family FAMILY on frame F. If PATTERN |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2247 is non-null list fonts matching that pattern. Otherwise, if |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2248 REGISTRY_AND_ENCODING is non-null return only fonts with that |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2249 registry and encoding, otherwise return fonts of any registry and |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2250 encoding. Set *FONTS to a vector of font_name structures allocated |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2251 from the heap containing the fonts found. Value is the number of |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2252 fonts found. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2253 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2254 static int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2255 font_list (f, pattern, family, registry_and_encoding, fonts) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2256 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2257 char *pattern; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2258 char *family; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2259 char *registry_and_encoding; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2260 struct font_name **fonts; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2261 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2262 if (pattern == NULL) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2263 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2264 if (family == NULL) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2265 family = "*"; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2266 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2267 if (registry_and_encoding == NULL) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2268 registry_and_encoding = "*"; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2269 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2270 pattern = (char *) alloca (strlen (family) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2271 + strlen (registry_and_encoding) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2272 + 10); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2273 if (index (family, '-')) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2274 sprintf (pattern, "-%s-*-%s", family, registry_and_encoding); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2275 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2276 sprintf (pattern, "-*-%s-*-%s", family, registry_and_encoding); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2277 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2278 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2279 return sorted_font_list (f, pattern, cmp_font_names, fonts); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2280 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2281 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2282 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2283 /* Remove elements from LIST whose cars are `equal'. Called from |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2284 x-family-fonts and x-font-family-list to remove duplicate font |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2285 entries. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2286 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2287 static void |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2288 remove_duplicates (list) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2289 Lisp_Object list; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2290 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2291 Lisp_Object tail = list; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2292 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2293 while (!NILP (tail) && !NILP (XCDR (tail))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2294 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2295 Lisp_Object next = XCDR (tail); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2296 if (!NILP (Fequal (XCAR (next), XCAR (tail)))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2297 XCDR (tail) = XCDR (next); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2298 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2299 tail = XCDR (tail); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2300 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2301 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2302 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2303 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2304 DEFUN ("x-family-fonts", Fx_family_fonts, Sx_family_fonts, 0, 2, 0, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2305 "Return a list of available fonts of family FAMILY on FRAME.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2306 If FAMILY is omitted or nil, list all families.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2307 Otherwise, FAMILY must be a string, possibly containing wildcards\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2308 `?' and `*'.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2309 If FRAME is omitted or nil, use the selected frame.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2310 Each element of the result is a vector [FAMILY WIDTH POINT-SIZE WEIGHT\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2311 SLANT FIXED-P FULL REGISTRY-AND-ENCODING].\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2312 FAMILY is the font family name. POINT-SIZE is the size of the\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2313 font in 1/10 pt. WIDTH, WEIGHT, and SLANT are symbols describing the\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2314 width, weight and slant of the font. These symbols are the same as for\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2315 face attributes. FIXED-P is non-nil if the font is fixed-pitch.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2316 FULL is the full name of the font, and REGISTRY-AND-ENCODING is a string\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2317 giving the registry and encoding of the font.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2318 The result list is sorted according to the current setting of\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2319 the face font sort order.") |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2320 (family, frame) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2321 Lisp_Object family, frame; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2322 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2323 struct frame *f = check_x_frame (frame); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2324 struct font_name *fonts; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2325 int i, nfonts; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2326 Lisp_Object result; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2327 struct gcpro gcpro1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2328 char *family_pattern; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2329 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2330 if (NILP (family)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2331 family_pattern = "*"; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2332 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2333 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2334 CHECK_STRING (family, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2335 family_pattern = LSTRDUPA (family); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2336 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2337 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2338 result = Qnil; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2339 GCPRO1 (result); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2340 nfonts = font_list (f, NULL, family_pattern, NULL, &fonts); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2341 for (i = nfonts - 1; i >= 0; --i) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2342 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2343 Lisp_Object v = Fmake_vector (make_number (8), Qnil); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2344 char *tem; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2345 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2346 #define ASET(VECTOR, IDX, VAL) (XVECTOR (VECTOR)->contents[IDX] = (VAL)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2347 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2348 ASET (v, 0, build_string (fonts[i].fields[XLFD_FAMILY])); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2349 ASET (v, 1, xlfd_symbolic_swidth (fonts + i)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2350 ASET (v, 2, make_number (xlfd_point_size (f, fonts + i))); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2351 ASET (v, 3, xlfd_symbolic_weight (fonts + i)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2352 ASET (v, 4, xlfd_symbolic_slant (fonts + i)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2353 ASET (v, 5, xlfd_fixed_p (fonts + i) ? Qt : Qnil); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2354 tem = build_font_name (fonts + i); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2355 ASET (v, 6, build_string (tem)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2356 sprintf (tem, "%s-%s", fonts[i].fields[XLFD_REGISTRY], |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2357 fonts[i].fields[XLFD_ENCODING]); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2358 ASET (v, 7, build_string (tem)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2359 xfree (tem); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2360 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2361 result = Fcons (v, result); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2362 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2363 #undef ASET |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2364 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2365 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2366 remove_duplicates (result); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2367 free_font_names (fonts, nfonts); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2368 UNGCPRO; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2369 return result; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2370 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2371 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2372 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2373 DEFUN ("x-font-family-list", Fx_font_family_list, Sx_font_family_list, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2374 0, 1, 0, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2375 "Return a list of available font families on FRAME.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2376 If FRAME is omitted or nil, use the selected frame.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2377 Value is a list of conses (FAMILY . FIXED-P) where FAMILY\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2378 is a font family, and FIXED-P is non-nil if fonts of that family\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2379 are fixed-pitch.") |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2380 (frame) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2381 Lisp_Object frame; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2382 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2383 struct frame *f = check_x_frame (frame); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2384 int nfonts, i; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2385 struct font_name *fonts; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2386 Lisp_Object result; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2387 struct gcpro gcpro1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2388 int count = specpdl_ptr - specpdl; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2389 int limit; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2390 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2391 /* Let's consider all fonts. Increase the limit for matching |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2392 fonts until we have them all. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2393 for (limit = 500;;) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2394 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2395 specbind (intern ("font-list-limit"), make_number (limit)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2396 nfonts = font_list (f, NULL, "*", NULL, &fonts); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2397 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2398 if (nfonts == limit) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2399 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2400 free_font_names (fonts, nfonts); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2401 limit *= 2; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2402 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2403 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2404 break; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2405 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2406 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2407 result = Qnil; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2408 GCPRO1 (result); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2409 for (i = nfonts - 1; i >= 0; --i) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2410 result = Fcons (Fcons (build_string (fonts[i].fields[XLFD_FAMILY]), |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2411 xlfd_fixed_p (fonts + i) ? Qt : Qnil), |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2412 result); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2413 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2414 remove_duplicates (result); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2415 free_font_names (fonts, nfonts); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2416 UNGCPRO; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2417 return unbind_to (count, result); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2418 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2419 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2420 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2421 DEFUN ("x-list-fonts", Fx_list_fonts, Sx_list_fonts, 1, 5, 0, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2422 "Return a list of the names of available fonts matching PATTERN.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2423 If optional arguments FACE and FRAME are specified, return only fonts\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2424 the same size as FACE on FRAME.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2425 PATTERN is a string, perhaps with wildcard characters;\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2426 the * character matches any substring, and\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2427 the ? character matches any single character.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2428 PATTERN is case-insensitive.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2429 FACE is a face name--a symbol.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2430 \n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2431 The return value is a list of strings, suitable as arguments to\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2432 set-face-font.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2433 \n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2434 Fonts Emacs can't use may or may not be excluded\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2435 even if they match PATTERN and FACE.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2436 The optional fourth argument MAXIMUM sets a limit on how many\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2437 fonts to match. The first MAXIMUM fonts are reported.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2438 The optional fifth argument WIDTH, if specified, is a number of columns\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2439 occupied by a character of a font. In that case, return only fonts\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2440 the WIDTH times as wide as FACE on FRAME.") |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2441 (pattern, face, frame, maximum, width) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2442 Lisp_Object pattern, face, frame, maximum, width; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2443 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2444 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2445 int size; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2446 int maxnames; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2447 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2448 check_w32 (); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2449 CHECK_STRING (pattern, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2450 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2451 if (NILP (maximum)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2452 maxnames = 2000; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2453 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2454 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2455 CHECK_NATNUM (maximum, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2456 maxnames = XINT (maximum); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2457 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2458 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2459 if (!NILP (width)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2460 CHECK_NUMBER (width, 4); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2461 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2462 /* We can't simply call check_x_frame because this function may be |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2463 called before any frame is created. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2464 f = frame_or_selected_frame (frame, 2); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2465 if (!FRAME_WINDOW_P (f)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2466 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2467 /* Perhaps we have not yet created any frame. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2468 f = NULL; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2469 face = Qnil; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2470 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2471 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2472 /* Determine the width standard for comparison with the fonts we find. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2473 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2474 if (NILP (face)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2475 size = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2476 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2477 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2478 /* This is of limited utility since it works with character |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2479 widths. Keep it for compatibility. --gerd. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2480 int face_id = lookup_named_face (f, face, CHARSET_ASCII); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2481 struct face *face = FACE_FROM_ID (f, face_id); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2482 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2483 if (face->font) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2484 size = FONT_MAX_WIDTH (face->font); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2485 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2486 size = FONT_MAX_WIDTH (FRAME_FONT (f)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2487 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2488 if (!NILP (width)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2489 size *= XINT (width); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2490 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2491 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2492 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2493 Lisp_Object args[2]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2494 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2495 args[0] = w32_list_fonts (f, pattern, size, maxnames); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2496 if (f == NULL) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2497 /* We don't have to check fontsets. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2498 return args[0]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2499 args[1] = list_fontsets (f, pattern, size); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2500 return Fnconc (2, args); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2501 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2502 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2503 |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
2504 #endif /* HAVE_WINDOW_SYSTEM */ |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
2505 |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2506 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2507 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2508 /*********************************************************************** |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2509 Lisp Faces |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2510 ***********************************************************************/ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2511 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2512 /* Access face attributes of face FACE, a Lisp vector. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2513 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2514 #define LFACE_FAMILY(LFACE) \ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2515 XVECTOR (LFACE)->contents[LFACE_FAMILY_INDEX] |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2516 #define LFACE_HEIGHT(LFACE) \ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2517 XVECTOR (LFACE)->contents[LFACE_HEIGHT_INDEX] |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2518 #define LFACE_WEIGHT(LFACE) \ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2519 XVECTOR (LFACE)->contents[LFACE_WEIGHT_INDEX] |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2520 #define LFACE_SLANT(LFACE) \ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2521 XVECTOR (LFACE)->contents[LFACE_SLANT_INDEX] |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2522 #define LFACE_UNDERLINE(LFACE) \ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2523 XVECTOR (LFACE)->contents[LFACE_UNDERLINE_INDEX] |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2524 #define LFACE_INVERSE(LFACE) \ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2525 XVECTOR (LFACE)->contents[LFACE_INVERSE_INDEX] |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2526 #define LFACE_FOREGROUND(LFACE) \ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2527 XVECTOR (LFACE)->contents[LFACE_FOREGROUND_INDEX] |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2528 #define LFACE_BACKGROUND(LFACE) \ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2529 XVECTOR (LFACE)->contents[LFACE_BACKGROUND_INDEX] |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2530 #define LFACE_STIPPLE(LFACE) \ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2531 XVECTOR (LFACE)->contents[LFACE_STIPPLE_INDEX] |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2532 #define LFACE_SWIDTH(LFACE) \ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2533 XVECTOR (LFACE)->contents[LFACE_SWIDTH_INDEX] |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2534 #define LFACE_OVERLINE(LFACE) \ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2535 XVECTOR (LFACE)->contents[LFACE_OVERLINE_INDEX] |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2536 #define LFACE_STRIKE_THROUGH(LFACE) \ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2537 XVECTOR (LFACE)->contents[LFACE_STRIKE_THROUGH_INDEX] |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2538 #define LFACE_BOX(LFACE) \ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2539 XVECTOR (LFACE)->contents[LFACE_BOX_INDEX] |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2540 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2541 /* Non-zero if LFACE is a Lisp face. A Lisp face is a vector of size |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2542 LFACE_VECTOR_SIZE which has the symbol `face' in slot 0. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2543 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2544 #define LFACEP(LFACE) \ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2545 (VECTORP (LFACE) \ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2546 && XVECTOR (LFACE)->size == LFACE_VECTOR_SIZE \ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2547 && EQ (XVECTOR (LFACE)->contents[0], Qface)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2548 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2549 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2550 #if GLYPH_DEBUG |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2551 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2552 /* Check consistency of Lisp face attribute vector ATTRS. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2553 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2554 static void |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2555 check_lface_attrs (attrs) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2556 Lisp_Object *attrs; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2557 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2558 xassert (UNSPECIFIEDP (attrs[LFACE_FAMILY_INDEX]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2559 || STRINGP (attrs[LFACE_FAMILY_INDEX])); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2560 xassert (UNSPECIFIEDP (attrs[LFACE_SWIDTH_INDEX]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2561 || SYMBOLP (attrs[LFACE_SWIDTH_INDEX])); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2562 xassert (UNSPECIFIEDP (attrs[LFACE_HEIGHT_INDEX]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2563 || INTEGERP (attrs[LFACE_HEIGHT_INDEX])); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2564 xassert (UNSPECIFIEDP (attrs[LFACE_WEIGHT_INDEX]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2565 || SYMBOLP (attrs[LFACE_WEIGHT_INDEX])); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2566 xassert (UNSPECIFIEDP (attrs[LFACE_SLANT_INDEX]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2567 || SYMBOLP (attrs[LFACE_SLANT_INDEX])); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2568 xassert (UNSPECIFIEDP (attrs[LFACE_UNDERLINE_INDEX]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2569 || SYMBOLP (attrs[LFACE_UNDERLINE_INDEX]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2570 || STRINGP (attrs[LFACE_UNDERLINE_INDEX])); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2571 xassert (UNSPECIFIEDP (attrs[LFACE_OVERLINE_INDEX]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2572 || SYMBOLP (attrs[LFACE_OVERLINE_INDEX]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2573 || STRINGP (attrs[LFACE_OVERLINE_INDEX])); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2574 xassert (UNSPECIFIEDP (attrs[LFACE_STRIKE_THROUGH_INDEX]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2575 || SYMBOLP (attrs[LFACE_STRIKE_THROUGH_INDEX]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2576 || STRINGP (attrs[LFACE_STRIKE_THROUGH_INDEX])); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2577 xassert (UNSPECIFIEDP (attrs[LFACE_BOX_INDEX]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2578 || SYMBOLP (attrs[LFACE_BOX_INDEX]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2579 || STRINGP (attrs[LFACE_BOX_INDEX]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2580 || INTEGERP (attrs[LFACE_BOX_INDEX]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2581 || CONSP (attrs[LFACE_BOX_INDEX])); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2582 xassert (UNSPECIFIEDP (attrs[LFACE_INVERSE_INDEX]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2583 || SYMBOLP (attrs[LFACE_INVERSE_INDEX])); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2584 xassert (UNSPECIFIEDP (attrs[LFACE_FOREGROUND_INDEX]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2585 || STRINGP (attrs[LFACE_FOREGROUND_INDEX])); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2586 xassert (UNSPECIFIEDP (attrs[LFACE_BACKGROUND_INDEX]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2587 || STRINGP (attrs[LFACE_BACKGROUND_INDEX])); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2588 #ifdef HAVE_WINDOW_SYSTEM |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2589 xassert (UNSPECIFIEDP (attrs[LFACE_STIPPLE_INDEX]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2590 || SYMBOLP (attrs[LFACE_STIPPLE_INDEX]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2591 || !NILP (Fbitmap_spec_p (attrs[LFACE_STIPPLE_INDEX]))); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2592 #endif |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2593 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2594 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2595 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2596 /* Check consistency of attributes of Lisp face LFACE (a Lisp vector). */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2597 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2598 static void |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2599 check_lface (lface) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2600 Lisp_Object lface; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2601 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2602 if (!NILP (lface)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2603 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2604 xassert (LFACEP (lface)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2605 check_lface_attrs (XVECTOR (lface)->contents); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2606 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2607 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2608 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2609 #else /* GLYPH_DEBUG == 0 */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2610 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2611 #define check_lface_attrs(attrs) (void) 0 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2612 #define check_lface(lface) (void) 0 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2613 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2614 #endif /* GLYPH_DEBUG == 0 */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2615 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2616 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2617 /* Resolve face name FACE_NAME. If FACE_NAME Is a string, intern it |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2618 to make it a symvol. If FACE_NAME is an alias for another face, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2619 return that face's name. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2620 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2621 static Lisp_Object |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2622 resolve_face_name (face_name) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2623 Lisp_Object face_name; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2624 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2625 Lisp_Object aliased; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2626 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2627 if (STRINGP (face_name)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2628 face_name = intern (XSTRING (face_name)->data); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2629 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2630 for (;;) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2631 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2632 aliased = Fget (face_name, Qface_alias); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2633 if (NILP (aliased)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2634 break; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2635 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2636 face_name = aliased; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2637 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2638 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2639 return face_name; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2640 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2641 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2642 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2643 /* Return the face definition of FACE_NAME on frame F. F null means |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2644 return the global definition. FACE_NAME may be a string or a |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2645 symbol (apparently Emacs 20.2 allows strings as face names in face |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2646 text properties; ediff uses that). If FACE_NAME is an alias for |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2647 another face, return that face's definition. If SIGNAL_P is |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2648 non-zero, signal an error if FACE_NAME is not a valid face name. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2649 If SIGNAL_P is zero, value is nil if FACE_NAME is not a valid face |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2650 name. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2651 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2652 static INLINE Lisp_Object |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2653 lface_from_face_name (f, face_name, signal_p) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2654 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2655 Lisp_Object face_name; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2656 int signal_p; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2657 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2658 Lisp_Object lface; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2659 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2660 face_name = resolve_face_name (face_name); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2661 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2662 if (f) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2663 lface = assq_no_quit (face_name, f->face_alist); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2664 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2665 lface = assq_no_quit (face_name, Vface_new_frame_defaults); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2666 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2667 if (CONSP (lface)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2668 lface = XCDR (lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2669 else if (signal_p) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2670 signal_error ("Invalid face", face_name); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2671 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2672 check_lface (lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2673 return lface; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2674 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2675 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2676 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2677 /* Get face attributes of face FACE_NAME from frame-local faces on |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2678 frame F. Store the resulting attributes in ATTRS which must point |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2679 to a vector of Lisp_Objects of size LFACE_VECTOR_SIZE. If SIGNAL_P |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2680 is non-zero, signal an error if FACE_NAME does not name a face. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2681 Otherwise, value is zero if FACE_NAME is not a face. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2682 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2683 static INLINE int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2684 get_lface_attributes (f, face_name, attrs, signal_p) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2685 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2686 Lisp_Object face_name; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2687 Lisp_Object *attrs; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2688 int signal_p; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2689 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2690 Lisp_Object lface; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2691 int success_p; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2692 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2693 lface = lface_from_face_name (f, face_name, signal_p); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2694 if (!NILP (lface)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2695 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2696 bcopy (XVECTOR (lface)->contents, attrs, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2697 LFACE_VECTOR_SIZE * sizeof *attrs); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2698 success_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2699 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2700 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2701 success_p = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2702 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2703 return success_p; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2704 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2705 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2706 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2707 /* Non-zero if all attributes in face attribute vector ATTRS are |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2708 specified, i.e. are non-nil. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2709 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2710 static int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2711 lface_fully_specified_p (attrs) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2712 Lisp_Object *attrs; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2713 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2714 int i; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2715 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2716 for (i = 1; i < LFACE_VECTOR_SIZE; ++i) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2717 if (UNSPECIFIEDP (attrs[i])) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2718 break; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2719 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2720 return i == LFACE_VECTOR_SIZE; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2721 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2722 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2723 #ifdef HAVE_WINDOW_SYSTEM |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2724 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2725 /* Set font-related attributes of Lisp face LFACE from XLFD font name |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2726 FONT_NAME. If FORCE_P is zero, set only unspecified attributes of |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2727 LFACE. MAY_FAIL_P non-zero means return 0 if FONT_NAME isn't a |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2728 valid font name; otherwise this function tries to use a reasonable |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2729 default font. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2730 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2731 Ignore fields of FONT_NAME containing wildcards. Value is zero if |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2732 not successful because FONT_NAME was not in a valid format and |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2733 MAY_FAIL_P was non-zero. A valid format is one that is suitable |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2734 for split_font_name, see the comment there. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2735 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2736 static int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2737 set_lface_from_font_name (f, lface, font_name, force_p, may_fail_p) |
13434 | 2738 struct frame *f; |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2739 Lisp_Object lface; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2740 char *font_name; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2741 int force_p, may_fail_p; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2742 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2743 struct font_name font; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2744 char *buffer; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2745 int pt; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2746 int free_font_name_p = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2747 int have_font_p = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2748 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2749 /* If FONT_NAME contains wildcards, use the first matching font. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2750 if (index (font_name, '*') || index (font_name, '?')) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2751 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2752 if (first_font_matching (f, font_name, &font)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2753 free_font_name_p = have_font_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2754 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2755 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2756 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2757 font.name = STRDUPA (font_name); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2758 if (split_font_name (f, &font, 1)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2759 have_font_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2760 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2761 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2762 /* The font name may be something like `6x13'. Make |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2763 sure we use the full name. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2764 struct font_info *font_info; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2765 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2766 BLOCK_INPUT; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2767 font_info = fs_load_font (f, FRAME_W32_FONT_TABLE (f), |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2768 CHARSET_ASCII, font_name, -1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2769 if (font_info) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2770 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2771 font.name = STRDUPA (font_info->full_name); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2772 split_font_name (f, &font, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2773 have_font_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2774 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2775 UNBLOCK_INPUT; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2776 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2777 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2778 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2779 /* If FONT_NAME is completely bogus try to use something reasonable |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2780 if this function must succeed. Otherwise, give up. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2781 if (!have_font_p) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2782 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2783 if (may_fail_p) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2784 return 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2785 else if (first_font_matching (f, "-*-Courier New-normal-r-*-*-13-*-*-*-c-*-iso8859-1", |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2786 &font) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2787 || first_font_matching (f, "-*-Courier-normal-r-*-*-13-*-*-*-c-*-iso8859-1", |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2788 &font) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2789 || first_font_matching (f, "-*-FixedSys-normal-r-*-*-12-*-*-*-c-*-iso8859-1", |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2790 &font) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2791 || first_font_matching (f, "-*-*-normal-r-*-*-*-*-*-*-c-*-iso8859-1", |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2792 &font) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2793 || first_font_matching (f, "FixedSys", |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2794 &font)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2795 free_font_name_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2796 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2797 abort (); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2798 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2799 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2800 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2801 /* Set attributes only if unspecified, otherwise face defaults for |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2802 new frames would never take effect. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2803 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2804 if (force_p || UNSPECIFIEDP (LFACE_FAMILY (lface))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2805 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2806 buffer = (char *) alloca (strlen (font.fields[XLFD_FAMILY]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2807 + strlen (font.fields[XLFD_FOUNDRY]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2808 + 2); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2809 sprintf (buffer, "%s-%s", font.fields[XLFD_FOUNDRY], |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2810 font.fields[XLFD_FAMILY]); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2811 LFACE_FAMILY (lface) = build_string (buffer); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2812 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2813 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2814 if (force_p || UNSPECIFIEDP (LFACE_HEIGHT (lface))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2815 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2816 pt = xlfd_point_size (f, &font); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2817 xassert (pt > 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2818 LFACE_HEIGHT (lface) = make_number (pt); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2819 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2820 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2821 if (force_p || UNSPECIFIEDP (LFACE_SWIDTH (lface))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2822 LFACE_SWIDTH (lface) = xlfd_symbolic_swidth (&font); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2823 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2824 if (force_p || UNSPECIFIEDP (LFACE_WEIGHT (lface))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2825 LFACE_WEIGHT (lface) = xlfd_symbolic_weight (&font); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2826 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2827 if (force_p || UNSPECIFIEDP (LFACE_SLANT (lface))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2828 LFACE_SLANT (lface) = xlfd_symbolic_slant (&font); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2829 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2830 if (free_font_name_p) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2831 xfree (font.name); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2832 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2833 return 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2834 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2835 #endif /* HAVE_WINDOW_SYSTEM */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2836 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2837 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2838 /* Merge two Lisp face attribute vectors FROM and TO and store the |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2839 resulting attributes in TO. Every non-nil attribute of FROM |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2840 overrides the corresponding attribute of TO. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2841 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2842 static INLINE void |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2843 merge_face_vectors (from, to) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2844 Lisp_Object *from, *to; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2845 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2846 int i; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2847 for (i = 1; i < LFACE_VECTOR_SIZE; ++i) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2848 if (!UNSPECIFIEDP (from[i])) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2849 to[i] = from[i]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2850 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2851 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2852 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2853 /* Given a Lisp face attribute vector TO and a Lisp object PROP that |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2854 is a face property, determine the resulting face attributes on |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2855 frame F, and store them in TO. PROP may be a single face |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2856 specification or a list of such specifications. Each face |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2857 specification can be |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2858 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2859 1. A symbol or string naming a Lisp face. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2860 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2861 2. A property list of the form (KEYWORD VALUE ...) where each |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2862 KEYWORD is a face attribute name, and value is an appropriate value |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2863 for that attribute. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2864 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2865 3. Conses or the form (FOREGROUND-COLOR . COLOR) or |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2866 (BACKGROUND-COLOR . COLOR) where COLOR is a color name. This is |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2867 for compatibility with 20.2. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2868 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2869 Face specifications earlier in lists take precedence over later |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2870 specifications. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2871 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2872 static void |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2873 merge_face_vector_with_property (f, to, prop) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2874 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2875 Lisp_Object *to; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2876 Lisp_Object prop; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2877 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2878 if (CONSP (prop)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2879 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2880 Lisp_Object first = XCAR (prop); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2881 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2882 if (EQ (first, Qforeground_color) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2883 || EQ (first, Qbackground_color)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2884 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2885 /* One of (FOREGROUND-COLOR . COLOR) or (BACKGROUND-COLOR |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2886 . COLOR). COLOR must be a string. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2887 Lisp_Object color_name = XCDR (prop); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2888 Lisp_Object color = first; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2889 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2890 if (STRINGP (color_name)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2891 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2892 if (EQ (color, Qforeground_color)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2893 to[LFACE_FOREGROUND_INDEX] = color_name; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2894 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2895 to[LFACE_BACKGROUND_INDEX] = color_name; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2896 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2897 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2898 add_to_log ("Invalid face color", color_name, Qnil); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2899 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2900 else if (SYMBOLP (first) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2901 && *XSYMBOL (first)->name->data == ':') |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2902 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2903 /* Assume this is the property list form. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2904 while (CONSP (prop) && CONSP (XCDR (prop))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2905 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2906 Lisp_Object keyword = XCAR (prop); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2907 Lisp_Object value = XCAR (XCDR (prop)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2908 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2909 if (EQ (keyword, QCfamily)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2910 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2911 if (STRINGP (value)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2912 to[LFACE_FAMILY_INDEX] = value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2913 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2914 add_to_log ("Illegal face font family", value, Qnil); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2915 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2916 else if (EQ (keyword, QCheight)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2917 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2918 if (INTEGERP (value)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2919 to[LFACE_HEIGHT_INDEX] = value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2920 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2921 add_to_log ("Illegal face font height", value, Qnil); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2922 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2923 else if (EQ (keyword, QCweight)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2924 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2925 if (SYMBOLP (value) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2926 && face_numeric_weight (value) >= 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2927 to[LFACE_WEIGHT_INDEX] = value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2928 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2929 add_to_log ("Illegal face weight", value, Qnil); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2930 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2931 else if (EQ (keyword, QCslant)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2932 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2933 if (SYMBOLP (value) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2934 && face_numeric_slant (value) >= 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2935 to[LFACE_SLANT_INDEX] = value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2936 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2937 add_to_log ("Illegal face slant", value, Qnil); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2938 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2939 else if (EQ (keyword, QCunderline)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2940 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2941 if (EQ (value, Qt) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2942 || NILP (value) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2943 || STRINGP (value)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2944 to[LFACE_UNDERLINE_INDEX] = value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2945 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2946 add_to_log ("Illegal face underline", value, Qnil); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2947 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2948 else if (EQ (keyword, QCoverline)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2949 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2950 if (EQ (value, Qt) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2951 || NILP (value) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2952 || STRINGP (value)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2953 to[LFACE_OVERLINE_INDEX] = value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2954 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2955 add_to_log ("Illegal face overline", value, Qnil); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2956 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2957 else if (EQ (keyword, QCstrike_through)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2958 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2959 if (EQ (value, Qt) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2960 || NILP (value) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2961 || STRINGP (value)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2962 to[LFACE_STRIKE_THROUGH_INDEX] = value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2963 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2964 add_to_log ("Illegal face strike-through", value, Qnil); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2965 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2966 else if (EQ (keyword, QCbox)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2967 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2968 if (EQ (value, Qt)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2969 value = make_number (1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2970 if (INTEGERP (value) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2971 || STRINGP (value) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2972 || CONSP (value) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2973 || NILP (value)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2974 to[LFACE_BOX_INDEX] = value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2975 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2976 add_to_log ("Illegal face box", value, Qnil); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2977 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2978 else if (EQ (keyword, QCinverse_video) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2979 || EQ (keyword, QCreverse_video)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2980 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2981 if (EQ (value, Qt) || NILP (value)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2982 to[LFACE_INVERSE_INDEX] = value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2983 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2984 add_to_log ("Illegal face inverse-video", value, Qnil); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2985 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2986 else if (EQ (keyword, QCforeground)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2987 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2988 if (STRINGP (value)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2989 to[LFACE_FOREGROUND_INDEX] = value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2990 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2991 add_to_log ("Illegal face foreground", value, Qnil); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2992 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2993 else if (EQ (keyword, QCbackground)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2994 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2995 if (STRINGP (value)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2996 to[LFACE_BACKGROUND_INDEX] = value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2997 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2998 add_to_log ("Illegal face background", value, Qnil); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
2999 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3000 else if (EQ (keyword, QCstipple)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3001 { |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
3002 #ifdef HAVE_X_WINDOWS |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3003 Lisp_Object pixmap_p = Fbitmap_spec_p (value); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3004 if (!NILP (pixmap_p)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3005 to[LFACE_STIPPLE_INDEX] = value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3006 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3007 add_to_log ("Illegal face stipple", value, Qnil); |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
3008 #endif |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3009 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3010 else if (EQ (keyword, QCwidth)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3011 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3012 if (SYMBOLP (value) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3013 && face_numeric_swidth (value) >= 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3014 to[LFACE_SWIDTH_INDEX] = value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3015 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3016 add_to_log ("Illegal face width", value, Qnil); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3017 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3018 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3019 add_to_log ("Invalid attribute %s in face property", |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3020 keyword, Qnil); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3021 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3022 prop = XCDR (XCDR (prop)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3023 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3024 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3025 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3026 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3027 /* This is a list of face specs. Specifications at the |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3028 beginning of the list take precedence over later |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3029 specifications, so we have to merge starting with the |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3030 last specification. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3031 Lisp_Object next = XCDR (prop); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3032 if (!NILP (next)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3033 merge_face_vector_with_property (f, to, next); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3034 merge_face_vector_with_property (f, to, first); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3035 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3036 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3037 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3038 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3039 /* PROP ought to be a face name. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3040 Lisp_Object lface = lface_from_face_name (f, prop, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3041 if (NILP (lface)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3042 add_to_log ("Invalid face text property value: %s", prop, Qnil); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3043 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3044 merge_face_vectors (XVECTOR (lface)->contents, to); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3045 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3046 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3047 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3048 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3049 DEFUN ("internal-make-lisp-face", Finternal_make_lisp_face, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3050 Sinternal_make_lisp_face, 1, 2, 0, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3051 "Make FACE, a symbol, a Lisp face with all attributes nil.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3052 If FACE was not known as a face before, create a new one.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3053 If optional argument FRAME is specified, make a frame-local face\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3054 for that frame. Otherwise operate on the global face definition.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3055 Value is a vector of face attributes.") |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3056 (face, frame) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3057 Lisp_Object face, frame; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3058 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3059 Lisp_Object global_lface, lface; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3060 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3061 int i; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3062 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3063 CHECK_SYMBOL (face, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3064 global_lface = lface_from_face_name (NULL, face, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3065 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3066 if (!NILP (frame)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3067 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3068 CHECK_LIVE_FRAME (frame, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3069 f = XFRAME (frame); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3070 lface = lface_from_face_name (f, face, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3071 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3072 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3073 f = NULL, lface = Qnil; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3074 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3075 /* Add a global definition if there is none. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3076 if (NILP (global_lface)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3077 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3078 global_lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE), |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3079 Qunspecified); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3080 XVECTOR (global_lface)->contents[0] = Qface; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3081 Vface_new_frame_defaults = Fcons (Fcons (face, global_lface), |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3082 Vface_new_frame_defaults); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3083 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3084 /* Assign the new Lisp face a unique ID. The mapping from Lisp |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3085 face id to Lisp face is given by the vector lface_id_to_name. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3086 The mapping from Lisp face to Lisp face id is given by the |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3087 property `face' of the Lisp face name. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3088 if (next_lface_id == lface_id_to_name_size) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3089 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3090 int new_size = max (50, 2 * lface_id_to_name_size); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3091 int sz = new_size * sizeof *lface_id_to_name; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3092 lface_id_to_name = (Lisp_Object *) xrealloc (lface_id_to_name, sz); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3093 lface_id_to_name_size = new_size; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3094 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3095 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3096 lface_id_to_name[next_lface_id] = face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3097 Fput (face, Qface, make_number (next_lface_id)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3098 ++next_lface_id; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3099 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3100 else if (f == NULL) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3101 for (i = 1; i < LFACE_VECTOR_SIZE; ++i) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3102 XVECTOR (global_lface)->contents[i] = Qunspecified; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3103 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3104 /* Add a frame-local definition. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3105 if (f) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3106 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3107 if (NILP (lface)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3108 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3109 lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE), |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3110 Qunspecified); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3111 XVECTOR (lface)->contents[0] = Qface; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3112 f->face_alist = Fcons (Fcons (face, lface), f->face_alist); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3113 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3114 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3115 for (i = 1; i < LFACE_VECTOR_SIZE; ++i) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3116 XVECTOR (lface)->contents[i] = Qunspecified; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3117 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3118 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3119 lface = global_lface; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3120 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3121 xassert (LFACEP (lface)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3122 check_lface (lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3123 return lface; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3124 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3125 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3126 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3127 DEFUN ("internal-lisp-face-p", Finternal_lisp_face_p, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3128 Sinternal_lisp_face_p, 1, 2, 0, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3129 "Return non-nil if FACE names a face.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3130 If optional second parameter FRAME is non-nil, check for the\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3131 existence of a frame-local face with name FACE on that frame.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3132 Otherwise check for the existence of a global face.") |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3133 (face, frame) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3134 Lisp_Object face, frame; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3135 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3136 Lisp_Object lface; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3137 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3138 if (!NILP (frame)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3139 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3140 CHECK_LIVE_FRAME (frame, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3141 lface = lface_from_face_name (XFRAME (frame), face, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3142 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3143 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3144 lface = lface_from_face_name (NULL, face, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3145 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3146 return lface; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3147 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3148 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3149 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3150 DEFUN ("internal-copy-lisp-face", Finternal_copy_lisp_face, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3151 Sinternal_copy_lisp_face, 4, 4, 0, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3152 "Copy face FROM to TO.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3153 If FRAME it t, copy the global face definition of FROM to the\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3154 global face definition of TO. Otherwise, copy the frame-local\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3155 definition of FROM on FRAME to the frame-local definition of TO\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3156 on NEW-FRAME, or FRAME if NEW-FRAME is nil.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3157 \n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3158 Value is TO.") |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3159 (from, to, frame, new_frame) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3160 Lisp_Object from, to, frame, new_frame; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3161 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3162 Lisp_Object lface, copy; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3163 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3164 CHECK_SYMBOL (from, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3165 CHECK_SYMBOL (to, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3166 if (NILP (new_frame)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3167 new_frame = frame; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3168 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3169 if (EQ (frame, Qt)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3170 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3171 /* Copy global definition of FROM. We don't make copies of |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3172 strings etc. because 20.2 didn't do it either. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3173 lface = lface_from_face_name (NULL, from, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3174 copy = Finternal_make_lisp_face (to, Qnil); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3175 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3176 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3177 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3178 /* Copy frame-local definition of FROM. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3179 CHECK_LIVE_FRAME (frame, 2); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3180 CHECK_LIVE_FRAME (new_frame, 3); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3181 lface = lface_from_face_name (XFRAME (frame), from, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3182 copy = Finternal_make_lisp_face (to, new_frame); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3183 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3184 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3185 bcopy (XVECTOR (lface)->contents, XVECTOR (copy)->contents, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3186 LFACE_VECTOR_SIZE * sizeof (Lisp_Object)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3187 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3188 return to; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3189 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3190 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3191 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3192 DEFUN ("internal-set-lisp-face-attribute", Finternal_set_lisp_face_attribute, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3193 Sinternal_set_lisp_face_attribute, 3, 4, 0, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3194 "Set attribute ATTR of FACE to VALUE.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3195 If optional argument FRAME is given, set the face attribute of face FACE\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3196 on that frame. If FRAME is t, set the attribute of the default for face\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3197 FACE (for new frames). If FRAME is omitted or nil, use the selected\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3198 frame.") |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3199 (face, attr, value, frame) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3200 Lisp_Object face, attr, value, frame; |
13434 | 3201 { |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3202 Lisp_Object lface; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3203 Lisp_Object old_value = Qnil; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3204 int font_related_attr_p = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3205 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3206 CHECK_SYMBOL (face, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3207 CHECK_SYMBOL (attr, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3208 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3209 face = resolve_face_name (face); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3210 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3211 /* Set lface to the Lisp attribute vector of FACE. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3212 if (EQ (frame, Qt)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3213 lface = lface_from_face_name (NULL, face, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3214 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3215 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3216 if (NILP (frame)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3217 frame = selected_frame; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3218 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3219 CHECK_LIVE_FRAME (frame, 3); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3220 lface = lface_from_face_name (XFRAME (frame), face, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3221 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3222 /* If a frame-local face doesn't exist yet, create one. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3223 if (NILP (lface)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3224 lface = Finternal_make_lisp_face (face, frame); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3225 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3226 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3227 if (EQ (attr, QCfamily)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3228 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3229 if (!UNSPECIFIEDP (value)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3230 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3231 CHECK_STRING (value, 3); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3232 if (XSTRING (value)->size == 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3233 signal_error ("Invalid face family", value); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3234 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3235 old_value = LFACE_FAMILY (lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3236 LFACE_FAMILY (lface) = value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3237 font_related_attr_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3238 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3239 else if (EQ (attr, QCheight)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3240 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3241 if (!UNSPECIFIEDP (value)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3242 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3243 CHECK_NUMBER (value, 3); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3244 if (XINT (value) <= 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3245 signal_error ("Invalid face height", value); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3246 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3247 old_value = LFACE_HEIGHT (lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3248 LFACE_HEIGHT (lface) = value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3249 font_related_attr_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3250 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3251 else if (EQ (attr, QCweight)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3252 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3253 if (!UNSPECIFIEDP (value)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3254 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3255 CHECK_SYMBOL (value, 3); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3256 if (face_numeric_weight (value) < 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3257 signal_error ("Invalid face weight", value); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3258 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3259 old_value = LFACE_WEIGHT (lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3260 LFACE_WEIGHT (lface) = value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3261 font_related_attr_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3262 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3263 else if (EQ (attr, QCslant)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3264 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3265 if (!UNSPECIFIEDP (value)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3266 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3267 CHECK_SYMBOL (value, 3); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3268 if (face_numeric_slant (value) < 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3269 signal_error ("Invalid face slant", value); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3270 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3271 old_value = LFACE_SLANT (lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3272 LFACE_SLANT (lface) = value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3273 font_related_attr_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3274 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3275 else if (EQ (attr, QCunderline)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3276 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3277 if (!UNSPECIFIEDP (value)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3278 if ((SYMBOLP (value) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3279 && !EQ (value, Qt) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3280 && !EQ (value, Qnil)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3281 /* Underline color. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3282 || (STRINGP (value) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3283 && XSTRING (value)->size == 0)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3284 signal_error ("Invalid face underline", value); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3285 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3286 old_value = LFACE_UNDERLINE (lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3287 LFACE_UNDERLINE (lface) = value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3288 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3289 else if (EQ (attr, QCoverline)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3290 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3291 if (!UNSPECIFIEDP (value)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3292 if ((SYMBOLP (value) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3293 && !EQ (value, Qt) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3294 && !EQ (value, Qnil)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3295 /* Overline color. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3296 || (STRINGP (value) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3297 && XSTRING (value)->size == 0)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3298 signal_error ("Invalid face overline", value); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3299 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3300 old_value = LFACE_OVERLINE (lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3301 LFACE_OVERLINE (lface) = value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3302 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3303 else if (EQ (attr, QCstrike_through)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3304 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3305 if (!UNSPECIFIEDP (value)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3306 if ((SYMBOLP (value) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3307 && !EQ (value, Qt) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3308 && !EQ (value, Qnil)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3309 /* Strike-through color. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3310 || (STRINGP (value) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3311 && XSTRING (value)->size == 0)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3312 signal_error ("Invalid face strike-through", value); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3313 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3314 old_value = LFACE_STRIKE_THROUGH (lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3315 LFACE_STRIKE_THROUGH (lface) = value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3316 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3317 else if (EQ (attr, QCbox)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3318 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3319 int valid_p; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3320 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3321 /* Allow t meaning a simple box of width 1 in foreground color |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3322 of the face. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3323 if (EQ (value, Qt)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3324 value = make_number (1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3325 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3326 if (UNSPECIFIEDP (value)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3327 valid_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3328 else if (NILP (value)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3329 valid_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3330 else if (INTEGERP (value)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3331 valid_p = XINT (value) > 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3332 else if (STRINGP (value)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3333 valid_p = XSTRING (value)->size > 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3334 else if (CONSP (value)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3335 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3336 Lisp_Object tem; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3337 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3338 tem = value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3339 while (CONSP (tem)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3340 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3341 Lisp_Object k, v; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3342 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3343 k = XCAR (tem); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3344 tem = XCDR (tem); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3345 if (!CONSP (tem)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3346 break; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3347 v = XCAR (tem); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3348 tem = XCDR (tem); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3349 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3350 if (EQ (k, QCline_width)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3351 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3352 if (!INTEGERP (v) || XINT (v) <= 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3353 break; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3354 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3355 else if (EQ (k, QCcolor)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3356 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3357 if (!STRINGP (v) || XSTRING (v)->size == 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3358 break; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3359 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3360 else if (EQ (k, QCstyle)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3361 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3362 if (!EQ (v, Qpressed_button) && !EQ (v, Qreleased_button)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3363 break; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3364 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3365 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3366 break; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3367 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3368 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3369 valid_p = NILP (tem); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3370 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3371 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3372 valid_p = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3373 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3374 if (!valid_p) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3375 signal_error ("Invalid face box", value); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3376 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3377 old_value = LFACE_BOX (lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3378 LFACE_BOX (lface) = value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3379 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3380 else if (EQ (attr, QCinverse_video) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3381 || EQ (attr, QCreverse_video)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3382 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3383 if (!UNSPECIFIEDP (value)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3384 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3385 CHECK_SYMBOL (value, 3); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3386 if (!EQ (value, Qt) && !NILP (value)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3387 signal_error ("Invalid inverse-video face attribute value", value); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3388 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3389 old_value = LFACE_INVERSE (lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3390 LFACE_INVERSE (lface) = value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3391 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3392 else if (EQ (attr, QCforeground)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3393 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3394 if (!UNSPECIFIEDP (value)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3395 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3396 /* Don't check for valid color names here because it depends |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3397 on the frame (display) whether the color will be valid |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3398 when the face is realized. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3399 CHECK_STRING (value, 3); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3400 if (XSTRING (value)->size == 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3401 signal_error ("Empty foreground color value", value); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3402 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3403 old_value = LFACE_FOREGROUND (lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3404 LFACE_FOREGROUND (lface) = value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3405 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3406 else if (EQ (attr, QCbackground)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3407 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3408 if (!UNSPECIFIEDP (value)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3409 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3410 /* Don't check for valid color names here because it depends |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3411 on the frame (display) whether the color will be valid |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3412 when the face is realized. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3413 CHECK_STRING (value, 3); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3414 if (XSTRING (value)->size == 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3415 signal_error ("Empty background color value", value); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3416 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3417 old_value = LFACE_BACKGROUND (lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3418 LFACE_BACKGROUND (lface) = value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3419 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3420 else if (EQ (attr, QCstipple)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3421 { |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
3422 #ifdef HAVE_X_WINDOWS |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3423 if (!UNSPECIFIEDP (value) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3424 && !NILP (value) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3425 && NILP (Fbitmap_spec_p (value))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3426 signal_error ("Invalid stipple attribute", value); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3427 old_value = LFACE_STIPPLE (lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3428 LFACE_STIPPLE (lface) = value; |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
3429 #endif /* HAVE_X_WINDOWS */ |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3430 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3431 else if (EQ (attr, QCwidth)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3432 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3433 if (!UNSPECIFIEDP (value)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3434 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3435 CHECK_SYMBOL (value, 3); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3436 if (face_numeric_swidth (value) < 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3437 signal_error ("Invalid face width", value); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3438 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3439 old_value = LFACE_SWIDTH (lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3440 LFACE_SWIDTH (lface) = value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3441 font_related_attr_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3442 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3443 else if (EQ (attr, QCfont)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3444 { |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
3445 #ifdef HAVE_WINDOW_SYSTEM |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3446 /* Set font-related attributes of the Lisp face from an |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3447 XLFD font name. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3448 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3449 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3450 CHECK_STRING (value, 3); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3451 if (EQ (frame, Qt)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3452 f = SELECTED_FRAME (); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3453 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3454 f = check_x_frame (frame); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3455 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3456 if (!set_lface_from_font_name (f, lface, XSTRING (value)->data, 1, 1)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3457 signal_error ("Invalid font name", value); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3458 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3459 font_related_attr_p = 1; |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
3460 #endif /* HAVE_WINDOW_SYSTEM */ |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3461 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3462 else if (EQ (attr, QCbold)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3463 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3464 old_value = LFACE_WEIGHT (lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3465 LFACE_WEIGHT (lface) = NILP (value) ? Qnormal : Qbold; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3466 font_related_attr_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3467 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3468 else if (EQ (attr, QCitalic)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3469 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3470 old_value = LFACE_SLANT (lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3471 LFACE_SLANT (lface) = NILP (value) ? Qnormal : Qitalic; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3472 font_related_attr_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3473 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3474 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3475 signal_error ("Invalid face attribute name", attr); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3476 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3477 /* Changing a named face means that all realized faces depending on |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3478 that face are invalid. Since we cannot tell which realized faces |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3479 depend on the face, make sure they are all removed. This is done |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3480 by incrementing face_change_count. The next call to |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3481 init_iterator will then free realized faces. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3482 if (!EQ (frame, Qt) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3483 && (EQ (attr, QCfont) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3484 || NILP (Fequal (old_value, value)))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3485 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3486 ++face_change_count; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3487 ++windows_or_buffers_changed; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3488 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3489 |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
3490 #ifdef HAVE_WINDOW_SYSTEM |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3491 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3492 if (!EQ (frame, Qt) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3493 && !UNSPECIFIEDP (value) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3494 && NILP (Fequal (old_value, value))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3495 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3496 Lisp_Object param; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3497 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3498 param = Qnil; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3499 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3500 if (EQ (face, Qdefault)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3501 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3502 /* Changed font-related attributes of the `default' face are |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3503 reflected in changed `font' frame parameters. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3504 if (font_related_attr_p |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3505 && lface_fully_specified_p (XVECTOR (lface)->contents)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3506 set_font_frame_param (frame, lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3507 else if (EQ (attr, QCforeground)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3508 param = Qforeground_color; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3509 else if (EQ (attr, QCbackground)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3510 param = Qbackground_color; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3511 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3512 #if 0 /* NTEMACS_TODO : Scroll bar colors on W32? */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3513 else if (EQ (face, Qscroll_bar)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3514 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3515 /* Changing the colors of `scroll-bar' sets frame parameters |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3516 `scroll-bar-foreground' and `scroll-bar-background'. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3517 if (EQ (attr, QCforeground)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3518 param = Qscroll_bar_foreground; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3519 else if (EQ (attr, QCbackground)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3520 param = Qscroll_bar_background; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3521 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3522 #endif /* NTEMACS_TODO */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3523 else if (EQ (face, Qborder)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3524 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3525 /* Changing background color of `border' sets frame parameter |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3526 `border-color'. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3527 if (EQ (attr, QCbackground)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3528 param = Qborder_color; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3529 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3530 else if (EQ (face, Qcursor)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3531 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3532 /* Changing background color of `cursor' sets frame parameter |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3533 `cursor-color'. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3534 if (EQ (attr, QCbackground)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3535 param = Qcursor_color; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3536 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3537 else if (EQ (face, Qmouse)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3538 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3539 /* Changing background color of `mouse' sets frame parameter |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3540 `mouse-color'. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3541 if (EQ (attr, QCbackground)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3542 param = Qmouse_color; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3543 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3544 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3545 if (SYMBOLP (param)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3546 Fmodify_frame_parameters (frame, Fcons (Fcons (param, value), Qnil)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3547 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3548 |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
3549 #endif /* HAVE_WINDOW_SYSTEM */ |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3550 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3551 return face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3552 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3553 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3554 |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
3555 #ifdef HAVE_WINDOW_SYSTEM |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
3556 |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3557 /* Set the `font' frame parameter of FRAME according to `default' face |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3558 attributes LFACE. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3559 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3560 static void |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3561 set_font_frame_param (frame, lface) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3562 Lisp_Object frame, lface; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3563 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3564 struct frame *f = XFRAME (frame); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3565 Lisp_Object frame_font; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3566 int fontset; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3567 char *font; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3568 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3569 /* Get FRAME's font parameter. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3570 frame_font = Fassq (Qfont, f->param_alist); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3571 xassert (CONSP (frame_font) && STRINGP (XCDR (frame_font))); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3572 frame_font = XCDR (frame_font); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3573 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3574 fontset = fs_query_fontset (f, XSTRING (frame_font)->data); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3575 if (fontset >= 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3576 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3577 /* Frame parameter is a fontset name. Modify the fontset so |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3578 that all its fonts reflect face attributes LFACE. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3579 int charset; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3580 struct fontset_info *fontset_info; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3581 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3582 fontset_info = FRAME_FONTSET_DATA (f)->fontset_table[fontset]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3583 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3584 for (charset = 0; charset < MAX_CHARSET; ++charset) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3585 if (fontset_info->fontname[charset]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3586 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3587 font = choose_face_fontset_font (f, XVECTOR (lface)->contents, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3588 fontset, charset); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3589 Fset_fontset_font (frame_font, CHARSET_SYMBOL (charset), |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3590 build_string (font), frame); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3591 xfree (font); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3592 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3593 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3594 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3595 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3596 /* Frame parameter is an X font name. I believe this can |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3597 only happen in unibyte mode. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3598 font = choose_face_font (f, XVECTOR (lface)->contents, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3599 -1, Vface_default_registry); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3600 if (font) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3601 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3602 store_frame_param (f, Qfont, build_string (font)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3603 xfree (font); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3604 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3605 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3606 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3607 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3608 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3609 /* Update the corresponding face when frame parameter PARAM on frame F |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3610 has been assigned the value NEW_VALUE. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3611 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3612 void |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3613 update_face_from_frame_parameter (f, param, new_value) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3614 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3615 Lisp_Object param, new_value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3616 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3617 Lisp_Object lface; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3618 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3619 /* If there are no faces yet, give up. This is the case when called |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3620 from Fx_create_frame, and we do the necessary things later in |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3621 face-set-after-frame-defaults. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3622 if (NILP (f->face_alist)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3623 return; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3624 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3625 if (EQ (param, Qforeground_color)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3626 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3627 lface = lface_from_face_name (f, Qdefault, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3628 LFACE_FOREGROUND (lface) = (STRINGP (new_value) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3629 ? new_value : Qunspecified); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3630 realize_basic_faces (f); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3631 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3632 else if (EQ (param, Qbackground_color)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3633 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3634 Lisp_Object frame; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3635 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3636 /* Changing the background color might change the background |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3637 mode, so that we have to load new defface specs. Call |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3638 frame-update-face-colors to do that. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3639 XSETFRAME (frame, f); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3640 call1 (Qframe_update_face_colors, frame); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3641 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3642 lface = lface_from_face_name (f, Qdefault, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3643 LFACE_BACKGROUND (lface) = (STRINGP (new_value) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3644 ? new_value : Qunspecified); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3645 realize_basic_faces (f); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3646 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3647 if (EQ (param, Qborder_color)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3648 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3649 lface = lface_from_face_name (f, Qborder, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3650 LFACE_BACKGROUND (lface) = (STRINGP (new_value) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3651 ? new_value : Qunspecified); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3652 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3653 else if (EQ (param, Qcursor_color)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3654 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3655 lface = lface_from_face_name (f, Qcursor, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3656 LFACE_BACKGROUND (lface) = (STRINGP (new_value) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3657 ? new_value : Qunspecified); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3658 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3659 else if (EQ (param, Qmouse_color)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3660 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3661 lface = lface_from_face_name (f, Qmouse, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3662 LFACE_BACKGROUND (lface) = (STRINGP (new_value) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3663 ? new_value : Qunspecified); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3664 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3665 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3666 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3667 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3668 /* Get the value of X resource RESOURCE, class CLASS for the display |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3669 of frame FRAME. This is here because ordinary `x-get-resource' |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3670 doesn't take a frame argument. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3671 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3672 DEFUN ("internal-face-x-get-resource", Finternal_face_x_get_resource, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3673 Sinternal_face_x_get_resource, 3, 3, 0, "") |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3674 (resource, class, frame) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3675 Lisp_Object resource, class, frame; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3676 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3677 #if 0 /* NTEMACS_TODO : W32 resources */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3678 Lisp_Object value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3679 CHECK_STRING (resource, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3680 CHECK_STRING (class, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3681 CHECK_LIVE_FRAME (frame, 2); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3682 BLOCK_INPUT; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3683 value = display_x_get_resource (FRAME_W32_DISPLAY_INFO (XFRAME (frame)), |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3684 resource, class, Qnil, Qnil); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3685 UNBLOCK_INPUT; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3686 return value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3687 #endif /* NTEMACS_TODO */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3688 return Qnil; |
13434 | 3689 } |
3690 | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3691 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3692 /* Return resource string VALUE as a boolean value, i.e. nil, or t. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3693 If VALUE is "on" or "true", return t. If VALUE is "off" or |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3694 "false", return nil. Otherwise, if SIGNAL_P is non-zero, signal an |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3695 error; if SIGNAL_P is zero, return 0. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3696 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3697 static Lisp_Object |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3698 face_boolean_x_resource_value (value, signal_p) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3699 Lisp_Object value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3700 int signal_p; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3701 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3702 Lisp_Object result = make_number (0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3703 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3704 xassert (STRINGP (value)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3705 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3706 if (xstricmp (XSTRING (value)->data, "on") == 0 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3707 || xstricmp (XSTRING (value)->data, "true") == 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3708 result = Qt; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3709 else if (xstricmp (XSTRING (value)->data, "off") == 0 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3710 || xstricmp (XSTRING (value)->data, "false") == 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3711 result = Qnil; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3712 else if (xstricmp (XSTRING (value)->data, "unspecified") == 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3713 result = Qunspecified; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3714 else if (signal_p) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3715 signal_error ("Invalid face attribute value from X resource", value); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3716 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3717 return result; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3718 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3719 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3720 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3721 DEFUN ("internal-set-lisp-face-attribute-from-resource", |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3722 Finternal_set_lisp_face_attribute_from_resource, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3723 Sinternal_set_lisp_face_attribute_from_resource, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3724 3, 4, 0, "") |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3725 (face, attr, value, frame) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3726 Lisp_Object face, attr, value, frame; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3727 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3728 CHECK_SYMBOL (face, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3729 CHECK_SYMBOL (attr, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3730 CHECK_STRING (value, 2); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3731 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3732 if (xstricmp (XSTRING (value)->data, "unspecified") == 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3733 value = Qunspecified; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3734 else if (EQ (attr, QCheight)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3735 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3736 value = Fstring_to_number (value, make_number (10)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3737 if (XINT (value) <= 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3738 signal_error ("Invalid face height from X resource", value); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3739 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3740 else if (EQ (attr, QCbold) || EQ (attr, QCitalic)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3741 value = face_boolean_x_resource_value (value, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3742 else if (EQ (attr, QCweight) || EQ (attr, QCslant) || EQ (attr, QCwidth)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3743 value = intern (XSTRING (value)->data); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3744 else if (EQ (attr, QCreverse_video) || EQ (attr, QCinverse_video)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3745 value = face_boolean_x_resource_value (value, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3746 else if (EQ (attr, QCunderline) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3747 || EQ (attr, QCoverline) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3748 || EQ (attr, QCstrike_through) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3749 || EQ (attr, QCbox)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3750 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3751 Lisp_Object boolean_value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3752 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3753 /* If the result of face_boolean_x_resource_value is t or nil, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3754 VALUE does NOT specify a color. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3755 boolean_value = face_boolean_x_resource_value (value, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3756 if (SYMBOLP (boolean_value)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3757 value = boolean_value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3758 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3759 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3760 return Finternal_set_lisp_face_attribute (face, attr, value, frame); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3761 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3762 |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
3763 #endif /* HAVE_WINDOW_SYSTEM */ |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
3764 |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3765 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3766 DEFUN ("internal-get-lisp-face-attribute", Finternal_get_lisp_face_attribute, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3767 Sinternal_get_lisp_face_attribute, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3768 2, 3, 0, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3769 "Return face attribute KEYWORD of face SYMBOL.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3770 If SYMBOL does not name a valid Lisp face or KEYWORD isn't a valid\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3771 face attribute name, signal an error.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3772 If the optional argument FRAME is given, report on face FACE in that\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3773 frame. If FRAME is t, report on the defaults for face FACE (for new\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3774 frames). If FRAME is omitted or nil, use the selected frame.") |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3775 (symbol, keyword, frame) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3776 Lisp_Object symbol, keyword, frame; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3777 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3778 Lisp_Object lface, value = Qnil; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3779 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3780 CHECK_SYMBOL (symbol, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3781 CHECK_SYMBOL (keyword, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3782 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3783 if (EQ (frame, Qt)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3784 lface = lface_from_face_name (NULL, symbol, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3785 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3786 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3787 if (NILP (frame)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3788 frame = selected_frame; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3789 CHECK_LIVE_FRAME (frame, 2); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3790 lface = lface_from_face_name (XFRAME (frame), symbol, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3791 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3792 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3793 if (EQ (keyword, QCfamily)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3794 value = LFACE_FAMILY (lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3795 else if (EQ (keyword, QCheight)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3796 value = LFACE_HEIGHT (lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3797 else if (EQ (keyword, QCweight)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3798 value = LFACE_WEIGHT (lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3799 else if (EQ (keyword, QCslant)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3800 value = LFACE_SLANT (lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3801 else if (EQ (keyword, QCunderline)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3802 value = LFACE_UNDERLINE (lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3803 else if (EQ (keyword, QCoverline)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3804 value = LFACE_OVERLINE (lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3805 else if (EQ (keyword, QCstrike_through)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3806 value = LFACE_STRIKE_THROUGH (lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3807 else if (EQ (keyword, QCbox)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3808 value = LFACE_BOX (lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3809 else if (EQ (keyword, QCinverse_video) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3810 || EQ (keyword, QCreverse_video)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3811 value = LFACE_INVERSE (lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3812 else if (EQ (keyword, QCforeground)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3813 value = LFACE_FOREGROUND (lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3814 else if (EQ (keyword, QCbackground)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3815 value = LFACE_BACKGROUND (lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3816 else if (EQ (keyword, QCstipple)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3817 value = LFACE_STIPPLE (lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3818 else if (EQ (keyword, QCwidth)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3819 value = LFACE_SWIDTH (lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3820 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3821 signal_error ("Invalid face attribute name", keyword); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3822 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3823 return value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3824 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3825 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3826 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3827 DEFUN ("internal-lisp-face-attribute-values", |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3828 Finternal_lisp_face_attribute_values, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3829 Sinternal_lisp_face_attribute_values, 1, 1, 0, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3830 "Return a list of valid discrete values for face attribute ATTR.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3831 Value is nil if ATTR doesn't have a discrete set of valid values.") |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3832 (attr) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3833 Lisp_Object attr; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3834 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3835 Lisp_Object result = Qnil; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3836 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3837 CHECK_SYMBOL (attr, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3838 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3839 if (EQ (attr, QCweight) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3840 || EQ (attr, QCslant) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3841 || EQ (attr, QCwidth)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3842 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3843 /* Extract permissible symbols from tables. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3844 struct table_entry *table; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3845 int i, dim; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3846 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3847 if (EQ (attr, QCweight)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3848 table = weight_table, dim = DIM (weight_table); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3849 else if (EQ (attr, QCslant)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3850 table = slant_table, dim = DIM (slant_table); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3851 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3852 table = swidth_table, dim = DIM (swidth_table); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3853 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3854 for (i = 0; i < dim; ++i) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3855 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3856 Lisp_Object symbol = *table[i].symbol; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3857 Lisp_Object tail = result; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3858 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3859 while (!NILP (tail) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3860 && !EQ (XCAR (tail), symbol)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3861 tail = XCDR (tail); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3862 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3863 if (NILP (tail)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3864 result = Fcons (symbol, result); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3865 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3866 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3867 else if (EQ (attr, QCunderline)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3868 result = Fcons (Qt, Fcons (Qnil, Qnil)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3869 else if (EQ (attr, QCoverline)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3870 result = Fcons (Qt, Fcons (Qnil, Qnil)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3871 else if (EQ (attr, QCstrike_through)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3872 result = Fcons (Qt, Fcons (Qnil, Qnil)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3873 else if (EQ (attr, QCinverse_video) || EQ (attr, QCreverse_video)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3874 result = Fcons (Qt, Fcons (Qnil, Qnil)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3875 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3876 return result; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3877 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3878 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3879 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3880 DEFUN ("internal-merge-in-global-face", Finternal_merge_in_global_face, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3881 Sinternal_merge_in_global_face, 2, 2, 0, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3882 "Add attributes from frame-default definition of FACE to FACE on FRAME.") |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3883 (face, frame) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3884 Lisp_Object face, frame; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3885 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3886 Lisp_Object global_lface, local_lface; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3887 CHECK_LIVE_FRAME (frame, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3888 global_lface = lface_from_face_name (NULL, face, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3889 local_lface = lface_from_face_name (XFRAME (frame), face, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3890 if (NILP (local_lface)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3891 local_lface = Finternal_make_lisp_face (face, frame); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3892 merge_face_vectors (XVECTOR (global_lface)->contents, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3893 XVECTOR (local_lface)->contents); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3894 return face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3895 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3896 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3897 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3898 /* The following function is implemented for compatibility with 20.2. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3899 The function is used in x-resolve-fonts when it is asked to |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3900 return fonts with the same size as the font of a face. This is |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3901 done in fontset.el. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3902 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3903 DEFUN ("face-font", Fface_font, Sface_font, 1, 2, 0, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3904 "Return the font name of face FACE, or nil if it is unspecified.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3905 If the optional argument FRAME is given, report on face FACE in that frame.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3906 If FRAME is t, report on the defaults for face FACE (for new frames).\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3907 The font default for a face is either nil, or a list\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3908 of the form (bold), (italic) or (bold italic).\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3909 If FRAME is omitted or nil, use the selected frame.") |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3910 (face, frame) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3911 Lisp_Object face, frame; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3912 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3913 if (EQ (frame, Qt)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3914 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3915 Lisp_Object result = Qnil; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3916 Lisp_Object lface = lface_from_face_name (NULL, face, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3917 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3918 if (!UNSPECIFIEDP (LFACE_WEIGHT (lface)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3919 && !EQ (LFACE_WEIGHT (lface), Qnormal)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3920 result = Fcons (Qbold, result); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3921 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3922 if (!NILP (LFACE_SLANT (lface)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3923 && !EQ (LFACE_SLANT (lface), Qnormal)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3924 result = Fcons (Qitalic, result); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3925 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3926 return result; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3927 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3928 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3929 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3930 struct frame *f = frame_or_selected_frame (frame, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3931 int face_id = lookup_named_face (f, face, CHARSET_ASCII); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3932 struct face *face = FACE_FROM_ID (f, face_id); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3933 return build_string (face->font_name); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3934 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3935 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3936 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3937 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3938 /* Compare face vectors V1 and V2 for equality. Value is non-zero if |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3939 all attributes are `equal'. Tries to be fast because this function |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3940 is called quite often. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3941 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3942 static INLINE int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3943 lface_equal_p (v1, v2) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3944 Lisp_Object *v1, *v2; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3945 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3946 int i, equal_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3947 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3948 for (i = 1; i < LFACE_VECTOR_SIZE && equal_p; ++i) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3949 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3950 Lisp_Object a = v1[i]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3951 Lisp_Object b = v2[i]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3952 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3953 /* Type can differ, e.g. when one attribute is unspecified, i.e. nil, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3954 and the other is specified. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3955 equal_p = XTYPE (a) == XTYPE (b); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3956 if (!equal_p) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3957 break; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3958 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3959 if (!EQ (a, b)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3960 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3961 switch (XTYPE (a)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3962 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3963 case Lisp_String: |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3964 equal_p = (XSTRING (a)->size == XSTRING (b)->size |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3965 && bcmp (XSTRING (a)->data, XSTRING (b)->data, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3966 XSTRING (a)->size) == 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3967 break; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3968 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3969 case Lisp_Int: |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3970 case Lisp_Symbol: |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3971 equal_p = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3972 break; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3973 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3974 default: |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3975 equal_p = !NILP (Fequal (a, b)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3976 break; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3977 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3978 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3979 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3980 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3981 return equal_p; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3982 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3983 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3984 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3985 DEFUN ("internal-lisp-face-equal-p", Finternal_lisp_face_equal_p, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3986 Sinternal_lisp_face_equal_p, 2, 3, 0, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3987 "True if FACE1 and FACE2 are equal.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3988 If the optional argument FRAME is given, report on face FACE in that frame.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3989 If FRAME is t, report on the defaults for face FACE (for new frames).\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3990 If FRAME is omitted or nil, use the selected frame.") |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3991 (face1, face2, frame) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3992 Lisp_Object face1, face2, frame; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3993 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3994 int equal_p; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3995 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3996 Lisp_Object lface1, lface2; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3997 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3998 if (EQ (frame, Qt)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
3999 f = NULL; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4000 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4001 /* Don't use check_x_frame here because this function is called |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4002 before frames exist. At that time, if FRAME is nil, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4003 selected_frame will be used which is the frame dumped with |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4004 Emacs. That frame is not a GUI frame. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4005 f = frame_or_selected_frame (frame, 2); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4006 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4007 lface1 = lface_from_face_name (NULL, face1, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4008 lface2 = lface_from_face_name (NULL, face2, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4009 equal_p = lface_equal_p (XVECTOR (lface1)->contents, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4010 XVECTOR (lface2)->contents); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4011 return equal_p ? Qt : Qnil; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4012 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4013 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4014 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4015 DEFUN ("internal-lisp-face-empty-p", Finternal_lisp_face_empty_p, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4016 Sinternal_lisp_face_empty_p, 1, 2, 0, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4017 "True if FACE has no attribute specified.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4018 If the optional argument FRAME is given, report on face FACE in that frame.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4019 If FRAME is t, report on the defaults for face FACE (for new frames).\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4020 If FRAME is omitted or nil, use the selected frame.") |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4021 (face, frame) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4022 Lisp_Object face, frame; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4023 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4024 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4025 Lisp_Object lface; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4026 int i; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4027 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4028 if (NILP (frame)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4029 frame = selected_frame; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4030 CHECK_LIVE_FRAME (frame, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4031 f = XFRAME (frame); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4032 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4033 if (EQ (frame, Qt)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4034 lface = lface_from_face_name (NULL, face, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4035 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4036 lface = lface_from_face_name (f, face, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4037 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4038 for (i = 1; i < LFACE_VECTOR_SIZE; ++i) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4039 if (!UNSPECIFIEDP (XVECTOR (lface)->contents[i])) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4040 break; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4041 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4042 return i == LFACE_VECTOR_SIZE ? Qt : Qnil; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4043 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4044 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4045 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4046 DEFUN ("frame-face-alist", Fframe_face_alist, Sframe_face_alist, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4047 0, 1, 0, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4048 "Return an alist of frame-local faces defined on FRAME.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4049 For internal use only.") |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4050 (frame) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4051 Lisp_Object frame; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4052 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4053 struct frame *f = frame_or_selected_frame (frame, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4054 return f->face_alist; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4055 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4056 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4057 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4058 /* Return a hash code for Lisp string STRING with case ignored. Used |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4059 below in computing a hash value for a Lisp face. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4060 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4061 static INLINE unsigned |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4062 hash_string_case_insensitive (string) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4063 Lisp_Object string; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4064 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4065 unsigned char *s; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4066 unsigned hash = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4067 xassert (STRINGP (string)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4068 for (s = XSTRING (string)->data; *s; ++s) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4069 hash = (hash << 1) ^ tolower (*s); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4070 return hash; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4071 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4072 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4073 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4074 /* Return a hash code for face attribute vector V. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4075 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4076 static INLINE unsigned |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4077 lface_hash (v) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4078 Lisp_Object *v; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4079 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4080 return (hash_string_case_insensitive (v[LFACE_FAMILY_INDEX]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4081 ^ hash_string_case_insensitive (v[LFACE_FOREGROUND_INDEX]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4082 ^ hash_string_case_insensitive (v[LFACE_BACKGROUND_INDEX]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4083 ^ (unsigned) v[LFACE_WEIGHT_INDEX] |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4084 ^ (unsigned) v[LFACE_SLANT_INDEX] |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4085 ^ (unsigned) v[LFACE_SWIDTH_INDEX] |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4086 ^ XFASTINT (v[LFACE_HEIGHT_INDEX])); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4087 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4088 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4089 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4090 /* Return non-zero if LFACE1 and LFACE2 specify the same font (without |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4091 considering charsets/registries). They do if they specify the same |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4092 family, point size, weight, width and slant. Both LFACE1 and |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4093 LFACE2 must be fully-specified. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4094 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4095 static INLINE int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4096 lface_same_font_attributes_p (lface1, lface2) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4097 Lisp_Object *lface1, *lface2; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4098 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4099 xassert (lface_fully_specified_p (lface1) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4100 && lface_fully_specified_p (lface2)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4101 return (xstricmp (XSTRING (lface1[LFACE_FAMILY_INDEX])->data, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4102 XSTRING (lface2[LFACE_FAMILY_INDEX])->data) == 0 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4103 && (XFASTINT (lface1[LFACE_HEIGHT_INDEX]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4104 == XFASTINT (lface2[LFACE_HEIGHT_INDEX])) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4105 && EQ (lface1[LFACE_SWIDTH_INDEX], lface2[LFACE_SWIDTH_INDEX]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4106 && EQ (lface1[LFACE_WEIGHT_INDEX], lface2[LFACE_WEIGHT_INDEX]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4107 && EQ (lface1[LFACE_SLANT_INDEX], lface2[LFACE_SLANT_INDEX])); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4108 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4109 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4110 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4111 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4112 /*********************************************************************** |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4113 Realized Faces |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4114 ***********************************************************************/ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4115 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4116 /* Allocate and return a new realized face for Lisp face attribute |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4117 vector ATTR, charset CHARSET, and registry REGISTRY. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4118 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4119 static struct face * |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4120 make_realized_face (attr, charset, registry) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4121 Lisp_Object *attr; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4122 int charset; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4123 Lisp_Object registry; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4124 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4125 struct face *face = (struct face *) xmalloc (sizeof *face); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4126 bzero (face, sizeof *face); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4127 face->charset = charset; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4128 face->registry = registry; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4129 bcopy (attr, face->lface, sizeof face->lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4130 return face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4131 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4132 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4133 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4134 /* Free realized face FACE, including its X resources. FACE may |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4135 be null. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4136 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4137 static void |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4138 free_realized_face (f, face) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4139 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4140 struct face *face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4141 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4142 if (face) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4143 { |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
4144 #ifdef HAVE_WINDOW_SYSTEM |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4145 if (FRAME_WINDOW_P (f)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4146 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4147 if (face->gc) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4148 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4149 x_free_gc (f, face->gc); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4150 face->gc = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4151 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4152 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4153 free_face_colors (f, face); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4154 x_destroy_bitmap (f, face->stipple); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4155 } |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
4156 #endif /* HAVE_WINDOW_SYSTEM */ |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4157 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4158 xfree (face); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4159 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4160 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4161 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4162 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4163 /* Prepare face FACE for subsequent display on frame F. This |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4164 allocated GCs if they haven't been allocated yet or have been freed |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4165 by clearing the face cache. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4166 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4167 void |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4168 prepare_face_for_display (f, face) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4169 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4170 struct face *face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4171 { |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
4172 #ifdef HAVE_WINDOW_SYSTEM |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4173 xassert (FRAME_WINDOW_P (f)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4174 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4175 if (face->gc == 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4176 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4177 XGCValues xgcv; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4178 unsigned long mask = GCForeground | GCBackground; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4179 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4180 xgcv.foreground = face->foreground; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4181 xgcv.background = face->background; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4182 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4183 /* The font of FACE may be null if we couldn't load it. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4184 if (face->font) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4185 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4186 xgcv.font = face->font; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4187 mask |= GCFont; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4188 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4189 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4190 BLOCK_INPUT; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4191 if (face->stipple) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4192 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4193 #if 0 /* NTEMACS_TODO: XGCValues not fully simulated */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4194 xgcv.fill_style = FillOpaqueStippled; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4195 xgcv.stipple = x_bitmap_pixmap (f, face->stipple); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4196 mask |= GCFillStyle | GCStipple; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4197 #endif /* NTEMACS_TODO */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4198 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4199 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4200 face->gc = x_create_gc (f, mask, &xgcv); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4201 UNBLOCK_INPUT; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4202 } |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
4203 #endif /* HAVE_WINDOW_SYSTEM */ |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4204 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4205 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4206 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4207 /* Non-zero if FACE is suitable for displaying ISO8859-1. Used in |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4208 macro FACE_SUITABLE_FOR_CHARSET_P to avoid realizing a new face for |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4209 ISO8859-1 if the ASCII face suffices. */ |
13434 | 4210 |
4211 int | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4212 face_suitable_for_iso8859_1_p (face) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4213 struct face *face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4214 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4215 int len = strlen (face->font_name); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4216 return len >= 9 && xstricmp (face->font_name + len - 9, "iso8859-1") == 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4217 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4218 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4219 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4220 /* Value is non-zero if FACE is suitable for displaying characters |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4221 of CHARSET. CHARSET < 0 means unibyte text. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4222 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4223 INLINE int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4224 face_suitable_for_charset_p (face, charset) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4225 struct face *face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4226 int charset; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4227 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4228 int suitable_p = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4229 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4230 if (charset < 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4231 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4232 if (EQ (face->registry, Vface_default_registry) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4233 || !NILP (Fequal (face->registry, Vface_default_registry))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4234 suitable_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4235 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4236 else if (face->charset == charset) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4237 suitable_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4238 else if (face->charset == CHARSET_ASCII |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4239 && charset == charset_latin_iso8859_1) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4240 suitable_p = face_suitable_for_iso8859_1_p (face); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4241 else if (face->charset == charset_latin_iso8859_1 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4242 && charset == CHARSET_ASCII) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4243 suitable_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4244 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4245 return suitable_p; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4246 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4247 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4248 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4249 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4250 /*********************************************************************** |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4251 Face Cache |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4252 ***********************************************************************/ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4253 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4254 /* Return a new face cache for frame F. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4255 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4256 static struct face_cache * |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4257 make_face_cache (f) |
13434 | 4258 struct frame *f; |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4259 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4260 struct face_cache *c; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4261 int size; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4262 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4263 c = (struct face_cache *) xmalloc (sizeof *c); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4264 bzero (c, sizeof *c); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4265 size = FACE_CACHE_BUCKETS_SIZE * sizeof *c->buckets; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4266 c->buckets = (struct face **) xmalloc (size); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4267 bzero (c->buckets, size); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4268 c->size = 50; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4269 c->faces_by_id = (struct face **) xmalloc (c->size * sizeof *c->faces_by_id); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4270 c->f = f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4271 return c; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4272 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4273 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4274 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4275 /* Clear out all graphics contexts for all realized faces, except for |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4276 the basic faces. This should be done from time to time just to avoid |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4277 keeping too many graphics contexts that are no longer needed. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4278 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4279 static void |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4280 clear_face_gcs (c) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4281 struct face_cache *c; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4282 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4283 if (c && FRAME_WINDOW_P (c->f)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4284 { |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
4285 #ifdef HAVE_WINDOW_SYSTEM |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4286 int i; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4287 for (i = BASIC_FACE_ID_SENTINEL; i < c->used; ++i) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4288 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4289 struct face *face = c->faces_by_id[i]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4290 if (face && face->gc) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4291 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4292 x_free_gc (c->f, face->gc); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4293 face->gc = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4294 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4295 } |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
4296 #endif /* HAVE_WINDOW_SYSTEM */ |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4297 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4298 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4299 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4300 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4301 /* Free all realized faces in face cache C, including basic faces. C |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4302 may be null. If faces are freed, make sure the frame's current |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4303 matrix is marked invalid, so that a display caused by an expose |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4304 event doesn't try to use faces we destroyed. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4305 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4306 static void |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4307 free_realized_faces (c) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4308 struct face_cache *c; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4309 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4310 if (c && c->used) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4311 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4312 int i, size; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4313 struct frame *f = c->f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4314 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4315 for (i = 0; i < c->used; ++i) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4316 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4317 free_realized_face (f, c->faces_by_id[i]); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4318 c->faces_by_id[i] = NULL; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4319 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4320 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4321 c->used = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4322 size = FACE_CACHE_BUCKETS_SIZE * sizeof *c->buckets; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4323 bzero (c->buckets, size); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4324 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4325 /* Must do a thorough redisplay the next time. Mark current |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4326 matrices as invalid because they will reference faces freed |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4327 above. This function is also called when a frame is |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4328 destroyed. In this case, the root window of F is nil. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4329 if (WINDOWP (f->root_window)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4330 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4331 clear_current_matrices (f); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4332 ++windows_or_buffers_changed; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4333 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4334 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4335 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4336 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4337 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4338 /* Free all realized faces on FRAME or on all frames if FRAME is nil. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4339 This is done after attributes of a named face have been changed, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4340 because we can't tell which realized faces depend on that face. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4341 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4342 void |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4343 free_all_realized_faces (frame) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4344 Lisp_Object frame; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4345 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4346 if (NILP (frame)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4347 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4348 Lisp_Object rest; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4349 FOR_EACH_FRAME (rest, frame) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4350 free_realized_faces (FRAME_FACE_CACHE (XFRAME (frame))); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4351 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4352 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4353 free_realized_faces (FRAME_FACE_CACHE (XFRAME (frame))); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4354 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4355 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4356 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4357 /* Free face cache C and faces in it, including their X resources. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4358 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4359 static void |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4360 free_face_cache (c) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4361 struct face_cache *c; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4362 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4363 if (c) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4364 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4365 free_realized_faces (c); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4366 xfree (c->buckets); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4367 xfree (c->faces_by_id); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4368 xfree (c); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4369 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4370 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4371 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4372 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4373 /* Cache realized face FACE in face cache C. HASH is the hash value |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4374 of FACE. If FACE->fontset >= 0, add the new face to the end of the |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4375 collision list of the face hash table of C. This is done because |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4376 otherwise lookup_face would find FACE for every charset, even if |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4377 faces with the same attributes but for specific charsets exist. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4378 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4379 static void |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4380 cache_face (c, face, hash) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4381 struct face_cache *c; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4382 struct face *face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4383 unsigned hash; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4384 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4385 int i = hash % FACE_CACHE_BUCKETS_SIZE; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4386 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4387 face->hash = hash; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4388 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4389 if (face->fontset >= 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4390 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4391 struct face *last = c->buckets[i]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4392 if (last) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4393 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4394 while (last->next) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4395 last = last->next; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4396 last->next = face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4397 face->prev = last; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4398 face->next = NULL; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4399 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4400 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4401 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4402 c->buckets[i] = face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4403 face->prev = face->next = NULL; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4404 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4405 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4406 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4407 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4408 face->prev = NULL; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4409 face->next = c->buckets[i]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4410 if (face->next) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4411 face->next->prev = face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4412 c->buckets[i] = face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4413 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4414 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4415 /* Find a free slot in C->faces_by_id and use the index of the free |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4416 slot as FACE->id. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4417 for (i = 0; i < c->used; ++i) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4418 if (c->faces_by_id[i] == NULL) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4419 break; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4420 face->id = i; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4421 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4422 /* Maybe enlarge C->faces_by_id. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4423 if (i == c->used && c->used == c->size) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4424 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4425 int new_size = 2 * c->size; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4426 int sz = new_size * sizeof *c->faces_by_id; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4427 c->faces_by_id = (struct face **) xrealloc (c->faces_by_id, sz); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4428 c->size = new_size; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4429 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4430 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4431 #if GLYPH_DEBUG |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4432 /* Check that FACE got a unique id. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4433 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4434 int j, n; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4435 struct face *face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4436 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4437 for (j = n = 0; j < FACE_CACHE_BUCKETS_SIZE; ++j) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4438 for (face = c->buckets[j]; face; face = face->next) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4439 if (face->id == i) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4440 ++n; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4441 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4442 xassert (n == 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4443 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4444 #endif /* GLYPH_DEBUG */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4445 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4446 c->faces_by_id[i] = face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4447 if (i == c->used) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4448 ++c->used; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4449 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4450 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4451 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4452 /* Remove face FACE from cache C. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4453 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4454 static void |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4455 uncache_face (c, face) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4456 struct face_cache *c; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4457 struct face *face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4458 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4459 int i = face->hash % FACE_CACHE_BUCKETS_SIZE; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4460 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4461 if (face->prev) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4462 face->prev->next = face->next; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4463 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4464 c->buckets[i] = face->next; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4465 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4466 if (face->next) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4467 face->next->prev = face->prev; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4468 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4469 c->faces_by_id[face->id] = NULL; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4470 if (face->id == c->used) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4471 --c->used; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4472 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4473 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4474 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4475 /* Look up a realized face with face attributes ATTR in the face cache |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4476 of frame F. The face will be used to display characters of |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4477 CHARSET. CHARSET < 0 means the face will be used to display |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4478 unibyte text. The value of face-default-registry is used to choose |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4479 a font for the face in that case. Value is the ID of the face |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4480 found. If no suitable face is found, realize a new one. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4481 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4482 INLINE int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4483 lookup_face (f, attr, charset) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4484 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4485 Lisp_Object *attr; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4486 int charset; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4487 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4488 struct face_cache *c = FRAME_FACE_CACHE (f); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4489 unsigned hash; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4490 int i; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4491 struct face *face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4492 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4493 xassert (c != NULL); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4494 check_lface_attrs (attr); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4495 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4496 /* Look up ATTR in the face cache. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4497 hash = lface_hash (attr); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4498 i = hash % FACE_CACHE_BUCKETS_SIZE; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4499 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4500 for (face = c->buckets[i]; face; face = face->next) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4501 if (face->hash == hash |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4502 && (!FRAME_WINDOW_P (f) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4503 || FACE_SUITABLE_FOR_CHARSET_P (face, charset)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4504 && lface_equal_p (face->lface, attr)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4505 break; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4506 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4507 /* If not found, realize a new face. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4508 if (face == NULL) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4509 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4510 face = realize_face (c, attr, charset); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4511 cache_face (c, face, hash); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4512 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4513 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4514 #if GLYPH_DEBUG |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4515 xassert (face == FACE_FROM_ID (f, face->id)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4516 if (FRAME_WINDOW_P (f)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4517 xassert (charset < 0 || FACE_SUITABLE_FOR_CHARSET_P (face, charset)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4518 #endif /* GLYPH_DEBUG */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4519 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4520 return face->id; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4521 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4522 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4523 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4524 /* Return the face id of the realized face for named face SYMBOL on |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4525 frame F suitable for displaying characters from CHARSET. CHARSET < |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4526 0 means unibyte text. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4527 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4528 int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4529 lookup_named_face (f, symbol, charset) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4530 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4531 Lisp_Object symbol; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4532 int charset; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4533 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4534 Lisp_Object attrs[LFACE_VECTOR_SIZE]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4535 Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4536 struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4537 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4538 get_lface_attributes (f, symbol, symbol_attrs, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4539 bcopy (default_face->lface, attrs, sizeof attrs); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4540 merge_face_vectors (symbol_attrs, attrs); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4541 return lookup_face (f, attrs, charset); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4542 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4543 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4544 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4545 /* Return the ID of the realized ASCII face of Lisp face with ID |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4546 LFACE_ID on frame F. Value is -1 if LFACE_ID isn't valid. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4547 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4548 int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4549 ascii_face_of_lisp_face (f, lface_id) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4550 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4551 int lface_id; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4552 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4553 int face_id; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4554 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4555 if (lface_id >= 0 && lface_id < lface_id_to_name_size) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4556 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4557 Lisp_Object face_name = lface_id_to_name[lface_id]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4558 face_id = lookup_named_face (f, face_name, CHARSET_ASCII); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4559 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4560 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4561 face_id = -1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4562 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4563 return face_id; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4564 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4565 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4566 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4567 /* Return a face for charset ASCII that is like the face with id |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4568 FACE_ID on frame F, but has a font that is STEPS steps smaller. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4569 STEPS < 0 means larger. Value is the id of the face. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4570 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4571 int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4572 smaller_face (f, face_id, steps) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4573 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4574 int face_id, steps; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4575 { |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
4576 #ifdef HAVE_WINDOW_SYSTEM |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4577 struct face *face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4578 Lisp_Object attrs[LFACE_VECTOR_SIZE]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4579 int pt, last_pt, last_height; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4580 int delta; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4581 int new_face_id; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4582 struct face *new_face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4583 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4584 /* If not called for an X frame, just return the original face. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4585 if (FRAME_TERMCAP_P (f)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4586 return face_id; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4587 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4588 /* Try in increments of 1/2 pt. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4589 delta = steps < 0 ? 5 : -5; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4590 steps = abs (steps); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4591 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4592 face = FACE_FROM_ID (f, face_id); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4593 bcopy (face->lface, attrs, sizeof attrs); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4594 pt = last_pt = XFASTINT (attrs[LFACE_HEIGHT_INDEX]); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4595 new_face_id = face_id; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4596 last_height = FONT_HEIGHT (face->font); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4597 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4598 while (steps |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4599 && pt + delta > 0 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4600 /* Give up if we cannot find a font within 10pt. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4601 && abs (last_pt - pt) < 100) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4602 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4603 /* Look up a face for a slightly smaller/larger font. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4604 pt += delta; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4605 attrs[LFACE_HEIGHT_INDEX] = make_number (pt); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4606 new_face_id = lookup_face (f, attrs, CHARSET_ASCII); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4607 new_face = FACE_FROM_ID (f, new_face_id); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4608 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4609 /* If height changes, count that as one step. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4610 if (FONT_HEIGHT (new_face->font) != last_height) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4611 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4612 --steps; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4613 last_height = FONT_HEIGHT (new_face->font); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4614 last_pt = pt; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4615 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4616 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4617 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4618 return new_face_id; |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
4619 |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
4620 #else /* not HAVE_WINDOW_SYSTEM */ |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
4621 |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
4622 return face_id; |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
4623 |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
4624 #endif /* not HAVE_WINDOW_SYSTEM */ |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4625 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4626 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4627 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4628 /* Return a face for charset ASCII that is like the face with id |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4629 FACE_ID on frame F, but has height HEIGHT. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4630 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4631 int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4632 face_with_height (f, face_id, height) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4633 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4634 int face_id; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4635 int height; |
13434 | 4636 { |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
4637 #ifdef HAVE_WINDOW_SYSTEM |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4638 struct face *face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4639 Lisp_Object attrs[LFACE_VECTOR_SIZE]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4640 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4641 if (FRAME_TERMCAP_P (f) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4642 || height <= 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4643 return face_id; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4644 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4645 face = FACE_FROM_ID (f, face_id); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4646 bcopy (face->lface, attrs, sizeof attrs); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4647 attrs[LFACE_HEIGHT_INDEX] = make_number (height); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4648 face_id = lookup_face (f, attrs, CHARSET_ASCII); |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
4649 #endif /* HAVE_WINDOW_SYSTEM */ |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4650 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4651 return face_id; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4652 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4653 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4654 /* Return the face id of the realized face for named face SYMBOL on |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4655 frame F suitable for displaying characters from CHARSET (CHARSET < |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4656 0 means unibyte text), and use attributes of the face FACE_ID for |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4657 attributes that aren't completely specified by SYMBOL. This is |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4658 like lookup_named_face, except that the default attributes come |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4659 from FACE_ID, not from the default face. FACE_ID is assumed to |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4660 be already realized. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4661 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4662 int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4663 lookup_derived_face (f, symbol, charset, face_id) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4664 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4665 Lisp_Object symbol; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4666 int charset; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4667 int face_id; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4668 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4669 Lisp_Object attrs[LFACE_VECTOR_SIZE]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4670 Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4671 struct face *default_face = FACE_FROM_ID (f, face_id); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4672 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4673 if (!default_face) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4674 abort (); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4675 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4676 get_lface_attributes (f, symbol, symbol_attrs, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4677 bcopy (default_face->lface, attrs, sizeof attrs); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4678 merge_face_vectors (symbol_attrs, attrs); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4679 return lookup_face (f, attrs, charset); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4680 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4681 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4682 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4683 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4684 /*********************************************************************** |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4685 Font selection |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4686 ***********************************************************************/ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4687 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4688 DEFUN ("internal-set-font-selection-order", |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4689 Finternal_set_font_selection_order, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4690 Sinternal_set_font_selection_order, 1, 1, 0, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4691 "Set font selection order for face font selection to ORDER.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4692 ORDER must be a list of length 4 containing the symbols `:width',\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4693 `:height', `:weight', and `:slant'. Face attributes appearing\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4694 first in ORDER are matched first, e.g. if `:height' appears before\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4695 `:weight' in ORDER, font selection first tries to find a font with\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4696 a suitable height, and then tries to match the font weight.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4697 Value is ORDER.") |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4698 (order) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4699 Lisp_Object order; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4700 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4701 Lisp_Object list; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4702 int i; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4703 int indices[4]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4704 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4705 CHECK_LIST (order, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4706 bzero (indices, sizeof indices); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4707 i = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4708 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4709 for (list = order; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4710 CONSP (list) && i < DIM (indices); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4711 list = XCDR (list), ++i) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4712 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4713 Lisp_Object attr = XCAR (list); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4714 int xlfd; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4715 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4716 if (EQ (attr, QCwidth)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4717 xlfd = XLFD_SWIDTH; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4718 else if (EQ (attr, QCheight)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4719 xlfd = XLFD_POINT_SIZE; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4720 else if (EQ (attr, QCweight)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4721 xlfd = XLFD_WEIGHT; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4722 else if (EQ (attr, QCslant)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4723 xlfd = XLFD_SLANT; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4724 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4725 break; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4726 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4727 if (indices[i] != 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4728 break; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4729 indices[i] = xlfd; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4730 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4731 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4732 if (!NILP (list) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4733 || i != DIM (indices) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4734 || indices[0] == 0 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4735 || indices[1] == 0 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4736 || indices[2] == 0 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4737 || indices[3] == 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4738 signal_error ("Invalid font sort order", order); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4739 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4740 if (bcmp (indices, font_sort_order, sizeof indices) != 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4741 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4742 bcopy (indices, font_sort_order, sizeof font_sort_order); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4743 free_all_realized_faces (Qnil); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4744 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4745 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4746 return Qnil; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4747 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4748 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4749 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4750 DEFUN ("internal-set-alternative-font-family-alist", |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4751 Finternal_set_alternative_font_family_alist, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4752 Sinternal_set_alternative_font_family_alist, 1, 1, 0, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4753 "Define alternative font families to try in face font selection.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4754 ALIST is an alist of (FAMILY ALTERNATIVE1 ALTERNATIVE2 ...) entries.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4755 Each ALTERNATIVE is tried in order if no fonts of font family FAMILY can\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4756 be found. Value is ALIST.") |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4757 (alist) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4758 Lisp_Object alist; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4759 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4760 CHECK_LIST (alist, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4761 Vface_alternative_font_family_alist = alist; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4762 free_all_realized_faces (Qnil); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4763 return alist; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4764 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4765 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4766 |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
4767 #ifdef HAVE_WINDOW_SYSTEM |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
4768 |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4769 /* Return the X registry and encoding of font name FONT_NAME on frame F. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4770 Value is nil if not successful. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4771 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4772 static Lisp_Object |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4773 deduce_unibyte_registry (f, font_name) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4774 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4775 char *font_name; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4776 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4777 struct font_name font; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4778 Lisp_Object registry = Qnil; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4779 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4780 font.name = STRDUPA (font_name); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4781 if (split_font_name (f, &font, 0)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4782 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4783 char *buffer; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4784 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4785 /* Extract registry and encoding. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4786 buffer = (char *) alloca (strlen (font.fields[XLFD_REGISTRY]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4787 + strlen (font.fields[XLFD_ENCODING]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4788 + 10); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4789 strcpy (buffer, font.fields[XLFD_REGISTRY]); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4790 strcat (buffer, "-"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4791 strcat (buffer, font.fields[XLFD_ENCODING]); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4792 registry = build_string (buffer); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4793 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4794 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4795 return registry; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4796 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4797 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4798 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4799 /* Value is non-zero if FONT is the name of a scalable font. The |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4800 X11R6 XLFD spec says that point size, pixel size, and average width |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4801 are zero for scalable fonts. Intlfonts contain at least one |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4802 scalable font ("*-muleindian-1") for which this isn't true, so we |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4803 just test average width. Windows implementation of XLFD is |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4804 slightly broken for backward compatibility with previous broken |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4805 versions, so test for wildcards as well as 0. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4806 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4807 static int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4808 font_scalable_p (font) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4809 struct font_name *font; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4810 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4811 char *s = font->fields[XLFD_AVGWIDTH]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4812 return (*s == '0' && *(s + 1) == '\0') || *s == '*'; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4813 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4814 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4815 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4816 /* Value is non-zero if FONT1 is a better match for font attributes |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4817 VALUES than FONT2. VALUES is an array of face attribute values in |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4818 font sort order. COMPARE_PT_P zero means don't compare point |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4819 sizes. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4820 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4821 static int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4822 better_font_p (values, font1, font2, compare_pt_p) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4823 int *values; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4824 struct font_name *font1, *font2; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4825 int compare_pt_p; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4826 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4827 int i; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4828 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4829 for (i = 0; i < 4; ++i) |
13434 | 4830 { |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4831 int xlfd_idx = font_sort_order[i]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4832 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4833 if (compare_pt_p || xlfd_idx != XLFD_POINT_SIZE) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4834 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4835 int delta1 = abs (values[i] - font1->numeric[xlfd_idx]); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4836 int delta2 = abs (values[i] - font2->numeric[xlfd_idx]); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4837 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4838 if (delta1 > delta2) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4839 return 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4840 else if (delta1 < delta2) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4841 return 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4842 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4843 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4844 /* The difference may be equal because, e.g., the face |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4845 specifies `italic' but we have only `regular' and |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4846 `oblique'. Prefer `oblique' in this case. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4847 if ((xlfd_idx == XLFD_WEIGHT || xlfd_idx == XLFD_SLANT) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4848 && font1->numeric[xlfd_idx] > values[i] |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4849 && font2->numeric[xlfd_idx] < values[i]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4850 return 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4851 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4852 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4853 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4854 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4855 return 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4856 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4857 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4858 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4859 #if SCALABLE_FONTS |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4860 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4861 /* Value is non-zero if FONT is an exact match for face attributes in |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4862 SPECIFIED. SPECIFIED is an array of face attribute values in font |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4863 sort order. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4864 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4865 static int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4866 exact_face_match_p (specified, font) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4867 int *specified; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4868 struct font_name *font; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4869 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4870 int i; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4871 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4872 for (i = 0; i < 4; ++i) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4873 if (specified[i] != font->numeric[font_sort_order[i]]) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4874 break; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4875 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4876 return i == 4; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4877 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4878 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4879 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4880 /* Value is the name of a scaled font, generated from scalable font |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4881 FONT on frame F. SPECIFIED_PT is the point-size to scale FONT to. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4882 Value is allocated from heap. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4883 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4884 static char * |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4885 build_scalable_font_name (f, font, specified_pt) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4886 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4887 struct font_name *font; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4888 int specified_pt; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4889 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4890 char point_size[20], pixel_size[20]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4891 int pixel_value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4892 double resy = FRAME_W32_DISPLAY_INFO (f)->resy; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4893 double pt; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4894 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4895 /* If scalable font is for a specific resolution, compute |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4896 the point size we must specify from the resolution of |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4897 the display and the specified resolution of the font. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4898 if (font->numeric[XLFD_RESY] != 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4899 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4900 pt = resy / font->numeric[XLFD_RESY] * specified_pt + 0.5; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4901 pixel_value = font->numeric[XLFD_RESY] / 720.0 * pt; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4902 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4903 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4904 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4905 pt = specified_pt; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4906 pixel_value = resy / 720.0 * pt; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4907 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4908 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4909 /* Set point size of the font. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4910 sprintf (point_size, "%d", (int) pt); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4911 font->fields[XLFD_POINT_SIZE] = point_size; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4912 font->numeric[XLFD_POINT_SIZE] = pt; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4913 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4914 /* Set pixel size. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4915 sprintf (pixel_size, "%d", pixel_value); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4916 font->fields[XLFD_PIXEL_SIZE] = pixel_size; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4917 font->numeric[XLFD_PIXEL_SIZE] = pixel_value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4918 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4919 /* If font doesn't specify its resolution, use the |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4920 resolution of the display. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4921 if (font->numeric[XLFD_RESY] == 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4922 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4923 char buffer[20]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4924 sprintf (buffer, "%d", (int) resy); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4925 font->fields[XLFD_RESY] = buffer; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4926 font->numeric[XLFD_RESY] = resy; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4927 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4928 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4929 if (strcmp (font->fields[XLFD_RESX], "0") == 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4930 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4931 char buffer[20]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4932 int resx = FRAME_W32_DISPLAY_INFO (f)->resx; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4933 sprintf (buffer, "%d", resx); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4934 font->fields[XLFD_RESX] = buffer; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4935 font->numeric[XLFD_RESX] = resx; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4936 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4937 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4938 return build_font_name (font); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4939 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4940 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4941 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4942 /* Value is non-zero if we are allowed to use scalable font FONT. We |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4943 can't run a Lisp function here since this function may be called |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4944 with input blocked. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4945 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4946 static int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4947 may_use_scalable_font_p (font, name) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4948 struct font_name *font; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4949 char *name; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4950 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4951 if (EQ (Vscalable_fonts_allowed, Qt)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4952 return 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4953 else if (CONSP (Vscalable_fonts_allowed)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4954 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4955 Lisp_Object tail, regexp; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4956 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4957 for (tail = Vscalable_fonts_allowed; CONSP (tail); tail = XCDR (tail)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4958 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4959 regexp = XCAR (tail); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4960 if (STRINGP (regexp) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4961 && fast_c_string_match_ignore_case (regexp, name) >= 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4962 return 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4963 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4964 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4965 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4966 return 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4967 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4968 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4969 #endif /* SCALABLE_FONTS != 0 */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4970 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4971 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4972 /* Return the name of the best matching font for face attributes |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4973 ATTRS in the array of font_name structures FONTS which contains |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4974 NFONTS elements. Value is a font name which is allocated from |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4975 the heap. FONTS is freed by this function. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4976 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4977 static char * |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4978 best_matching_font (f, attrs, fonts, nfonts) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4979 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4980 Lisp_Object *attrs; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4981 struct font_name *fonts; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4982 int nfonts; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4983 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4984 char *font_name; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4985 struct font_name *best; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4986 int i, pt; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4987 int specified[4]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4988 int exact_p; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4989 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4990 if (nfonts == 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4991 return NULL; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4992 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4993 /* Make specified font attributes available in `specified', |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4994 indexed by sort order. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4995 for (i = 0; i < DIM (font_sort_order); ++i) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4996 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4997 int xlfd_idx = font_sort_order[i]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4998 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
4999 if (xlfd_idx == XLFD_SWIDTH) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5000 specified[i] = face_numeric_swidth (attrs[LFACE_SWIDTH_INDEX]); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5001 else if (xlfd_idx == XLFD_POINT_SIZE) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5002 specified[i] = pt = XFASTINT (attrs[LFACE_HEIGHT_INDEX]); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5003 else if (xlfd_idx == XLFD_WEIGHT) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5004 specified[i] = face_numeric_weight (attrs[LFACE_WEIGHT_INDEX]); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5005 else if (xlfd_idx == XLFD_SLANT) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5006 specified[i] = face_numeric_slant (attrs[LFACE_SLANT_INDEX]); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5007 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5008 abort (); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5009 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5010 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5011 #if SCALABLE_FONTS |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5012 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5013 /* Set to 1 */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5014 exact_p = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5015 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5016 /* Start with the first non-scalable font in the list. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5017 for (i = 0; i < nfonts; ++i) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5018 if (!font_scalable_p (fonts + i)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5019 break; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5020 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5021 /* Find the best match among the non-scalable fonts. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5022 if (i < nfonts) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5023 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5024 best = fonts + i; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5025 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5026 for (i = 1; i < nfonts; ++i) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5027 if (!font_scalable_p (fonts + i) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5028 && better_font_p (specified, fonts + i, best, 1)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5029 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5030 best = fonts + i; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5031 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5032 exact_p = exact_face_match_p (specified, best); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5033 if (exact_p) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5034 break; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5035 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5036 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5037 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5038 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5039 best = NULL; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5040 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5041 /* Unless we found an exact match among non-scalable fonts, see if |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5042 we can find a better match among scalable fonts. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5043 if (!exact_p) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5044 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5045 /* A scalable font is better if |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5046 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5047 1. its weight, slant, swidth attributes are better, or. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5048 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5049 2. the best non-scalable font doesn't have the required |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5050 point size, and the scalable fonts weight, slant, swidth |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5051 isn't worse. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5052 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5053 int non_scalable_has_exact_height_p; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5054 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5055 if (best && best->numeric[XLFD_POINT_SIZE] == pt) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5056 non_scalable_has_exact_height_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5057 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5058 non_scalable_has_exact_height_p = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5059 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5060 for (i = 0; i < nfonts; ++i) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5061 if (font_scalable_p (fonts + i)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5062 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5063 if (best == NULL |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5064 || better_font_p (specified, fonts + i, best, 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5065 || (!non_scalable_has_exact_height_p |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5066 && !better_font_p (specified, best, fonts + i, 0))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5067 best = fonts + i; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5068 } |
13434 | 5069 } |
5070 | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5071 if (font_scalable_p (best)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5072 font_name = build_scalable_font_name (f, best, pt); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5073 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5074 font_name = build_font_name (best); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5075 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5076 #else /* !SCALABLE_FONTS */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5077 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5078 /* Find the best non-scalable font. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5079 best = fonts; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5080 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5081 for (i = 1; i < nfonts; ++i) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5082 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5083 xassert (!font_scalable_p (fonts + i)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5084 if (better_font_p (specified, fonts + i, best, 1)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5085 best = fonts + i; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5086 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5087 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5088 font_name = build_font_name (best); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5089 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5090 #endif /* !SCALABLE_FONTS */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5091 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5092 /* Free font_name structures. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5093 free_font_names (fonts, nfonts); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5094 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5095 return font_name; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5096 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5097 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5098 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5099 /* Try to get a list of fonts on frame F with font family FAMILY and |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5100 registry/encoding REGISTRY. Return in *FONTS a pointer to a vector |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5101 of font_name structures for the fonts matched. Value is the number |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5102 of fonts found. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5103 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5104 static int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5105 try_font_list (f, attrs, pattern, family, registry, fonts) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5106 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5107 Lisp_Object *attrs; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5108 char *pattern, *family, *registry; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5109 struct font_name **fonts; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5110 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5111 int nfonts; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5112 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5113 if (family == NULL) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5114 family = LSTRDUPA (attrs[LFACE_FAMILY_INDEX]); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5115 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5116 nfonts = font_list (f, pattern, family, registry, fonts); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5117 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5118 if (nfonts == 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5119 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5120 Lisp_Object alter; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5121 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5122 /* Try alternative font families from |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5123 Vface_alternative_font_family_alist. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5124 alter = Fassoc (build_string (family), |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5125 Vface_alternative_font_family_alist); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5126 if (CONSP (alter)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5127 for (alter = XCDR (alter); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5128 CONSP (alter) && nfonts == 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5129 alter = XCDR (alter)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5130 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5131 if (STRINGP (XCAR (alter))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5132 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5133 family = LSTRDUPA (XCAR (alter)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5134 nfonts = font_list (f, NULL, family, registry, fonts); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5135 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5136 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5137 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5138 /* Try font family of the default face or "fixed". */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5139 if (nfonts == 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5140 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5141 struct face *dflt = FACE_FROM_ID (f, DEFAULT_FACE_ID); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5142 if (dflt) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5143 family = LSTRDUPA (dflt->lface[LFACE_FAMILY_INDEX]); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5144 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5145 family = "fixed"; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5146 nfonts = font_list (f, NULL, family, registry, fonts); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5147 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5148 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5149 /* Try any family with the given registry. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5150 if (nfonts == 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5151 nfonts = font_list (f, NULL, "*", registry, fonts); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5152 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5153 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5154 return nfonts; |
13434 | 5155 } |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5156 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5157 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5158 /* Return the registry and encoding pattern that fonts for CHARSET |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5159 should match. Value is allocated from the heap. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5160 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5161 char * |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5162 x_charset_registry (charset) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5163 int charset; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5164 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5165 Lisp_Object prop, charset_plist; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5166 char *registry; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5167 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5168 /* Get registry and encoding from the charset's plist. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5169 charset_plist = CHARSET_TABLE_INFO (charset, CHARSET_PLIST_IDX); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5170 prop = Fplist_get (charset_plist, Qx_charset_registry); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5171 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5172 if (STRINGP (prop)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5173 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5174 if (index (XSTRING (prop)->data, '-')) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5175 registry = xstrdup (XSTRING (prop)->data); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5176 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5177 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5178 /* If registry doesn't contain a `-', make it a pattern. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5179 registry = (char *) xmalloc (STRING_BYTES (XSTRING (prop)) + 5); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5180 strcpy (registry, XSTRING (prop)->data); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5181 strcat (registry, "*-*"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5182 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5183 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5184 else if (STRINGP (Vface_default_registry)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5185 registry = xstrdup (XSTRING (Vface_default_registry)->data); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5186 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5187 registry = xstrdup ("iso8859-1"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5188 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5189 return registry; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5190 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5191 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5192 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5193 /* Return the fontset id of the fontset name or alias name given by |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5194 the family attribute of ATTRS on frame F. Value is -1 if the |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5195 family attribute of ATTRS doesn't name a fontset. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5196 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5197 static int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5198 face_fontset (f, attrs) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5199 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5200 Lisp_Object *attrs; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5201 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5202 Lisp_Object name = attrs[LFACE_FAMILY_INDEX]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5203 int fontset; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5204 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5205 name = Fquery_fontset (name, Qnil); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5206 if (NILP (name)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5207 fontset = -1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5208 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5209 fontset = fs_query_fontset (f, XSTRING (name)->data); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5210 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5211 return fontset; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5212 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5213 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5214 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5215 /* Get the font to use for the face realizing the fully-specified Lisp |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5216 face ATTRS for charset CHARSET on frame F. CHARSET < 0 means |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5217 unibyte text; UNIBYTE_REGISTRY is the registry and encoding to use |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5218 in this case. Value is the font name which is allocated from the |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5219 heap (which means that it must be freed eventually). */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5220 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5221 static char * |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5222 choose_face_font (f, attrs, charset, unibyte_registry) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5223 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5224 Lisp_Object *attrs; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5225 int charset; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5226 Lisp_Object unibyte_registry; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5227 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5228 struct font_name *fonts; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5229 int nfonts; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5230 char *registry; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5231 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5232 /* ATTRS must be fully-specified. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5233 xassert (lface_fully_specified_p (attrs)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5234 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5235 if (STRINGP (unibyte_registry)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5236 registry = xstrdup (XSTRING (unibyte_registry)->data); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5237 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5238 registry = x_charset_registry (charset); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5239 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5240 nfonts = try_font_list (f, attrs, NULL, NULL, registry, &fonts); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5241 xfree (registry); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5242 return best_matching_font (f, attrs, fonts, nfonts); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5243 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5244 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5245 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5246 /* Choose a font to use on frame F to display CHARSET using FONTSET |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5247 with Lisp face attributes specified by ATTRS. CHARSET may be any |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5248 valid charset. CHARSET < 0 means unibyte text. If the fontset |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5249 doesn't contain a font pattern for charset, use the pattern for |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5250 CHARSET_ASCII. Value is the font name which is allocated from the |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5251 heap and must be freed by the caller. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5252 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5253 static char * |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5254 choose_face_fontset_font (f, attrs, fontset, charset) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5255 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5256 Lisp_Object *attrs; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5257 int fontset, charset; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5258 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5259 char *pattern; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5260 char *font_name = NULL; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5261 struct fontset_info *fontset_info; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5262 struct font_name *fonts; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5263 int nfonts; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5264 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5265 xassert (fontset >= 0 && fontset < FRAME_FONTSET_DATA (f)->n_fontsets); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5266 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5267 /* For unibyte text, use the ASCII font of the fontset. Using the |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5268 ASCII font seems to be the most reasonable thing we can do in |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5269 this case. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5270 if (charset < 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5271 charset = CHARSET_ASCII; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5272 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5273 /* Get the font name pattern to use for CHARSET from the fontset. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5274 fontset_info = FRAME_FONTSET_DATA (f)->fontset_table[fontset]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5275 pattern = fontset_info->fontname[charset]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5276 if (!pattern) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5277 pattern = fontset_info->fontname[CHARSET_ASCII]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5278 xassert (pattern); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5279 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5280 /* Get a list of fonts matching that pattern and choose the |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5281 best match for the specified face attributes from it. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5282 nfonts = try_font_list (f, attrs, pattern, NULL, NULL, &fonts); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5283 font_name = best_matching_font (f, attrs, fonts, nfonts); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5284 return font_name; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5285 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5286 |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5287 #endif /* HAVE_WINDOW_SYSTEM */ |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5288 |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5289 |
13434 | 5290 |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5291 /*********************************************************************** |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5292 Face Realization |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5293 ***********************************************************************/ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5294 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5295 /* Realize basic faces on frame F. Value is zero if frame parameters |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5296 of F don't contain enough information needed to realize the default |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5297 face. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5298 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5299 static int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5300 realize_basic_faces (f) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5301 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5302 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5303 int success_p = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5304 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5305 if (realize_default_face (f)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5306 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5307 realize_named_face (f, Qmode_line, MODE_LINE_FACE_ID); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5308 realize_named_face (f, Qtool_bar, TOOL_BAR_FACE_ID); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5309 realize_named_face (f, Qfringe, BITMAP_AREA_FACE_ID); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5310 realize_named_face (f, Qheader_line, HEADER_LINE_FACE_ID); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5311 realize_named_face (f, Qscroll_bar, SCROLL_BAR_FACE_ID); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5312 realize_named_face (f, Qborder, BORDER_FACE_ID); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5313 realize_named_face (f, Qcursor, CURSOR_FACE_ID); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5314 realize_named_face (f, Qmouse, MOUSE_FACE_ID); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5315 realize_named_face (f, Qmenu, MENU_FACE_ID); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5316 success_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5317 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5318 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5319 return success_p; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5320 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5321 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5322 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5323 /* Realize the default face on frame F. If the face is not fully |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5324 specified, make it fully-specified. Attributes of the default face |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5325 that are not explicitly specified are taken from frame parameters. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5326 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5327 static int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5328 realize_default_face (f) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5329 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5330 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5331 struct face_cache *c = FRAME_FACE_CACHE (f); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5332 Lisp_Object lface; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5333 Lisp_Object attrs[LFACE_VECTOR_SIZE]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5334 Lisp_Object unibyte_registry; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5335 Lisp_Object frame_font; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5336 struct face *face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5337 int fontset; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5338 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5339 /* If the `default' face is not yet known, create it. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5340 lface = lface_from_face_name (f, Qdefault, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5341 if (NILP (lface)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5342 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5343 Lisp_Object frame; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5344 XSETFRAME (frame, f); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5345 lface = Finternal_make_lisp_face (Qdefault, frame); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5346 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5347 |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5348 #ifdef HAVE_WINDOW_SYSTEM |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5349 if (FRAME_WINDOW_P (f)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5350 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5351 /* Set frame_font to the value of the `font' frame parameter. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5352 frame_font = Fassq (Qfont, f->param_alist); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5353 xassert (CONSP (frame_font) && STRINGP (XCDR (frame_font))); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5354 frame_font = XCDR (frame_font); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5355 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5356 fontset = fs_query_fontset (f, XSTRING (frame_font)->data); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5357 if (fontset >= 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5358 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5359 /* If frame_font is a fontset name, don't use that for |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5360 determining font-related attributes of the default face |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5361 because it is just an artificial name. Use the ASCII font of |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5362 the fontset, instead. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5363 struct font_info *font_info; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5364 struct font_name font; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5365 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5366 BLOCK_INPUT; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5367 font_info = FS_LOAD_FONT (f, FRAME_W32_FONT_TABLE (f), CHARSET_ASCII, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5368 NULL, fontset); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5369 UNBLOCK_INPUT; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5370 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5371 /* Set weight etc. from the ASCII font. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5372 if (!set_lface_from_font_name (f, lface, font_info->full_name, 0, 0)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5373 return 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5374 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5375 /* Remember registry and encoding of the frame font. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5376 unibyte_registry = deduce_unibyte_registry (f, font_info->full_name); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5377 if (STRINGP (unibyte_registry)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5378 Vface_default_registry = unibyte_registry; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5379 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5380 Vface_default_registry = build_string ("iso8859-1"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5381 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5382 /* But set the family to the fontset alias name. Implementation |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5383 note: When a font is passed to Emacs via `-fn FONT', a |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5384 fontset is created in `x-win.el' whose name ends in |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5385 `fontset-startup'. This fontset has an alias name that is |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5386 equal to frame_font. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5387 xassert (STRINGP (frame_font)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5388 font.name = LSTRDUPA (frame_font); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5389 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5390 if (!split_font_name (f, &font, 1) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5391 || xstricmp (font.fields[XLFD_REGISTRY], "fontset") != 0 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5392 || xstricmp (font.fields[XLFD_ENCODING], "startup") != 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5393 LFACE_FAMILY (lface) = frame_font; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5394 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5395 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5396 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5397 /* Frame parameters contain a real font. Fill default face |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5398 attributes from that font. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5399 if (!set_lface_from_font_name (f, lface, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5400 XSTRING (frame_font)->data, 0, 0)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5401 return 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5402 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5403 /* Remember registry and encoding of the frame font. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5404 unibyte_registry |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5405 = deduce_unibyte_registry (f, XSTRING (frame_font)->data); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5406 if (STRINGP (unibyte_registry)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5407 Vface_default_registry = unibyte_registry; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5408 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5409 Vface_default_registry = build_string ("iso8859-1"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5410 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5411 } |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5412 #endif /* HAVE_WINDOW_SYSTEM */ |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5413 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5414 if (!FRAME_WINDOW_P (f)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5415 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5416 LFACE_FAMILY (lface) = build_string ("default"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5417 LFACE_SWIDTH (lface) = Qnormal; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5418 LFACE_HEIGHT (lface) = make_number (1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5419 LFACE_WEIGHT (lface) = Qnormal; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5420 LFACE_SLANT (lface) = Qnormal; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5421 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5422 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5423 if (UNSPECIFIEDP (LFACE_UNDERLINE (lface))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5424 LFACE_UNDERLINE (lface) = Qnil; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5425 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5426 if (UNSPECIFIEDP (LFACE_OVERLINE (lface))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5427 LFACE_OVERLINE (lface) = Qnil; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5428 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5429 if (UNSPECIFIEDP (LFACE_STRIKE_THROUGH (lface))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5430 LFACE_STRIKE_THROUGH (lface) = Qnil; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5431 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5432 if (UNSPECIFIEDP (LFACE_BOX (lface))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5433 LFACE_BOX (lface) = Qnil; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5434 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5435 if (UNSPECIFIEDP (LFACE_INVERSE (lface))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5436 LFACE_INVERSE (lface) = Qnil; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5437 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5438 if (UNSPECIFIEDP (LFACE_FOREGROUND (lface))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5439 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5440 /* This function is called so early that colors are not yet |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5441 set in the frame parameter list. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5442 Lisp_Object color = Fassq (Qforeground_color, f->param_alist); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5443 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5444 if (CONSP (color) && STRINGP (XCDR (color))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5445 LFACE_FOREGROUND (lface) = XCDR (color); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5446 else if (FRAME_WINDOW_P (f)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5447 return 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5448 else if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5449 LFACE_FOREGROUND (lface) = build_string (unspecified_fg); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5450 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5451 abort (); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5452 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5453 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5454 if (UNSPECIFIEDP (LFACE_BACKGROUND (lface))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5455 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5456 /* This function is called so early that colors are not yet |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5457 set in the frame parameter list. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5458 Lisp_Object color = Fassq (Qbackground_color, f->param_alist); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5459 if (CONSP (color) && STRINGP (XCDR (color))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5460 LFACE_BACKGROUND (lface) = XCDR (color); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5461 else if (FRAME_WINDOW_P (f)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5462 return 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5463 else if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5464 LFACE_BACKGROUND (lface) = build_string (unspecified_bg); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5465 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5466 abort (); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5467 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5468 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5469 if (UNSPECIFIEDP (LFACE_STIPPLE (lface))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5470 LFACE_STIPPLE (lface) = Qnil; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5471 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5472 /* Realize the face; it must be fully-specified now. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5473 xassert (lface_fully_specified_p (XVECTOR (lface)->contents)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5474 check_lface (lface); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5475 bcopy (XVECTOR (lface)->contents, attrs, sizeof attrs); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5476 face = realize_face (c, attrs, CHARSET_ASCII); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5477 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5478 /* Remove the former default face. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5479 if (c->used > DEFAULT_FACE_ID) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5480 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5481 struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5482 uncache_face (c, default_face); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5483 free_realized_face (f, default_face); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5484 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5485 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5486 /* Insert the new default face. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5487 cache_face (c, face, lface_hash (attrs)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5488 xassert (face->id == DEFAULT_FACE_ID); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5489 return 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5490 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5491 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5492 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5493 /* Realize basic faces other than the default face in face cache C. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5494 SYMBOL is the face name, ID is the face id the realized face must |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5495 have. The default face must have been realized already. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5496 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5497 static void |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5498 realize_named_face (f, symbol, id) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5499 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5500 Lisp_Object symbol; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5501 int id; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5502 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5503 struct face_cache *c = FRAME_FACE_CACHE (f); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5504 Lisp_Object lface = lface_from_face_name (f, symbol, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5505 Lisp_Object attrs[LFACE_VECTOR_SIZE]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5506 Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5507 struct face *new_face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5508 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5509 /* The default face must exist and be fully specified. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5510 get_lface_attributes (f, Qdefault, attrs, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5511 check_lface_attrs (attrs); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5512 xassert (lface_fully_specified_p (attrs)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5513 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5514 /* If SYMBOL isn't know as a face, create it. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5515 if (NILP (lface)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5516 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5517 Lisp_Object frame; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5518 XSETFRAME (frame, f); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5519 lface = Finternal_make_lisp_face (symbol, frame); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5520 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5521 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5522 /* Merge SYMBOL's face with the default face. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5523 get_lface_attributes (f, symbol, symbol_attrs, 1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5524 merge_face_vectors (symbol_attrs, attrs); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5525 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5526 /* Realize the face. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5527 new_face = realize_face (c, attrs, CHARSET_ASCII); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5528 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5529 /* Remove the former face. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5530 if (c->used > id) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5531 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5532 struct face *old_face = c->faces_by_id[id]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5533 uncache_face (c, old_face); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5534 free_realized_face (f, old_face); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5535 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5536 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5537 /* Insert the new face. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5538 cache_face (c, new_face, lface_hash (attrs)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5539 xassert (new_face->id == id); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5540 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5541 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5542 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5543 /* Realize the fully-specified face with attributes ATTRS in face |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5544 cache C for character set CHARSET or for unibyte text if CHARSET < |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5545 0. Value is a pointer to the newly created realized face. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5546 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5547 static struct face * |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5548 realize_face (c, attrs, charset) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5549 struct face_cache *c; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5550 Lisp_Object *attrs; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5551 int charset; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5552 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5553 struct face *face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5554 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5555 /* LFACE must be fully specified. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5556 xassert (c != NULL); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5557 check_lface_attrs (attrs); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5558 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5559 if (FRAME_WINDOW_P (c->f)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5560 face = realize_x_face (c, attrs, charset); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5561 else if (FRAME_TERMCAP_P (c->f) || FRAME_MSDOS_P (c->f)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5562 face = realize_tty_face (c, attrs, charset); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5563 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5564 abort (); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5565 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5566 return face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5567 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5568 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5569 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5570 /* Realize the fully-specified face with attributes ATTRS in face |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5571 cache C for character set CHARSET or for unibyte text if CHARSET < |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5572 0. Do it for X frame C->f. Value is a pointer to the newly |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5573 created realized face. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5574 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5575 static struct face * |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5576 realize_x_face (c, attrs, charset) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5577 struct face_cache *c; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5578 Lisp_Object *attrs; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5579 int charset; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5580 { |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5581 #ifdef HAVE_WINDOW_SYSTEM |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5582 struct face *face, *default_face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5583 struct frame *f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5584 Lisp_Object stipple, overline, strike_through, box; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5585 Lisp_Object unibyte_registry; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5586 struct gcpro gcpro1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5587 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5588 xassert (FRAME_WINDOW_P (c->f)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5589 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5590 /* If realizing a face for use in unibyte text, get the X registry |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5591 and encoding to use from Vface_default_registry. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5592 if (charset < 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5593 unibyte_registry = (STRINGP (Vface_default_registry) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5594 ? Vface_default_registry |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5595 : build_string ("iso8859-1")); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5596 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5597 unibyte_registry = Qnil; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5598 GCPRO1 (unibyte_registry); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5599 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5600 /* Allocate a new realized face. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5601 face = make_realized_face (attrs, charset, unibyte_registry); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5602 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5603 f = c->f; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5604 /* Determine the font to use. Most of the time, the font will be |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5605 the same as the font of the default face, so try that first. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5606 default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5607 if (default_face |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5608 && FACE_SUITABLE_FOR_CHARSET_P (default_face, charset) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5609 && lface_same_font_attributes_p (default_face->lface, attrs)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5610 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5611 face->font = default_face->font; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5612 face->fontset = default_face->fontset; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5613 face->font_info_id = default_face->font_info_id; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5614 face->font_name = default_face->font_name; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5615 face->registry = default_face->registry; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5616 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5617 else if (charset >= 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5618 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5619 /* For all charsets, we use our own font selection functions to |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5620 choose a best matching font for the specified face |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5621 attributes. If the face specifies a fontset alias name, the |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5622 fontset determines the font name pattern, otherwise we |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5623 construct a font pattern from face attributes and charset. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5624 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5625 char *font_name = NULL; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5626 int fontset = face_fontset (f, attrs); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5627 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5628 if (fontset < 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5629 font_name = choose_face_font (f, attrs, charset, Qnil); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5630 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5631 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5632 font_name = choose_face_fontset_font (f, attrs, fontset, charset); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5633 fontset = -1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5634 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5635 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5636 load_face_font_or_fontset (f, face, font_name, fontset); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5637 xfree (font_name); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5638 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5639 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5640 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5641 /* Unibyte case, and font is not equal to that of the default |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5642 face. UNIBYTE_REGISTRY is the X registry and encoding the |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5643 font should have. What is a reasonable thing to do if the |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5644 user specified a fontset alias name for the face in this |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5645 case? We choose a font by taking the ASCII font of the |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5646 fontset, but using UNIBYTE_REGISTRY for its registry and |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5647 encoding. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5648 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5649 char *font_name = NULL; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5650 int fontset = face_fontset (f, attrs); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5651 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5652 if (fontset < 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5653 font_name = choose_face_font (f, attrs, charset, unibyte_registry); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5654 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5655 font_name = choose_face_fontset_font (f, attrs, fontset, charset); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5656 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5657 load_face_font_or_fontset (f, face, font_name, -1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5658 xfree (font_name); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5659 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5660 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5661 /* Load colors, and set remaining attributes. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5662 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5663 load_face_colors (f, face, attrs); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5664 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5665 /* Set up box. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5666 box = attrs[LFACE_BOX_INDEX]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5667 if (STRINGP (box)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5668 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5669 /* A simple box of line width 1 drawn in color given by |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5670 the string. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5671 face->box_color = load_color (f, face, attrs[LFACE_BOX_INDEX], |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5672 LFACE_BOX_INDEX); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5673 face->box = FACE_SIMPLE_BOX; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5674 face->box_line_width = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5675 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5676 else if (INTEGERP (box)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5677 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5678 /* Simple box of specified line width in foreground color of the |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5679 face. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5680 xassert (XINT (box) > 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5681 face->box = FACE_SIMPLE_BOX; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5682 face->box_line_width = XFASTINT (box); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5683 face->box_color = face->foreground; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5684 face->box_color_defaulted_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5685 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5686 else if (CONSP (box)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5687 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5688 /* `(:width WIDTH :color COLOR :shadow SHADOW)'. SHADOW |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5689 being one of `raised' or `sunken'. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5690 face->box = FACE_SIMPLE_BOX; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5691 face->box_color = face->foreground; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5692 face->box_color_defaulted_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5693 face->box_line_width = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5694 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5695 while (CONSP (box)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5696 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5697 Lisp_Object keyword, value; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5698 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5699 keyword = XCAR (box); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5700 box = XCDR (box); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5701 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5702 if (!CONSP (box)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5703 break; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5704 value = XCAR (box); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5705 box = XCDR (box); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5706 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5707 if (EQ (keyword, QCline_width)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5708 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5709 if (INTEGERP (value) && XINT (value) > 0) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5710 face->box_line_width = XFASTINT (value); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5711 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5712 else if (EQ (keyword, QCcolor)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5713 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5714 if (STRINGP (value)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5715 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5716 face->box_color = load_color (f, face, value, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5717 LFACE_BOX_INDEX); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5718 face->use_box_color_for_shadows_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5719 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5720 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5721 else if (EQ (keyword, QCstyle)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5722 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5723 if (EQ (value, Qreleased_button)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5724 face->box = FACE_RAISED_BOX; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5725 else if (EQ (value, Qpressed_button)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5726 face->box = FACE_SUNKEN_BOX; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5727 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5728 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5729 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5730 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5731 /* Text underline, overline, strike-through. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5732 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5733 if (EQ (attrs[LFACE_UNDERLINE_INDEX], Qt)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5734 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5735 /* Use default color (same as foreground color). */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5736 face->underline_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5737 face->underline_defaulted_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5738 face->underline_color = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5739 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5740 else if (STRINGP (attrs[LFACE_UNDERLINE_INDEX])) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5741 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5742 /* Use specified color. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5743 face->underline_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5744 face->underline_defaulted_p = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5745 face->underline_color |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5746 = load_color (f, face, attrs[LFACE_UNDERLINE_INDEX], |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5747 LFACE_UNDERLINE_INDEX); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5748 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5749 else if (NILP (attrs[LFACE_UNDERLINE_INDEX])) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5750 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5751 face->underline_p = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5752 face->underline_defaulted_p = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5753 face->underline_color = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5754 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5755 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5756 overline = attrs[LFACE_OVERLINE_INDEX]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5757 if (STRINGP (overline)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5758 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5759 face->overline_color |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5760 = load_color (f, face, attrs[LFACE_OVERLINE_INDEX], |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5761 LFACE_OVERLINE_INDEX); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5762 face->overline_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5763 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5764 else if (EQ (overline, Qt)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5765 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5766 face->overline_color = face->foreground; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5767 face->overline_color_defaulted_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5768 face->overline_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5769 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5770 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5771 strike_through = attrs[LFACE_STRIKE_THROUGH_INDEX]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5772 if (STRINGP (strike_through)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5773 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5774 face->strike_through_color |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5775 = load_color (f, face, attrs[LFACE_STRIKE_THROUGH_INDEX], |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5776 LFACE_STRIKE_THROUGH_INDEX); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5777 face->strike_through_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5778 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5779 else if (EQ (strike_through, Qt)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5780 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5781 face->strike_through_color = face->foreground; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5782 face->strike_through_color_defaulted_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5783 face->strike_through_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5784 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5785 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5786 stipple = attrs[LFACE_STIPPLE_INDEX]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5787 if (!NILP (stipple)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5788 face->stipple = load_pixmap (f, stipple, &face->pixmap_w, &face->pixmap_h); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5789 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5790 UNGCPRO; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5791 xassert (face->fontset < 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5792 xassert (FACE_SUITABLE_FOR_CHARSET_P (face, charset)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5793 return face; |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5794 #endif /* HAVE_WINDOW_SYSTEM */ |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5795 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5796 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5797 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5798 /* Realize the fully-specified face with attributes ATTRS in face |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5799 cache C for character set CHARSET or for unibyte text if CHARSET < |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5800 0. Do it for TTY frame C->f. Value is a pointer to the newly |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5801 created realized face. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5802 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5803 static struct face * |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5804 realize_tty_face (c, attrs, charset) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5805 struct face_cache *c; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5806 Lisp_Object *attrs; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5807 int charset; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5808 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5809 struct face *face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5810 int weight, slant; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5811 Lisp_Object color; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5812 Lisp_Object tty_defined_color_alist = |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5813 Fsymbol_value (intern ("tty-defined-color-alist")); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5814 Lisp_Object tty_color_alist = intern ("tty-color-alist"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5815 Lisp_Object frame; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5816 int face_colors_defaulted = 0; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5817 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5818 /* Frame must be a termcap frame. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5819 xassert (FRAME_TERMCAP_P (c->f) || FRAME_MSDOS_P (c->f)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5820 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5821 /* Allocate a new realized face. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5822 face = make_realized_face (attrs, charset, Qnil); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5823 face->font_name = FRAME_MSDOS_P (c->f) ? "ms-dos" : "tty"; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5824 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5825 /* Map face attributes to TTY appearances. We map slant to |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5826 dimmed text because we want italic text to appear differently |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5827 and because dimmed text is probably used infrequently. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5828 weight = face_numeric_weight (attrs[LFACE_WEIGHT_INDEX]); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5829 slant = face_numeric_slant (attrs[LFACE_SLANT_INDEX]); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5830 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5831 if (weight > XLFD_WEIGHT_MEDIUM) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5832 face->tty_bold_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5833 if (weight < XLFD_WEIGHT_MEDIUM || slant != XLFD_SLANT_ROMAN) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5834 face->tty_dim_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5835 if (!NILP (attrs[LFACE_UNDERLINE_INDEX])) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5836 face->tty_underline_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5837 if (!NILP (attrs[LFACE_INVERSE_INDEX])) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5838 face->tty_reverse_p = 1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5839 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5840 /* Map color names to color indices. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5841 face->foreground = FACE_TTY_DEFAULT_FG_COLOR; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5842 face->background = FACE_TTY_DEFAULT_BG_COLOR; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5843 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5844 XSETFRAME (frame, c->f); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5845 color = attrs[LFACE_FOREGROUND_INDEX]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5846 if (STRINGP (color) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5847 && XSTRING (color)->size |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5848 && !NILP (tty_defined_color_alist) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5849 && (color = Fassoc (color, call1 (tty_color_alist, frame)), |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5850 CONSP (color))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5851 /* Associations in tty-defined-color-alist are of the form |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5852 (NAME INDEX R G B). We need the INDEX part. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5853 face->foreground = XINT (XCAR (XCDR (color))); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5854 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5855 if (face->foreground == FACE_TTY_DEFAULT_FG_COLOR |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5856 && STRINGP (attrs[LFACE_FOREGROUND_INDEX])) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5857 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5858 face->foreground = load_color (c->f, face, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5859 attrs[LFACE_FOREGROUND_INDEX], |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5860 LFACE_FOREGROUND_INDEX); |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5861 |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5862 #if defined (MSDOS) || defined (WINDOWSNT) |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5863 /* If the foreground of the default face is the default color, |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5864 use the foreground color defined by the frame. */ |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5865 #ifdef MSDOS |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5866 if (FRAME_MSDOS_P (c->f)) |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5867 { |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5868 #endif /* MSDOS */ |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5869 |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5870 if (face->foreground == FACE_TTY_DEFAULT_FG_COLOR |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5871 || face->foreground == FACE_TTY_DEFAULT_COLOR) |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5872 { |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5873 face->foreground = FRAME_FOREGROUND_PIXEL (c->f); |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5874 attrs[LFACE_FOREGROUND_INDEX] = |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5875 tty_color_name (c->f, face->foreground); |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5876 face_colors_defaulted = 1; |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5877 } |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5878 else if (face->foreground == FACE_TTY_DEFAULT_BG_COLOR) |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5879 { |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5880 face->foreground = FRAME_BACKGROUND_PIXEL (c->f); |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5881 attrs[LFACE_FOREGROUND_INDEX] = |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5882 tty_color_name (c->f, face->foreground); |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5883 face_colors_defaulted = 1; |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5884 } |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5885 #ifdef MSDOS |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5886 } |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5887 #endif /* MSDOS */ |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5888 #endif /* MSDOS or WINDOWSNT */ |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5889 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5890 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5891 color = attrs[LFACE_BACKGROUND_INDEX]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5892 if (STRINGP (color) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5893 && XSTRING (color)->size |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5894 && !NILP (tty_defined_color_alist) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5895 && (color = Fassoc (color, call1 (tty_color_alist, frame)), |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5896 CONSP (color))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5897 /* Associations in tty-defined-color-alist are of the form |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5898 (NAME INDEX R G B). We need the INDEX part. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5899 face->background = XINT (XCAR (XCDR (color))); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5900 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5901 if (face->background == FACE_TTY_DEFAULT_BG_COLOR |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5902 && STRINGP (attrs[LFACE_BACKGROUND_INDEX])) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5903 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5904 face->background = load_color (c->f, face, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5905 attrs[LFACE_BACKGROUND_INDEX], |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5906 LFACE_BACKGROUND_INDEX); |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5907 #if defined (MSDOS) || defined (WINDOWSNT) |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5908 /* If the background of the default face is the default color, |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5909 use the background color defined by the frame. */ |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5910 #ifdef MSDOS |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5911 if (FRAME_MSDOS_P (c->f)) |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5912 { |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5913 #endif /* MSDOS */ |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5914 |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5915 if (face->background == FACE_TTY_DEFAULT_BG_COLOR |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5916 || face->background == FACE_TTY_DEFAULT_COLOR) |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5917 { |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5918 face->background = FRAME_BACKGROUND_PIXEL (c->f); |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5919 attrs[LFACE_BACKGROUND_INDEX] = |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5920 tty_color_name (c->f, face->background); |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5921 face_colors_defaulted = 1; |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5922 } |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5923 else if (face->background == FACE_TTY_DEFAULT_FG_COLOR) |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5924 { |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5925 face->background = FRAME_FOREGROUND_PIXEL (c->f); |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5926 attrs[LFACE_BACKGROUND_INDEX] = |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5927 tty_color_name (c->f, face->background); |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5928 face_colors_defaulted = 1; |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5929 } |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5930 #ifdef MSDOS |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5931 } |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5932 #endif /* MSDOS */ |
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
5933 #endif /* MSDOS or WINDOWSNT */ |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5934 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5935 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5936 /* Swap colors if face is inverse-video. If the colors are taken |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5937 from the frame colors, they are already inverted, since the |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5938 frame-creation function calls x-handle-reverse-video. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5939 if (face->tty_reverse_p && !face_colors_defaulted) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5940 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5941 unsigned long tem = face->foreground; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5942 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5943 face->foreground = face->background; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5944 face->background = tem; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5945 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5946 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5947 return face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5948 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5949 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5950 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5951 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5952 /*********************************************************************** |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5953 Computing Faces |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5954 ***********************************************************************/ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5955 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5956 /* Return the ID of the face to use to display character CH with face |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5957 property PROP on frame F in current_buffer. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5958 |
13434 | 5959 int |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5960 compute_char_face (f, ch, prop) |
13434 | 5961 struct frame *f; |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5962 int ch; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5963 Lisp_Object prop; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5964 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5965 int face_id; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5966 int charset = (NILP (current_buffer->enable_multibyte_characters) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5967 ? -1 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5968 : CHAR_CHARSET (ch)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5969 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5970 if (NILP (prop)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5971 face_id = FACE_FOR_CHARSET (f, DEFAULT_FACE_ID, charset); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5972 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5973 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5974 Lisp_Object attrs[LFACE_VECTOR_SIZE]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5975 struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5976 bcopy (default_face->lface, attrs, sizeof attrs); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5977 merge_face_vector_with_property (f, attrs, prop); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5978 face_id = lookup_face (f, attrs, charset); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5979 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5980 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5981 return face_id; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5982 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5983 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5984 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5985 /* Return the face ID associated with buffer position POS for |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5986 displaying ASCII characters. Return in *ENDPTR the position at |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5987 which a different face is needed, as far as text properties and |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5988 overlays are concerned. W is a window displaying current_buffer. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5989 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5990 REGION_BEG, REGION_END delimit the region, so it can be |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5991 highlighted. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5992 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5993 LIMIT is a position not to scan beyond. That is to limit the time |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5994 this function can take. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5995 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5996 If MOUSE is non-zero, use the character's mouse-face, not its face. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5997 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5998 The face returned is suitable for displaying CHARSET_ASCII if |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
5999 current_buffer->enable_multibyte_characters is non-nil. Otherwise, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6000 the face is suitable for displaying unibyte text. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6001 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6002 int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6003 face_at_buffer_position (w, pos, region_beg, region_end, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6004 endptr, limit, mouse) |
13434 | 6005 struct window *w; |
6006 int pos; | |
6007 int region_beg, region_end; | |
6008 int *endptr; | |
6009 int limit; | |
6010 int mouse; | |
6011 { | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6012 struct frame *f = XFRAME (w->frame); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6013 Lisp_Object attrs[LFACE_VECTOR_SIZE]; |
13434 | 6014 Lisp_Object prop, position; |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6015 int i, noverlays; |
13434 | 6016 Lisp_Object *overlay_vec; |
6017 Lisp_Object frame; | |
6018 int endpos; | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6019 Lisp_Object propname = mouse ? Qmouse_face : Qface; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6020 Lisp_Object limit1, end; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6021 struct face *default_face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6022 int multibyte_p = !NILP (current_buffer->enable_multibyte_characters); |
13434 | 6023 |
6024 /* W must display the current buffer. We could write this function | |
6025 to use the frame and buffer of W, but right now it doesn't. */ | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6026 /* xassert (XBUFFER (w->buffer) == current_buffer); */ |
13434 | 6027 |
6028 XSETFRAME (frame, f); | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6029 XSETFASTINT (position, pos); |
13434 | 6030 |
6031 endpos = ZV; | |
6032 if (pos < region_beg && region_beg < endpos) | |
6033 endpos = region_beg; | |
6034 | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6035 /* Get the `face' or `mouse_face' text property at POS, and |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6036 determine the next position at which the property changes. */ |
13434 | 6037 prop = Fget_text_property (position, propname, w->buffer); |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6038 XSETFASTINT (limit1, (limit < endpos ? limit : endpos)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6039 end = Fnext_single_property_change (position, propname, w->buffer, limit1); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6040 if (INTEGERP (end)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6041 endpos = XINT (end); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6042 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6043 /* Look at properties from overlays. */ |
13434 | 6044 { |
6045 int next_overlay; | |
6046 int len; | |
6047 | |
6048 /* First try with room for 40 overlays. */ | |
6049 len = 40; | |
6050 overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object)); | |
6051 noverlays = overlays_at (pos, 0, &overlay_vec, &len, | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6052 &next_overlay, NULL); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6053 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6054 /* If there are more than 40, make enough space for all, and try |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6055 again. */ |
13434 | 6056 if (noverlays > len) |
6057 { | |
6058 len = noverlays; | |
6059 overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object)); | |
6060 noverlays = overlays_at (pos, 0, &overlay_vec, &len, | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6061 &next_overlay, NULL); |
13434 | 6062 } |
6063 | |
6064 if (next_overlay < endpos) | |
6065 endpos = next_overlay; | |
6066 } | |
6067 | |
6068 *endptr = endpos; | |
6069 | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6070 default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6071 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6072 /* Optimize common cases where we can use the default face. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6073 if (noverlays == 0 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6074 && NILP (prop) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6075 && !(pos >= region_beg && pos < region_end) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6076 && (multibyte_p |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6077 || !FRAME_WINDOW_P (f) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6078 || FACE_SUITABLE_FOR_CHARSET_P (default_face, -1))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6079 return DEFAULT_FACE_ID; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6080 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6081 /* Begin with attributes from the default face. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6082 bcopy (default_face->lface, attrs, sizeof attrs); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6083 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6084 /* Merge in attributes specified via text properties. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6085 if (!NILP (prop)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6086 merge_face_vector_with_property (f, attrs, prop); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6087 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6088 /* Now merge the overlay data. */ |
13434 | 6089 noverlays = sort_overlays (overlay_vec, noverlays, w); |
6090 for (i = 0; i < noverlays; i++) | |
6091 { | |
21607
59159a81b101
(Qforeground_color, Qbackground_color): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
6092 Lisp_Object oend; |
59159a81b101
(Qforeground_color, Qbackground_color): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
6093 int oendpos; |
13434 | 6094 |
21607
59159a81b101
(Qforeground_color, Qbackground_color): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
6095 prop = Foverlay_get (overlay_vec[i], propname); |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6096 if (!NILP (prop)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6097 merge_face_vector_with_property (f, attrs, prop); |
13434 | 6098 |
21607
59159a81b101
(Qforeground_color, Qbackground_color): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
6099 oend = OVERLAY_END (overlay_vec[i]); |
59159a81b101
(Qforeground_color, Qbackground_color): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
6100 oendpos = OVERLAY_POSITION (oend); |
59159a81b101
(Qforeground_color, Qbackground_color): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
6101 if (oendpos < endpos) |
59159a81b101
(Qforeground_color, Qbackground_color): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
6102 endpos = oendpos; |
13434 | 6103 } |
6104 | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6105 /* If in the region, merge in the region face. */ |
13434 | 6106 if (pos >= region_beg && pos < region_end) |
6107 { | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6108 Lisp_Object region_face = lface_from_face_name (f, Qregion, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6109 merge_face_vectors (XVECTOR (region_face)->contents, attrs); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6110 |
13434 | 6111 if (region_end < endpos) |
6112 endpos = region_end; | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6113 } |
13434 | 6114 |
6115 *endptr = endpos; | |
6116 | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6117 /* Look up a realized face with the given face attributes, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6118 or realize a new one. Charset is ignored for tty frames. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6119 return lookup_face (f, attrs, multibyte_p ? CHARSET_ASCII : -1); |
13434 | 6120 } |
21607
59159a81b101
(Qforeground_color, Qbackground_color): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
6121 |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6122 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6123 /* Compute the face at character position POS in Lisp string STRING on |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6124 window W, for charset CHARSET_ASCII. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6125 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6126 If STRING is an overlay string, it comes from position BUFPOS in |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6127 current_buffer, otherwise BUFPOS is zero to indicate that STRING is |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6128 not an overlay string. W must display the current buffer. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6129 REGION_BEG and REGION_END give the start and end positions of the |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6130 region; both are -1 if no region is visible. BASE_FACE_ID is the |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6131 id of the basic face to merge with. It is usually equal to |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6132 DEFAULT_FACE_ID but can be MODE_LINE_FACE_ID or HEADER_LINE_FACE_ID |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6133 for strings displayed in the mode or top line. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6134 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6135 Set *ENDPTR to the next position where to check for faces in |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6136 STRING; -1 if the face is constant from POS to the end of the |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6137 string. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6138 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6139 Value is the id of the face to use. The face returned is suitable |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6140 for displaying CHARSET_ASCII if STRING is multibyte. Otherwise, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6141 the face is suitable for displaying unibyte text. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6142 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6143 int |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6144 face_at_string_position (w, string, pos, bufpos, region_beg, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6145 region_end, endptr, base_face_id) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6146 struct window *w; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6147 Lisp_Object string; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6148 int pos, bufpos; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6149 int region_beg, region_end; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6150 int *endptr; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6151 enum face_id base_face_id; |
21607
59159a81b101
(Qforeground_color, Qbackground_color): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
6152 { |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6153 Lisp_Object prop, position, end, limit; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6154 struct frame *f = XFRAME (WINDOW_FRAME (w)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6155 Lisp_Object attrs[LFACE_VECTOR_SIZE]; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6156 struct face *base_face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6157 int multibyte_p = STRING_MULTIBYTE (string); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6158 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6159 /* Get the value of the face property at the current position within |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6160 STRING. Value is nil if there is no face property. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6161 XSETFASTINT (position, pos); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6162 prop = Fget_text_property (position, Qface, string); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6163 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6164 /* Get the next position at which to check for faces. Value of end |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6165 is nil if face is constant all the way to the end of the string. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6166 Otherwise it is a string position where to check faces next. |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6167 Limit is the maximum position up to which to check for property |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6168 changes in Fnext_single_property_change. Strings are usually |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6169 short, so set the limit to the end of the string. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6170 XSETFASTINT (limit, XSTRING (string)->size); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6171 end = Fnext_single_property_change (position, Qface, string, limit); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6172 if (INTEGERP (end)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6173 *endptr = XFASTINT (end); |
21607
59159a81b101
(Qforeground_color, Qbackground_color): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
6174 else |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6175 *endptr = -1; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6176 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6177 base_face = FACE_FROM_ID (f, base_face_id); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6178 xassert (base_face); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6179 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6180 /* Optimize the default case that there is no face property and we |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6181 are not in the region. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6182 if (NILP (prop) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6183 && (base_face_id != DEFAULT_FACE_ID |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6184 /* BUFPOS <= 0 means STRING is not an overlay string, so |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6185 that the region doesn't have to be taken into account. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6186 || bufpos <= 0 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6187 || bufpos < region_beg |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6188 || bufpos >= region_end) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6189 && (multibyte_p |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6190 /* We can't realize faces for different charsets differently |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6191 if we don't have fonts, so we can stop here if not working |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6192 on a window-system frame. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6193 || !FRAME_WINDOW_P (f) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6194 || FACE_SUITABLE_FOR_CHARSET_P (base_face, -1))) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6195 return base_face->id; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6196 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6197 /* Begin with attributes from the base face. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6198 bcopy (base_face->lface, attrs, sizeof attrs); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6199 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6200 /* Merge in attributes specified via text properties. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6201 if (!NILP (prop)) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6202 merge_face_vector_with_property (f, attrs, prop); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6203 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6204 /* If in the region, merge in the region face. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6205 if (bufpos |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6206 && bufpos >= region_beg |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6207 && bufpos < region_end) |
21607
59159a81b101
(Qforeground_color, Qbackground_color): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
6208 { |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6209 Lisp_Object region_face = lface_from_face_name (f, Qregion, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6210 merge_face_vectors (XVECTOR (region_face)->contents, attrs); |
21607
59159a81b101
(Qforeground_color, Qbackground_color): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
6211 } |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6212 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6213 /* Look up a realized face with the given face attributes, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6214 or realize a new one. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6215 return lookup_face (f, attrs, multibyte_p ? CHARSET_ASCII : -1); |
13434 | 6216 } |
6217 | |
6218 | |
6219 | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6220 /*********************************************************************** |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6221 Tests |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6222 ***********************************************************************/ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6223 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6224 #if GLYPH_DEBUG |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6225 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6226 /* Print the contents of the realized face FACE to stderr. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6227 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6228 static void |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6229 dump_realized_face (face) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6230 struct face *face; |
13434 | 6231 { |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6232 fprintf (stderr, "ID: %d\n", face->id); |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
6233 #ifdef HAVE_WINDOW_SYSTEM |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6234 fprintf (stderr, "gc: %d\n", (int) face->gc); |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
6235 #endif |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6236 fprintf (stderr, "foreground: 0x%lx (%s)\n", |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6237 face->foreground, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6238 XSTRING (face->lface[LFACE_FOREGROUND_INDEX])->data); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6239 fprintf (stderr, "background: 0x%lx (%s)\n", |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6240 face->background, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6241 XSTRING (face->lface[LFACE_BACKGROUND_INDEX])->data); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6242 fprintf (stderr, "font_name: %s (%s)\n", |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6243 face->font_name, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6244 XSTRING (face->lface[LFACE_FAMILY_INDEX])->data); |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
6245 #ifdef HAVE_WINDOW_SYSTEM |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6246 fprintf (stderr, "font = %p\n", face->font); |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
6247 #endif |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6248 fprintf (stderr, "font_info_id = %d\n", face->font_info_id); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6249 fprintf (stderr, "fontset: %d\n", face->fontset); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6250 fprintf (stderr, "underline: %d (%s)\n", |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6251 face->underline_p, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6252 XSTRING (Fsymbol_name (face->lface[LFACE_UNDERLINE_INDEX]))->data); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6253 fprintf (stderr, "hash: %d\n", face->hash); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6254 fprintf (stderr, "charset: %d\n", face->charset); |
13434 | 6255 } |
6256 | |
6257 | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6258 DEFUN ("dump-face", Fdump_face, Sdump_face, 0, 1, 0, "") |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6259 (n) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6260 Lisp_Object n; |
13434 | 6261 { |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6262 if (NILP (n)) |
13434 | 6263 { |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6264 int i; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6265 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6266 fprintf (stderr, "font selection order: "); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6267 for (i = 0; i < DIM (font_sort_order); ++i) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6268 fprintf (stderr, "%d ", font_sort_order[i]); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6269 fprintf (stderr, "\n"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6270 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6271 fprintf (stderr, "alternative fonts: "); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6272 debug_print (Vface_alternative_font_family_alist); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6273 fprintf (stderr, "\n"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6274 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6275 for (i = 0; i < FRAME_FACE_CACHE (SELECTED_FRAME ())->used; ++i) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6276 Fdump_face (make_number (i)); |
13434 | 6277 } |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6278 else |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6279 { |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6280 struct face *face; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6281 CHECK_NUMBER (n, 0); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6282 face = FACE_FROM_ID (SELECTED_FRAME (), XINT (n)); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6283 if (face == NULL) |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6284 error ("Not a valid face"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6285 dump_realized_face (face); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6286 } |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6287 |
13434 | 6288 return Qnil; |
6289 } | |
6290 | |
6291 | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6292 DEFUN ("show-face-resources", Fshow_face_resources, Sshow_face_resources, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6293 0, 0, 0, "") |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6294 () |
13434 | 6295 { |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6296 fprintf (stderr, "number of colors = %d\n", ncolors_allocated); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6297 fprintf (stderr, "number of pixmaps = %d\n", npixmaps_allocated); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6298 fprintf (stderr, "number of GCs = %d\n", ngcs); |
13434 | 6299 return Qnil; |
6300 } | |
6301 | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6302 #endif /* GLYPH_DEBUG != 0 */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6303 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6304 |
13434 | 6305 |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6306 /*********************************************************************** |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6307 Initialization |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6308 ***********************************************************************/ |
13434 | 6309 |
6310 void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16051
diff
changeset
|
6311 syms_of_w32faces () |
13434 | 6312 { |
6313 Qface = intern ("face"); | |
6314 staticpro (&Qface); | |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6315 Qbitmap_spec_p = intern ("bitmap-spec-p"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6316 staticpro (&Qbitmap_spec_p); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6317 Qframe_update_face_colors = intern ("frame-update-face-colors"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6318 staticpro (&Qframe_update_face_colors); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6319 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6320 /* Lisp face attribute keywords. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6321 QCfamily = intern (":family"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6322 staticpro (&QCfamily); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6323 QCheight = intern (":height"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6324 staticpro (&QCheight); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6325 QCweight = intern (":weight"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6326 staticpro (&QCweight); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6327 QCslant = intern (":slant"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6328 staticpro (&QCslant); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6329 QCunderline = intern (":underline"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6330 staticpro (&QCunderline); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6331 QCinverse_video = intern (":inverse-video"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6332 staticpro (&QCinverse_video); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6333 QCreverse_video = intern (":reverse-video"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6334 staticpro (&QCreverse_video); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6335 QCforeground = intern (":foreground"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6336 staticpro (&QCforeground); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6337 QCbackground = intern (":background"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6338 staticpro (&QCbackground); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6339 QCstipple = intern (":stipple");; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6340 staticpro (&QCstipple); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6341 QCwidth = intern (":width"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6342 staticpro (&QCwidth); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6343 QCfont = intern (":font"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6344 staticpro (&QCfont); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6345 QCbold = intern (":bold"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6346 staticpro (&QCbold); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6347 QCitalic = intern (":italic"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6348 staticpro (&QCitalic); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6349 QCoverline = intern (":overline"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6350 staticpro (&QCoverline); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6351 QCstrike_through = intern (":strike-through"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6352 staticpro (&QCstrike_through); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6353 QCbox = intern (":box"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6354 staticpro (&QCbox); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6355 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6356 /* Symbols used for Lisp face attribute values. */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6357 QCcolor = intern (":color"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6358 staticpro (&QCcolor); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6359 QCline_width = intern (":line-width"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6360 staticpro (&QCline_width); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6361 QCstyle = intern (":style"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6362 staticpro (&QCstyle); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6363 Qreleased_button = intern ("released-button"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6364 staticpro (&Qreleased_button); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6365 Qpressed_button = intern ("pressed-button"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6366 staticpro (&Qpressed_button); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6367 Qnormal = intern ("normal"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6368 staticpro (&Qnormal); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6369 Qultra_light = intern ("ultra-light"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6370 staticpro (&Qultra_light); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6371 Qextra_light = intern ("extra-light"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6372 staticpro (&Qextra_light); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6373 Qlight = intern ("light"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6374 staticpro (&Qlight); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6375 Qsemi_light = intern ("semi-light"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6376 staticpro (&Qsemi_light); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6377 Qsemi_bold = intern ("semi-bold"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6378 staticpro (&Qsemi_bold); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6379 Qbold = intern ("bold"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6380 staticpro (&Qbold); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6381 Qextra_bold = intern ("extra-bold"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6382 staticpro (&Qextra_bold); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6383 Qultra_bold = intern ("ultra-bold"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6384 staticpro (&Qultra_bold); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6385 Qoblique = intern ("oblique"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6386 staticpro (&Qoblique); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6387 Qitalic = intern ("italic"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6388 staticpro (&Qitalic); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6389 Qreverse_oblique = intern ("reverse-oblique"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6390 staticpro (&Qreverse_oblique); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6391 Qreverse_italic = intern ("reverse-italic"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6392 staticpro (&Qreverse_italic); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6393 Qultra_condensed = intern ("ultra-condensed"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6394 staticpro (&Qultra_condensed); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6395 Qextra_condensed = intern ("extra-condensed"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6396 staticpro (&Qextra_condensed); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6397 Qcondensed = intern ("condensed"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6398 staticpro (&Qcondensed); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6399 Qsemi_condensed = intern ("semi-condensed"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6400 staticpro (&Qsemi_condensed); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6401 Qsemi_expanded = intern ("semi-expanded"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6402 staticpro (&Qsemi_expanded); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6403 Qexpanded = intern ("expanded"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6404 staticpro (&Qexpanded); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6405 Qextra_expanded = intern ("extra-expanded"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6406 staticpro (&Qextra_expanded); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6407 Qultra_expanded = intern ("ultra-expanded"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6408 staticpro (&Qultra_expanded); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6409 Qbackground_color = intern ("background-color"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6410 staticpro (&Qbackground_color); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6411 Qforeground_color = intern ("foreground-color"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6412 staticpro (&Qforeground_color); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6413 Qunspecified = intern ("unspecified"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6414 staticpro (&Qunspecified); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6415 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6416 Qx_charset_registry = intern ("x-charset-registry"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6417 staticpro (&Qx_charset_registry); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6418 Qface_alias = intern ("face-alias"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6419 staticpro (&Qface_alias); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6420 Qdefault = intern ("default"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6421 staticpro (&Qdefault); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6422 Qtool_bar = intern ("tool-bar"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6423 staticpro (&Qtool_bar); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6424 Qregion = intern ("region"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6425 staticpro (&Qregion); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6426 Qfringe = intern ("fringe"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6427 staticpro (&Qfringe); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6428 Qheader_line = intern ("header-line"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6429 staticpro (&Qheader_line); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6430 Qscroll_bar = intern ("scroll-bar"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6431 staticpro (&Qscroll_bar); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6432 Qmenu = intern ("menu"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6433 staticpro (&Qmenu); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6434 Qcursor = intern ("cursor"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6435 staticpro (&Qcursor); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6436 Qborder = intern ("border"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6437 staticpro (&Qborder); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6438 Qmouse = intern ("mouse"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6439 staticpro (&Qmouse); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6440 Qtty_color_desc = intern ("tty-color-desc"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6441 staticpro (&Qtty_color_desc); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6442 Qtty_color_by_index = intern ("tty-color-by-index"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6443 staticpro (&Qtty_color_by_index); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6444 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6445 defsubr (&Sinternal_make_lisp_face); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6446 defsubr (&Sinternal_lisp_face_p); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6447 defsubr (&Sinternal_set_lisp_face_attribute); |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
6448 #ifdef HAVE_WINDOW_SYSTEM |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6449 defsubr (&Sinternal_set_lisp_face_attribute_from_resource); |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
6450 #endif |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6451 defsubr (&Scolor_gray_p); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6452 defsubr (&Scolor_supported_p); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6453 defsubr (&Sinternal_get_lisp_face_attribute); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6454 defsubr (&Sinternal_lisp_face_attribute_values); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6455 defsubr (&Sinternal_lisp_face_equal_p); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6456 defsubr (&Sinternal_lisp_face_empty_p); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6457 defsubr (&Sinternal_copy_lisp_face); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6458 defsubr (&Sinternal_merge_in_global_face); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6459 defsubr (&Sface_font); |
13434 | 6460 defsubr (&Sframe_face_alist); |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6461 defsubr (&Sinternal_set_font_selection_order); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6462 defsubr (&Sinternal_set_alternative_font_family_alist); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6463 #if GLYPH_DEBUG |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6464 defsubr (&Sdump_face); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6465 defsubr (&Sshow_face_resources); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6466 #endif /* GLYPH_DEBUG */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6467 defsubr (&Sclear_face_cache); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6468 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6469 DEFVAR_LISP ("font-list-limit", &Vfont_list_limit, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6470 "*Limit for font matching.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6471 If an integer > 0, font matching functions won't load more than\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6472 that number of fonts when searching for a matching font."); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6473 Vfont_list_limit = make_number (DEFAULT_FONT_LIST_LIMIT); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6474 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6475 DEFVAR_LISP ("face-new-frame-defaults", &Vface_new_frame_defaults, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6476 "List of global face definitions (for internal use only.)"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6477 Vface_new_frame_defaults = Qnil; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6478 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6479 DEFVAR_LISP ("face-default-stipple", &Vface_default_stipple, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6480 "*Default stipple pattern used on monochrome displays.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6481 This stipple pattern is used on monochrome displays\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6482 instead of shades of gray for a face background color.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6483 See `set-face-stipple' for possible values for this variable."); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6484 Vface_default_stipple = build_string ("gray3"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6485 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6486 DEFVAR_LISP ("face-default-registry", &Vface_default_registry, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6487 "Default registry and encoding to use.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6488 This registry and encoding is used for unibyte text. It is set up\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6489 from the specified frame font when Emacs starts. (For internal use only.)"); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6490 Vface_default_registry = Qnil; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6491 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6492 DEFVAR_LISP ("face-alternative-font-family-alist", |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6493 &Vface_alternative_font_family_alist, ""); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6494 Vface_alternative_font_family_alist = Qnil; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6495 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6496 #if SCALABLE_FONTS |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6497 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6498 DEFVAR_LISP ("scalable-fonts-allowed", &Vscalable_fonts_allowed, |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6499 "Allowed scalable fonts.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6500 A value of nil means don't allow any scalable fonts.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6501 A value of t means allow any scalable font.\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6502 Otherwise, value must be a list of regular expressions. A font may be\n\ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6503 scaled if its name matches a regular expression in the list."); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6504 Vscalable_fonts_allowed = Qt; |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6505 |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6506 #endif /* SCALABLE_FONTS */ |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6507 |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
6508 #ifdef HAVE_WINDOW_SYSTEM |
27396
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6509 defsubr (&Sbitmap_spec_p); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6510 defsubr (&Sx_list_fonts); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6511 defsubr (&Sinternal_face_x_get_resource); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6512 defsubr (&Sx_family_fonts); |
323eb9ca333f
Complete rewrite based on xfaces.c
Jason Rumney <jasonr@gnu.org>
parents:
26088
diff
changeset
|
6513 defsubr (&Sx_font_family_list); |
27517
d0c413d1b2c2
Merge more of DOS and X specifics in preparation for merge with xfaces.c.
Jason Rumney <jasonr@gnu.org>
parents:
27396
diff
changeset
|
6514 #endif /* HAVE_WINDOW_SYSTEM */ |
13434 | 6515 } |