Mercurial > emacs
annotate src/xfont.c @ 95192:042486c3318c
(completion-pcm--find-all-completions): Don't add pseudo-completions.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Thu, 22 May 2008 04:26:41 +0000 |
parents | 1520d3ef2a48 |
children | 55ae253968bc |
rev | line source |
---|---|
90400 | 1 /* xfont.c -- X core font driver. |
91554
8d25c5588e59
Update copyright years and GPL version.
Glenn Morris <rgm@gnu.org>
parents:
91270
diff
changeset
|
2 Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc. |
8d25c5588e59
Update copyright years and GPL version.
Glenn Morris <rgm@gnu.org>
parents:
91270
diff
changeset
|
3 Copyright (C) 2006, 2007, 2008 |
90400 | 4 National Institute of Advanced Industrial Science and Technology (AIST) |
5 Registration Number H13PRO009 | |
6 | |
7 This file is part of GNU Emacs. | |
8 | |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94940
diff
changeset
|
9 GNU Emacs is free software: you can redistribute it and/or modify |
90400 | 10 it under the terms of the GNU General Public License as published by |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94940
diff
changeset
|
11 the Free Software Foundation, either version 3 of the License, or |
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94940
diff
changeset
|
12 (at your option) any later version. |
90400 | 13 |
14 GNU Emacs is distributed in the hope that it will be useful, | |
15 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 GNU General Public License for more details. | |
18 | |
19 You should have received a copy of the GNU General Public License | |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94940
diff
changeset
|
20 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
90400 | 21 |
22 #include <config.h> | |
23 #include <stdio.h> | |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
24 #include <stdlib.h> |
90400 | 25 #include <X11/Xlib.h> |
26 | |
27 #include "lisp.h" | |
28 #include "dispextern.h" | |
29 #include "xterm.h" | |
30 #include "frame.h" | |
31 #include "blockinput.h" | |
32 #include "character.h" | |
33 #include "charset.h" | |
34 #include "fontset.h" | |
35 #include "font.h" | |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
36 #include "ccl.h" |
90400 | 37 |
38 | |
39 /* X core font driver. */ | |
40 | |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
41 struct xfont_info |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
42 { |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
43 struct font font; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
44 Display *display; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
45 XFontStruct *xfont; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
46 }; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
47 |
90400 | 48 /* Prototypes of support functions. */ |
49 extern void x_clear_errors P_ ((Display *)); | |
50 | |
51 static XCharStruct *xfont_get_pcm P_ ((XFontStruct *, XChar2b *)); | |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
52 static void xfont_find_ccl_program P_ ((struct font *)); |
90400 | 53 |
54 /* Get metrics of character CHAR2B in XFONT. Value is null if CHAR2B | |
55 is not contained in the font. */ | |
56 | |
57 static XCharStruct * | |
58 xfont_get_pcm (xfont, char2b) | |
59 XFontStruct *xfont; | |
60 XChar2b *char2b; | |
61 { | |
62 /* The result metric information. */ | |
63 XCharStruct *pcm = NULL; | |
64 | |
95180
1520d3ef2a48
(xfont_get_pcm): Change xassert to font_assert.
Kenichi Handa <handa@m17n.org>
parents:
94963
diff
changeset
|
65 font_assert (xfont && char2b); |
90400 | 66 |
67 if (xfont->per_char != NULL) | |
68 { | |
69 if (xfont->min_byte1 == 0 && xfont->max_byte1 == 0) | |
70 { | |
71 /* min_char_or_byte2 specifies the linear character index | |
72 corresponding to the first element of the per_char array, | |
73 max_char_or_byte2 is the index of the last character. A | |
74 character with non-zero CHAR2B->byte1 is not in the font. | |
75 A character with byte2 less than min_char_or_byte2 or | |
76 greater max_char_or_byte2 is not in the font. */ | |
77 if (char2b->byte1 == 0 | |
78 && char2b->byte2 >= xfont->min_char_or_byte2 | |
79 && char2b->byte2 <= xfont->max_char_or_byte2) | |
80 pcm = xfont->per_char + char2b->byte2 - xfont->min_char_or_byte2; | |
81 } | |
82 else | |
83 { | |
84 /* If either min_byte1 or max_byte1 are nonzero, both | |
85 min_char_or_byte2 and max_char_or_byte2 are less than | |
86 256, and the 2-byte character index values corresponding | |
87 to the per_char array element N (counting from 0) are: | |
88 | |
89 byte1 = N/D + min_byte1 | |
90 byte2 = N\D + min_char_or_byte2 | |
91 | |
92 where: | |
93 | |
94 D = max_char_or_byte2 - min_char_or_byte2 + 1 | |
95 / = integer division | |
96 \ = integer modulus */ | |
97 if (char2b->byte1 >= xfont->min_byte1 | |
98 && char2b->byte1 <= xfont->max_byte1 | |
99 && char2b->byte2 >= xfont->min_char_or_byte2 | |
100 && char2b->byte2 <= xfont->max_char_or_byte2) | |
101 pcm = (xfont->per_char | |
102 + ((xfont->max_char_or_byte2 - xfont->min_char_or_byte2 + 1) | |
103 * (char2b->byte1 - xfont->min_byte1)) | |
104 + (char2b->byte2 - xfont->min_char_or_byte2)); | |
105 } | |
106 } | |
107 else | |
108 { | |
109 /* If the per_char pointer is null, all glyphs between the first | |
110 and last character indexes inclusive have the same | |
111 information, as given by both min_bounds and max_bounds. */ | |
112 if (char2b->byte2 >= xfont->min_char_or_byte2 | |
113 && char2b->byte2 <= xfont->max_char_or_byte2) | |
114 pcm = &xfont->max_bounds; | |
115 } | |
116 | |
117 return ((pcm == NULL | |
118 || (pcm->width == 0 && (pcm->rbearing - pcm->lbearing) == 0)) | |
119 ? NULL : pcm); | |
120 } | |
121 | |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
122 /* Find a CCL program for a font specified by FONTP, and set the member |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
123 `encoder' of the structure. */ |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
124 |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
125 static void |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
126 xfont_find_ccl_program (font) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
127 struct font *font; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
128 { |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
129 Lisp_Object list, elt; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
130 |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
131 elt = Qnil; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
132 for (list = Vfont_ccl_encoder_alist; CONSP (list); list = XCDR (list)) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
133 { |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
134 elt = XCAR (list); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
135 if (CONSP (elt) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
136 && STRINGP (XCAR (elt)) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
137 && ((fast_string_match_ignore_case (XCAR (elt), |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
138 font->props[FONT_NAME_INDEX]) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
139 >= 0) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
140 || (fast_string_match_ignore_case (XCAR (elt), |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
141 font->props[FONT_FULLNAME_INDEX]) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
142 >= 0))) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
143 break; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
144 } |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
145 |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
146 if (! NILP (list)) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
147 { |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
148 struct ccl_program *ccl |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
149 = (struct ccl_program *) xmalloc (sizeof (struct ccl_program)); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
150 |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
151 if (setup_ccl_program (ccl, XCDR (elt)) < 0) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
152 xfree (ccl); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
153 else |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
154 font->font_encoder = ccl; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
155 } |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
156 } |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
157 |
91245
26541bdcecd0
(xfont_get_cache): Adjust the argument type.
Kenichi Handa <handa@m17n.org>
parents:
91177
diff
changeset
|
158 static Lisp_Object xfont_get_cache P_ ((FRAME_PTR)); |
90400 | 159 static Lisp_Object xfont_list P_ ((Lisp_Object, Lisp_Object)); |
90561
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
160 static Lisp_Object xfont_match P_ ((Lisp_Object, Lisp_Object)); |
90400 | 161 static Lisp_Object xfont_list_family P_ ((Lisp_Object)); |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
162 static Lisp_Object xfont_open P_ ((FRAME_PTR, Lisp_Object, int)); |
90400 | 163 static void xfont_close P_ ((FRAME_PTR, struct font *)); |
164 static int xfont_prepare_face P_ ((FRAME_PTR, struct face *)); | |
165 static int xfont_has_char P_ ((Lisp_Object, int)); | |
166 static unsigned xfont_encode_char P_ ((struct font *, int)); | |
167 static int xfont_text_extents P_ ((struct font *, unsigned *, int, | |
168 struct font_metrics *)); | |
169 static int xfont_draw P_ ((struct glyph_string *, int, int, int, int, int)); | |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
170 static int xfont_check P_ ((FRAME_PTR, struct font *)); |
90400 | 171 |
172 struct font_driver xfont_driver = | |
173 { | |
90698
a31984e21969
(xfont_driver): Initialize ftfont_driver.type by 0.
Kenichi Handa <handa@m17n.org>
parents:
90679
diff
changeset
|
174 0, /* Qx */ |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
175 0, /* case insensitive */ |
90400 | 176 xfont_get_cache, |
177 xfont_list, | |
90561
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
178 xfont_match, |
90400 | 179 xfont_list_family, |
180 NULL, | |
181 xfont_open, | |
182 xfont_close, | |
183 xfont_prepare_face, | |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
184 NULL, |
90400 | 185 xfont_has_char, |
186 xfont_encode_char, | |
187 xfont_text_extents, | |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
188 xfont_draw, |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
189 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
190 xfont_check |
90400 | 191 }; |
192 | |
193 extern Lisp_Object QCname; | |
194 | |
195 static Lisp_Object | |
91245
26541bdcecd0
(xfont_get_cache): Adjust the argument type.
Kenichi Handa <handa@m17n.org>
parents:
91177
diff
changeset
|
196 xfont_get_cache (f) |
26541bdcecd0
(xfont_get_cache): Adjust the argument type.
Kenichi Handa <handa@m17n.org>
parents:
91177
diff
changeset
|
197 FRAME_PTR f; |
90400 | 198 { |
91245
26541bdcecd0
(xfont_get_cache): Adjust the argument type.
Kenichi Handa <handa@m17n.org>
parents:
91177
diff
changeset
|
199 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); |
90400 | 200 |
201 return (dpyinfo->name_list_element); | |
202 } | |
203 | |
204 extern Lisp_Object Vface_alternative_font_registry_alist; | |
205 | |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
206 static int |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
207 compare_font_names (const void *name1, const void *name2) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
208 { |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
209 return strcasecmp (*(const char **) name1, *(const char **) name2); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
210 } |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
211 |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
212 static Lisp_Object xfont_list_pattern P_ ((Lisp_Object, Display *, char *)); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
213 |
90400 | 214 static Lisp_Object |
90501
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
215 xfont_list_pattern (frame, display, pattern) |
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
216 Lisp_Object frame; |
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
217 Display *display; |
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
218 char *pattern; |
90400 | 219 { |
90501
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
220 Lisp_Object list = Qnil; |
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
221 int i, limit, num_fonts; |
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
222 char **names; |
90400 | 223 |
224 BLOCK_INPUT; | |
90501
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
225 x_catch_errors (display); |
90400 | 226 |
90501
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
227 for (limit = 512; ; limit *= 2) |
90400 | 228 { |
90501
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
229 names = XListFonts (display, pattern, limit, &num_fonts); |
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
230 if (x_had_errors_p (display)) |
90400 | 231 { |
232 /* This error is perhaps due to insufficient memory on X | |
233 server. Let's just ignore it. */ | |
90501
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
234 x_clear_errors (display); |
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
235 num_fonts = 0; |
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
236 break; |
90400 | 237 } |
90501
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
238 if (num_fonts < limit) |
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
239 break; |
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
240 XFreeFontNames (names); |
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
241 } |
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
242 |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
243 if (num_fonts > 0) |
90501
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
244 { |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
245 char **indices = alloca (sizeof (char *) * num_fonts); |
90501
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
246 |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
247 for (i = 0; i < num_fonts; i++) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
248 indices[i] = names[i]; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
249 qsort (indices, num_fonts, sizeof (char *), compare_font_names); |
90501
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
250 |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
251 for (i = 0; i < num_fonts; i++) |
90400 | 252 { |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
253 Lisp_Object entity; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
254 int result; |
90501
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
255 |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
256 if (i > 0 && strcasecmp (indices[i - 1], indices[i]) == 0) |
90501
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
257 continue; |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
258 |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
259 entity = font_make_entity (); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
260 ASET (entity, FONT_TYPE_INDEX, Qx); |
90400 | 261 |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
262 result = font_parse_xlfd (indices[i], entity); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
263 if (result < 0) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
264 { |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
265 /* This may be an alias name. Try to get the full XLFD name |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
266 from XA_FONT property of the font. */ |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
267 XFontStruct *font = XLoadQueryFont (display, indices[i]); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
268 unsigned long value; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
269 |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
270 if (! font) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
271 continue; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
272 if (XGetFontProperty (font, XA_FONT, &value)) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
273 { |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
274 char *name = (char *) XGetAtomName (display, (Atom) value); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
275 int len = strlen (name); |
90400 | 276 |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
277 /* If DXPC (a Differential X Protocol Compressor) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
278 Ver.3.7 is running, XGetAtomName will return null |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
279 string. We must avoid such a name. */ |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
280 if (len > 0) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
281 result = font_parse_xlfd (name, entity); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
282 XFree (name); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
283 } |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
284 XFreeFont (display, font); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
285 } |
90501
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
286 |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
287 if (result == 0 |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
288 /* Avoid auto-scaled fonts. */ |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
289 && (XINT (AREF (entity, FONT_DPI_INDEX)) == 0 |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
290 || XINT (AREF (entity, FONT_AVGWIDTH_INDEX)) > 0)) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
291 list = Fcons (entity, list); |
90400 | 292 } |
293 } | |
294 | |
295 x_uncatch_errors (); | |
296 UNBLOCK_INPUT; | |
297 | |
95180
1520d3ef2a48
(xfont_get_pcm): Change xassert to font_assert.
Kenichi Handa <handa@m17n.org>
parents:
94963
diff
changeset
|
298 font_add_log ("xfont-list", build_string (pattern), list); |
90501
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
299 return list; |
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
300 } |
90400 | 301 |
90501
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
302 static Lisp_Object |
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
303 xfont_list (frame, spec) |
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
304 Lisp_Object frame, spec; |
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
305 { |
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
306 FRAME_PTR f = XFRAME (frame); |
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
307 Display *display = FRAME_X_DISPLAY_INFO (f)->display; |
95180
1520d3ef2a48
(xfont_get_pcm): Change xassert to font_assert.
Kenichi Handa <handa@m17n.org>
parents:
94963
diff
changeset
|
308 Lisp_Object registry, list, val, extra; |
90501
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
309 int len; |
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
310 char name[256]; |
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
311 |
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
312 extra = AREF (spec, FONT_EXTRA_INDEX); |
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
313 if (CONSP (extra)) |
90400 | 314 { |
90501
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
315 val = assq_no_quit (QCotf, extra); |
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
316 if (! NILP (val)) |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
317 return Qnil; |
90501
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
318 val = assq_no_quit (QCscript, extra); |
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
319 if (! NILP (val)) |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
320 return Qnil; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
321 val = assq_no_quit (QClang, extra); |
90501
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
322 if (! NILP (val)) |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
323 return Qnil; |
90400 | 324 } |
90501
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
325 |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
326 registry = AREF (spec, FONT_REGISTRY_INDEX); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
327 if (NILP (registry)) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
328 ASET (spec, FONT_REGISTRY_INDEX, Qiso8859_1); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
329 len = font_unparse_xlfd (spec, 0, name, 256); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
330 ASET (spec, FONT_REGISTRY_INDEX, registry); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
331 if (len < 0) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
332 return Qnil; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
333 list = xfont_list_pattern (frame, display, name); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
334 if (NILP (list) && NILP (registry)) |
90400 | 335 { |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
336 /* Try iso10646-1 */ |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
337 char *r = name + len - 9; /* 9 == strlen (iso8859-1) */ |
90501
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
338 |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
339 if (r - name + 10 < 256) /* 10 == strlen (iso10646-1) */ |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
340 { |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
341 strcpy (r, "iso10646-1"); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
342 list = xfont_list_pattern (frame, display, name); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
343 } |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
344 } |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
345 if (NILP (list) && ! NILP (registry)) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
346 { |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
347 Lisp_Object alter; |
90501
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
348 |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
349 if ((alter = Fassoc (SYMBOL_NAME (registry), |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
350 Vface_alternative_font_registry_alist), |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
351 CONSP (alter))) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
352 { |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
353 /* Pointer to REGISTRY-ENCODING field. */ |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
354 char *r = name + len - SBYTES (SYMBOL_NAME (registry)); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
355 |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
356 for (alter = XCDR (alter); CONSP (alter); alter = XCDR (alter)) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
357 if (STRINGP (XCAR (alter)) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
358 && ((r - name) + SBYTES (XCAR (alter))) < 256) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
359 { |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
360 strcpy (r, (char *) SDATA (XCAR (alter))); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
361 list = xfont_list_pattern (frame, display, name); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
362 if (! NILP (list)) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
363 break; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
364 } |
90501
2ef165ebcc7d
(xfont_query_font): Adjusted for the change of
Kenichi Handa <handa@m17n.org>
parents:
90461
diff
changeset
|
365 } |
90400 | 366 } |
367 | |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
368 return list; |
90400 | 369 } |
370 | |
90561
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
371 static Lisp_Object |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
372 xfont_match (frame, spec) |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
373 Lisp_Object frame, spec; |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
374 { |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
375 FRAME_PTR f = XFRAME (frame); |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
376 Display *display = FRAME_X_DISPLAY_INFO (f)->display; |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
377 Lisp_Object extra, val, entity; |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
378 char buf[256], *name; |
90561
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
379 XFontStruct *xfont; |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
380 unsigned long value; |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
381 |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
382 extra = AREF (spec, FONT_EXTRA_INDEX); |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
383 val = assq_no_quit (QCname, extra); |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
384 if (! CONSP (val) || ! STRINGP (XCDR (val))) |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
385 { |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
386 if (font_unparse_xlfd (spec, 0, buf, 256) < 0) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
387 return Qnil; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
388 name = buf; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
389 } |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
390 else |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
391 name = (char *) SDATA (XCDR (val)); |
90561
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
392 |
90569
0af2dbdeaeb3
(xfont_match): Block and unblock input while callin Xlib.
Kenichi Handa <handa@m17n.org>
parents:
90561
diff
changeset
|
393 BLOCK_INPUT; |
90561
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
394 entity = Qnil; |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
395 xfont = XLoadQueryFont (display, name); |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
396 if (xfont) |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
397 { |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
398 if (XGetFontProperty (xfont, XA_FONT, &value)) |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
399 { |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
400 int len; |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
401 |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
402 name = (char *) XGetAtomName (display, (Atom) value); |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
403 len = strlen (name); |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
404 |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
405 /* If DXPC (a Differential X Protocol Compressor) |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
406 Ver.3.7 is running, XGetAtomName will return null |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
407 string. We must avoid such a name. */ |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
408 if (len > 0) |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
409 { |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
410 entity = font_make_entity (); |
90561
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
411 ASET (entity, FONT_TYPE_INDEX, Qx); |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
412 if (font_parse_xlfd (name, entity) < 0) |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
413 entity = Qnil; |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
414 } |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
415 XFree (name); |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
416 } |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
417 XFreeFont (display, xfont); |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
418 } |
90569
0af2dbdeaeb3
(xfont_match): Block and unblock input while callin Xlib.
Kenichi Handa <handa@m17n.org>
parents:
90561
diff
changeset
|
419 UNBLOCK_INPUT; |
90561
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
420 |
95180
1520d3ef2a48
(xfont_get_pcm): Change xassert to font_assert.
Kenichi Handa <handa@m17n.org>
parents:
94963
diff
changeset
|
421 font_add_log ("xfont-match", spec, entity); |
90561
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
422 return entity; |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
423 } |
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
424 |
90400 | 425 static Lisp_Object |
426 xfont_list_family (frame) | |
90443
57b847825c30
(xfont_list): If script is specified for a font, return
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
427 Lisp_Object frame; |
90400 | 428 { |
429 FRAME_PTR f = XFRAME (frame); | |
430 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | |
431 char **names; | |
432 int num_fonts, i; | |
433 Lisp_Object list; | |
434 char *last_family; | |
435 int last_len; | |
436 | |
437 BLOCK_INPUT; | |
438 x_catch_errors (dpyinfo->display); | |
439 names = XListFonts (dpyinfo->display, "-*-*-*-*-*-*-*-*-*-*-*-*-*-*", | |
440 0x8000, &num_fonts); | |
441 if (x_had_errors_p (dpyinfo->display)) | |
442 { | |
443 /* This error is perhaps due to insufficient memory on X server. | |
444 Let's just ignore it. */ | |
445 x_clear_errors (dpyinfo->display); | |
446 num_fonts = 0; | |
447 } | |
448 | |
449 list = Qnil; | |
450 for (i = 0, last_len = 0; i < num_fonts; i++) | |
451 { | |
452 char *p0 = names[i], *p1; | |
453 Lisp_Object family; | |
454 | |
455 p0++; /* skip the leading '-' */ | |
456 while (*p0 && *p0 != '-') p0++; /* skip foundry */ | |
457 if (! *p0) | |
458 continue; | |
459 p1 = ++p0; | |
460 while (*p1 && *p1 != '-') p1++; /* find the end of family */ | |
461 if (! *p1 || p1 == p0) | |
462 continue; | |
463 if (last_len == p1 - p0 | |
464 && bcmp (last_family, p0, last_len) == 0) | |
465 continue; | |
466 last_len = p1 - p0; | |
467 last_family = p0; | |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
468 family = make_unibyte_string (p0, last_len); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
469 if (NILP (Fassoc_string (family, list, Qt))) |
90400 | 470 list = Fcons (family, list); |
471 } | |
472 | |
473 XFreeFontNames (names); | |
474 x_uncatch_errors (); | |
475 UNBLOCK_INPUT; | |
476 | |
477 return list; | |
478 } | |
479 | |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
480 extern Lisp_Object QCavgwidth; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
481 |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
482 static Lisp_Object |
90400 | 483 xfont_open (f, entity, pixel_size) |
484 FRAME_PTR f; | |
485 Lisp_Object entity; | |
486 int pixel_size; | |
487 { | |
488 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | |
489 Display *display = dpyinfo->display; | |
490 char name[256]; | |
491 int len; | |
492 unsigned long value; | |
493 Lisp_Object registry; | |
494 struct charset *encoding, *repertory; | |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
495 Lisp_Object font_object, fullname; |
90400 | 496 struct font *font; |
497 XFontStruct *xfont; | |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
498 int i; |
90400 | 499 |
500 /* At first, check if we know how to encode characters for this | |
501 font. */ | |
502 registry = AREF (entity, FONT_REGISTRY_INDEX); | |
91142
4bcf0716ddf4
* xfont.c (x_font_charset_alist): Moved to font.c and renamed.
Kenichi Handa <handa@m17n.org>
parents:
90698
diff
changeset
|
503 if (font_registry_charsets (registry, &encoding, &repertory) < 0) |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
504 return Qnil; |
90400 | 505 |
506 if (XINT (AREF (entity, FONT_SIZE_INDEX)) != 0) | |
507 pixel_size = XINT (AREF (entity, FONT_SIZE_INDEX)); | |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
508 else if (pixel_size == 0) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
509 { |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
510 if (FRAME_FONT (f)) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
511 pixel_size = FRAME_FONT (f)->pixel_size; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
512 else |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
513 pixel_size = 14; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
514 } |
90400 | 515 len = font_unparse_xlfd (entity, pixel_size, name, 256); |
516 if (len <= 0) | |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
517 return Qnil; |
90400 | 518 |
519 BLOCK_INPUT; | |
520 x_catch_errors (display); | |
521 xfont = XLoadQueryFont (display, name); | |
522 if (x_had_errors_p (display)) | |
523 { | |
524 /* This error is perhaps due to insufficient memory on X server. | |
525 Let's just ignore it. */ | |
526 x_clear_errors (display); | |
527 xfont = NULL; | |
528 } | |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
529 fullname = Qnil; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
530 /* Try to get the full name of FONT. */ |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
531 if (xfont && XGetFontProperty (xfont, XA_FONT, &value)) |
90400 | 532 { |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
533 char *p0, *p; |
90400 | 534 int dashes = 0; |
535 | |
536 p0 = p = (char *) XGetAtomName (FRAME_X_DISPLAY (f), (Atom) value);; | |
537 /* Count the number of dashes in the "full name". | |
538 If it is too few, this isn't really the font's full name, | |
539 so don't use it. | |
540 In X11R4, the fonts did not come with their canonical names | |
541 stored in them. */ | |
542 while (*p) | |
543 { | |
544 if (*p == '-') | |
545 dashes++; | |
546 p++; | |
547 } | |
548 | |
549 if (dashes >= 13) | |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
550 fullname = Fdowncase (make_unibyte_string (p0, p - p0)); |
90400 | 551 XFree (p0); |
552 } | |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
553 x_uncatch_errors (); |
90400 | 554 UNBLOCK_INPUT; |
555 | |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
556 if (! xfont) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
557 return Qnil; |
90400 | 558 |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
559 font_object = font_make_object (VECSIZE (struct xfont_info)); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
560 ASET (font_object, FONT_TYPE_INDEX, Qx); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
561 if (STRINGP (fullname)) |
95180
1520d3ef2a48
(xfont_get_pcm): Change xassert to font_assert.
Kenichi Handa <handa@m17n.org>
parents:
94963
diff
changeset
|
562 font_parse_xlfd ((char *) SDATA (fullname), font_object); |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
563 for (i = 1; i < FONT_ENTITY_MAX; i++) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
564 ASET (font_object, i, AREF (entity, i)); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
565 ASET (font_object, FONT_SIZE_INDEX, make_number (pixel_size)); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
566 if (STRINGP (fullname)) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
567 ASET (font_object, FONT_NAME_INDEX, fullname); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
568 else |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
569 ASET (font_object, FONT_NAME_INDEX, make_unibyte_string (name, len)); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
570 ASET (font_object, FONT_FULLNAME_INDEX, fullname); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
571 ASET (font_object, FONT_FILE_INDEX, Qnil); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
572 ASET (font_object, FONT_FORMAT_INDEX, Qx); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
573 font = XFONT_OBJECT (font_object); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
574 ((struct xfont_info *) font)->xfont = xfont; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
575 ((struct xfont_info *) font)->display = FRAME_X_DISPLAY (f); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
576 font->pixel_size = pixel_size; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
577 font->driver = &xfont_driver; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
578 font->encoding_charset = encoding->id; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
579 font->repertory_charset = repertory ? repertory->id : -1; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
580 font->ascent = xfont->ascent; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
581 font->descent = xfont->descent; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
582 font->height = font->ascent + font->descent; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
583 font->min_width = xfont->min_bounds.width; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
584 if (xfont->min_bounds.width == xfont->max_bounds.width) |
90400 | 585 { |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
586 /* Fixed width font. */ |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
587 font->average_width = font->space_width = xfont->min_bounds.width; |
90400 | 588 } |
589 else | |
590 { | |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
591 XCharStruct *pcm; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
592 XChar2b char2b; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
593 Lisp_Object val; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
594 |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
595 char2b.byte1 = 0x00, char2b.byte2 = 0x20; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
596 pcm = xfont_get_pcm (xfont, &char2b); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
597 if (pcm) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
598 font->space_width = pcm->width; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
599 else |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
600 font->space_width = 0; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
601 |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
602 val = Ffont_get (font_object, QCavgwidth); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
603 if (INTEGERP (val)) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
604 font->average_width = XINT (val); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
605 if (font->average_width < 0) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
606 font->average_width = - font->average_width; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
607 if (font->average_width == 0 |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
608 && encoding->ascii_compatible_p) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
609 { |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
610 int width = font->space_width, n = pcm != NULL; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
611 |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
612 for (char2b.byte2 = 33; char2b.byte2 <= 126; char2b.byte2++) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
613 if ((pcm = xfont_get_pcm (xfont, &char2b)) != NULL) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
614 width += pcm->width, n++; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
615 font->average_width = width / n; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
616 } |
90400 | 617 } |
618 | |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
619 BLOCK_INPUT; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
620 font->underline_thickness |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
621 = (XGetFontProperty (xfont, XA_UNDERLINE_THICKNESS, &value) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
622 ? (long) value : 0); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
623 font->underline_position |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
624 = (XGetFontProperty (xfont, XA_UNDERLINE_POSITION, &value) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
625 ? (long) value : -1); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
626 font->baseline_offset |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
627 = (XGetFontProperty (xfont, dpyinfo->Xatom_MULE_BASELINE_OFFSET, &value) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
628 ? (long) value : 0); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
629 font->relative_compose |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
630 = (XGetFontProperty (xfont, dpyinfo->Xatom_MULE_RELATIVE_COMPOSE, &value) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
631 ? (long) value : 0); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
632 font->default_ascent |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
633 = (XGetFontProperty (xfont, dpyinfo->Xatom_MULE_DEFAULT_ASCENT, &value) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
634 ? (long) value : 0); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
635 UNBLOCK_INPUT; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
636 |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
637 if (NILP (fullname)) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
638 fullname = AREF (font_object, FONT_NAME_INDEX); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
639 font->vertical_centering |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
640 = (STRINGP (Vvertical_centering_font_regexp) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
641 && (fast_string_match_ignore_case |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
642 (Vvertical_centering_font_regexp, fullname) >= 0)); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
643 |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
644 return font_object; |
90400 | 645 } |
646 | |
647 static void | |
648 xfont_close (f, font) | |
649 FRAME_PTR f; | |
650 struct font *font; | |
651 { | |
652 BLOCK_INPUT; | |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
653 XFreeFont (FRAME_X_DISPLAY (f), ((struct xfont_info *) font)->xfont); |
90400 | 654 UNBLOCK_INPUT; |
655 } | |
656 | |
657 static int | |
658 xfont_prepare_face (f, face) | |
659 FRAME_PTR f; | |
660 struct face *face; | |
661 { | |
662 BLOCK_INPUT; | |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
663 XSetFont (FRAME_X_DISPLAY (f), face->gc, |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
664 ((struct xfont_info *) face->font)->xfont->fid); |
90400 | 665 UNBLOCK_INPUT; |
666 | |
667 return 0; | |
668 } | |
669 | |
670 static int | |
671 xfont_has_char (entity, c) | |
672 Lisp_Object entity; | |
673 int c; | |
674 { | |
675 Lisp_Object registry = AREF (entity, FONT_REGISTRY_INDEX); | |
676 struct charset *repertory; | |
677 | |
91142
4bcf0716ddf4
* xfont.c (x_font_charset_alist): Moved to font.c and renamed.
Kenichi Handa <handa@m17n.org>
parents:
90698
diff
changeset
|
678 if (font_registry_charsets (registry, NULL, &repertory) < 0) |
90400 | 679 return -1; |
680 if (! repertory) | |
681 return -1; | |
682 return (ENCODE_CHAR (repertory, c) != CHARSET_INVALID_CODE (repertory)); | |
683 } | |
684 | |
685 static unsigned | |
686 xfont_encode_char (font, c) | |
687 struct font *font; | |
688 int c; | |
689 { | |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
690 XFontStruct *xfont = ((struct xfont_info *) font)->xfont; |
90400 | 691 struct charset *charset; |
692 unsigned code; | |
693 XChar2b char2b; | |
694 | |
695 charset = CHARSET_FROM_ID (font->encoding_charset); | |
696 code = ENCODE_CHAR (charset, c); | |
697 if (code == CHARSET_INVALID_CODE (charset)) | |
91270
0dab56b22dca
(xfont_encode_char): Use the macro FONT_INVALID_CODE.
Kenichi Handa <handa@m17n.org>
parents:
91245
diff
changeset
|
698 return FONT_INVALID_CODE; |
90454
a8b745412821
(xfont_open, xfont_encode_char): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
90443
diff
changeset
|
699 if (font->repertory_charset >= 0) |
90400 | 700 { |
90454
a8b745412821
(xfont_open, xfont_encode_char): Fix typo.
Kenichi Handa <handa@m17n.org>
parents:
90443
diff
changeset
|
701 charset = CHARSET_FROM_ID (font->repertory_charset); |
90400 | 702 return (ENCODE_CHAR (charset, c) != CHARSET_INVALID_CODE (charset) |
91270
0dab56b22dca
(xfont_encode_char): Use the macro FONT_INVALID_CODE.
Kenichi Handa <handa@m17n.org>
parents:
91245
diff
changeset
|
703 ? code : FONT_INVALID_CODE); |
90400 | 704 } |
90425
5976e428d68e
(xfont_encode_char): Fix calculation of char2b.
Kenichi Handa <handa@m17n.org>
parents:
90400
diff
changeset
|
705 char2b.byte1 = code >> 8; |
5976e428d68e
(xfont_encode_char): Fix calculation of char2b.
Kenichi Handa <handa@m17n.org>
parents:
90400
diff
changeset
|
706 char2b.byte2 = code & 0xFF; |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
707 return (xfont_get_pcm (xfont, &char2b) ? code : FONT_INVALID_CODE); |
90400 | 708 } |
709 | |
710 static int | |
711 xfont_text_extents (font, code, nglyphs, metrics) | |
712 struct font *font; | |
713 unsigned *code; | |
714 int nglyphs; | |
715 struct font_metrics *metrics; | |
716 { | |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
717 XFontStruct *xfont = ((struct xfont_info *) font)->xfont; |
90400 | 718 int width = 0; |
719 int i, x; | |
720 | |
721 if (metrics) | |
722 bzero (metrics, sizeof (struct font_metrics)); | |
723 for (i = 0, x = 0; i < nglyphs; i++) | |
724 { | |
725 XChar2b char2b; | |
726 static XCharStruct *pcm; | |
727 | |
728 if (code[i] >= 0x10000) | |
729 continue; | |
730 char2b.byte1 = code[i] >> 8, char2b.byte2 = code[i] & 0xFF; | |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
731 pcm = xfont_get_pcm (xfont, &char2b); |
90400 | 732 if (! pcm) |
733 continue; | |
734 if (metrics->lbearing > width + pcm->lbearing) | |
735 metrics->lbearing = width + pcm->lbearing; | |
736 if (metrics->rbearing < width + pcm->rbearing) | |
737 metrics->rbearing = width + pcm->rbearing; | |
738 if (metrics->ascent < pcm->ascent) | |
739 metrics->ascent = pcm->ascent; | |
740 if (metrics->descent < pcm->descent) | |
741 metrics->descent = pcm->descent; | |
742 width += pcm->width; | |
743 } | |
744 if (metrics) | |
745 metrics->width = width; | |
746 return width; | |
747 } | |
748 | |
749 static int | |
750 xfont_draw (s, from, to, x, y, with_background) | |
751 struct glyph_string *s; | |
752 int from, to, x, y, with_background; | |
753 { | |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
754 XFontStruct *xfont = ((struct xfont_info *) s->font)->xfont; |
90400 | 755 int len = to - from; |
90561
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
756 GC gc = s->gc; |
92185
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
757 int i; |
90561
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
758 |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
759 if (s->gc != s->face->gc) |
90561
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
760 { |
91905
6ae79e72fea7
(xfont_draw): Use BLOCK_INPUT and UNBLOCK_INPUT.
Kenichi Handa <handa@m17n.org>
parents:
91554
diff
changeset
|
761 BLOCK_INPUT; |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
762 XSetFont (s->display, gc, xfont->fid); |
91905
6ae79e72fea7
(xfont_draw): Use BLOCK_INPUT and UNBLOCK_INPUT.
Kenichi Handa <handa@m17n.org>
parents:
91554
diff
changeset
|
763 UNBLOCK_INPUT; |
90561
73750c4e078a
(xfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90545
diff
changeset
|
764 } |
90400 | 765 |
766 if (xfont->min_byte1 == 0 && xfont->max_byte1 == 0) | |
767 { | |
768 char *str; | |
769 USE_SAFE_ALLOCA; | |
770 | |
771 SAFE_ALLOCA (str, char *, len); | |
772 for (i = 0; i < len ; i++) | |
773 str[i] = XCHAR2B_BYTE2 (s->char2b + from + i); | |
91905
6ae79e72fea7
(xfont_draw): Use BLOCK_INPUT and UNBLOCK_INPUT.
Kenichi Handa <handa@m17n.org>
parents:
91554
diff
changeset
|
774 BLOCK_INPUT; |
90400 | 775 if (with_background > 0) |
92185
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
776 { |
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
777 if (s->padding_p) |
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
778 for (i = 0; i < len; i++) |
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
779 XDrawImageString (FRAME_X_DISPLAY (s->f), FRAME_X_WINDOW (s->f), |
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
780 gc, x + i, y, str + i, 1); |
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
781 else |
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
782 XDrawImageString (FRAME_X_DISPLAY (s->f), FRAME_X_WINDOW (s->f), |
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
783 gc, x, y, str, len); |
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
784 } |
90400 | 785 else |
92185
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
786 { |
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
787 if (s->padding_p) |
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
788 for (i = 0; i < len; i++) |
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
789 XDrawString (FRAME_X_DISPLAY (s->f), FRAME_X_WINDOW (s->f), |
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
790 gc, x + i, y, str + i, 1); |
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
791 else |
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
792 XDrawString (FRAME_X_DISPLAY (s->f), FRAME_X_WINDOW (s->f), |
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
793 gc, x, y, str, len); |
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
794 } |
91905
6ae79e72fea7
(xfont_draw): Use BLOCK_INPUT and UNBLOCK_INPUT.
Kenichi Handa <handa@m17n.org>
parents:
91554
diff
changeset
|
795 UNBLOCK_INPUT; |
90400 | 796 SAFE_FREE (); |
797 return s->nchars; | |
798 } | |
799 | |
91905
6ae79e72fea7
(xfont_draw): Use BLOCK_INPUT and UNBLOCK_INPUT.
Kenichi Handa <handa@m17n.org>
parents:
91554
diff
changeset
|
800 BLOCK_INPUT; |
90400 | 801 if (with_background > 0) |
92185
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
802 { |
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
803 if (s->padding_p) |
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
804 for (i = 0; i < len; i++) |
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
805 XDrawImageString16 (FRAME_X_DISPLAY (s->f), FRAME_X_WINDOW (s->f), |
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
806 gc, x + i, y, s->char2b + from + i, 1); |
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
807 else |
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
808 XDrawImageString16 (FRAME_X_DISPLAY (s->f), FRAME_X_WINDOW (s->f), |
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
809 gc, x, y, s->char2b + from, len); |
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
810 } |
90400 | 811 else |
92185
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
812 { |
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
813 if (s->padding_p) |
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
814 for (i = 0; i < len; i++) |
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
815 XDrawString16 (FRAME_X_DISPLAY (s->f), FRAME_X_WINDOW (s->f), |
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
816 gc, x + i, y, s->char2b + from + i, 1); |
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
817 else |
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
818 XDrawString16 (FRAME_X_DISPLAY (s->f), FRAME_X_WINDOW (s->f), |
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
819 gc, x, y, s->char2b + from, len); |
1e28008a13e5
(xfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91905
diff
changeset
|
820 } |
91905
6ae79e72fea7
(xfont_draw): Use BLOCK_INPUT and UNBLOCK_INPUT.
Kenichi Handa <handa@m17n.org>
parents:
91554
diff
changeset
|
821 UNBLOCK_INPUT; |
90400 | 822 |
823 return len; | |
824 } | |
825 | |
94940
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
826 static int |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
827 xfont_check (f, font) |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
828 FRAME_PTR f; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
829 struct font *font; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
830 { |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
831 struct xfont_info *xfont = (struct xfont_info *) font; |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
832 |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
833 return (FRAME_X_DISPLAY (f) == xfont->display ? 0 : -1); |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
834 } |
061d44df20b7
Include <stdlib.h> and "ccl.h".
Kenichi Handa <handa@m17n.org>
parents:
92185
diff
changeset
|
835 |
90400 | 836 |
837 void | |
838 syms_of_xfont () | |
839 { | |
840 xfont_driver.type = Qx; | |
841 register_font_driver (&xfont_driver, NULL); | |
842 } | |
90427 | 843 |
844 /* arch-tag: 23c5f366-a5ee-44b7-a3b7-90d6da7fd749 | |
845 (do not change this comment) */ |