Mercurial > emacs
annotate src/xftfont.c @ 91130:d576e6864dbb
*** empty log message ***
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Sat, 01 Dec 2007 02:00:06 +0000 |
parents | 82a42637237c |
children | 06de618f78e7 |
rev | line source |
---|---|
90400 | 1 /* xftfont.c -- XFT font driver. |
2 Copyright (C) 2006 Free Software Foundation, Inc. | |
3 Copyright (C) 2006 | |
4 National Institute of Advanced Industrial Science and Technology (AIST) | |
5 Registration Number H13PRO009 | |
6 | |
7 This file is part of GNU Emacs. | |
8 | |
9 GNU Emacs is free software; you can redistribute it and/or modify | |
10 it under the terms of the GNU General Public License as published by | |
11 the Free Software Foundation; either version 2, or (at your option) | |
12 any later version. | |
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 | |
20 along with GNU Emacs; see the file COPYING. If not, write to | |
21 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
22 Boston, MA 02110-1301, USA. */ | |
23 | |
24 #include <config.h> | |
25 #include <stdio.h> | |
26 #include <X11/Xlib.h> | |
27 #include <X11/Xft/Xft.h> | |
28 | |
29 #include "lisp.h" | |
30 #include "dispextern.h" | |
31 #include "xterm.h" | |
32 #include "frame.h" | |
33 #include "blockinput.h" | |
34 #include "character.h" | |
35 #include "charset.h" | |
36 #include "fontset.h" | |
37 #include "font.h" | |
38 | |
39 /* Xft font driver. */ | |
40 | |
41 static Lisp_Object Qxft; | |
42 | |
43 /* The actual structure for Xft font that can be casted to struct | |
44 font. */ | |
45 | |
46 struct xftfont_info | |
47 { | |
48 struct font font; | |
49 Display *display; | |
50 int screen; | |
51 XftFont *xftfont; | |
90559
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
52 FT_Face ft_face; /* set to XftLockFace (xftfont) */ |
90400 | 53 }; |
54 | |
55 /* Structure pointed by (struct face *)->extra */ | |
90559
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
56 |
90400 | 57 struct xftface_info |
58 { | |
90559
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
59 XftColor xft_fg; /* color for face->foreground */ |
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
60 XftColor xft_bg; /* color for face->background */ |
90400 | 61 }; |
62 | |
63 static void xftfont_get_colors P_ ((FRAME_PTR, struct face *, GC gc, | |
64 struct xftface_info *, | |
65 XftColor *fg, XftColor *bg)); | |
66 static Font xftfont_default_fid P_ ((FRAME_PTR)); | |
67 | |
68 | |
90559
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
69 /* Setup foreground and background colors of GC into FG and BG. If |
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
70 XFTFACE_INFO is not NULL, reuse the colors in it if possible. BG |
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
71 may be NULL. */ |
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
72 |
90400 | 73 static void |
74 xftfont_get_colors (f, face, gc, xftface_info, fg, bg) | |
75 FRAME_PTR f; | |
76 struct face *face; | |
77 GC gc; | |
78 struct xftface_info *xftface_info; | |
79 XftColor *fg, *bg; | |
80 { | |
81 if (xftface_info && face->gc == gc) | |
82 { | |
83 *fg = xftface_info->xft_fg; | |
84 if (bg) | |
85 *bg = xftface_info->xft_bg; | |
86 } | |
87 else | |
88 { | |
89 XGCValues xgcv; | |
90 int fg_done = 0, bg_done = 0; | |
91 | |
92 BLOCK_INPUT; | |
93 XGetGCValues (FRAME_X_DISPLAY (f), gc, | |
94 GCForeground | GCBackground, &xgcv); | |
95 if (xftface_info) | |
96 { | |
97 if (xgcv.foreground == face->foreground) | |
98 *fg = xftface_info->xft_fg, fg_done = 1; | |
99 else if (xgcv.foreground == face->background) | |
100 *fg = xftface_info->xft_bg, fg_done = 1; | |
101 if (! bg) | |
102 bg_done = 1; | |
103 else if (xgcv.background == face->background) | |
104 *bg = xftface_info->xft_bg, bg_done = 1; | |
105 else if (xgcv.background == face->foreground) | |
106 *bg = xftface_info->xft_fg, bg_done = 1; | |
107 } | |
108 | |
109 if (fg_done + bg_done < 2) | |
110 { | |
111 XColor colors[2]; | |
112 | |
113 colors[0].pixel = fg->pixel = xgcv.foreground; | |
114 if (bg) | |
115 colors[1].pixel = bg->pixel = xgcv.background; | |
116 XQueryColors (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), colors, | |
117 bg ? 2 : 1); | |
118 fg->color.alpha = 0xFFFF; | |
119 fg->color.red = colors[0].red; | |
120 fg->color.green = colors[0].green; | |
121 fg->color.blue = colors[0].blue; | |
122 if (bg) | |
123 { | |
124 bg->color.alpha = 0xFFFF; | |
125 bg->color.red = colors[1].red; | |
126 bg->color.green = colors[1].green; | |
127 bg->color.blue = colors[1].blue; | |
128 } | |
129 } | |
130 UNBLOCK_INPUT; | |
131 } | |
132 } | |
133 | |
90559
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
134 /* Return the default Font ID on frame F. The Returned Font ID is |
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
135 stored in the GC of the frame F, but the font is never used. So, |
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
136 any ID is ok as long as it is valid. */ |
90400 | 137 |
138 static Font | |
139 xftfont_default_fid (f) | |
140 FRAME_PTR f; | |
141 { | |
142 static int fid_known; | |
143 static Font fid; | |
144 | |
145 if (! fid_known) | |
146 { | |
147 fid = XLoadFont (FRAME_X_DISPLAY (f), "fixed"); | |
148 if (! fid) | |
149 { | |
150 fid = XLoadFont (FRAME_X_DISPLAY (f), "*"); | |
151 if (! fid) | |
152 abort (); | |
153 } | |
90426
e9ed7d437c21
(xftfont_default_fid): Set fid_known to 1.
Kenichi Handa <handa@m17n.org>
parents:
90400
diff
changeset
|
154 fid_known = 1; |
90400 | 155 } |
156 return fid; | |
157 } | |
158 | |
159 | |
160 static Lisp_Object xftfont_list P_ ((Lisp_Object, Lisp_Object)); | |
90559
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
161 static Lisp_Object xftfont_match P_ ((Lisp_Object, Lisp_Object)); |
90400 | 162 static struct font *xftfont_open P_ ((FRAME_PTR, Lisp_Object, int)); |
163 static void xftfont_close P_ ((FRAME_PTR, struct font *)); | |
164 static int xftfont_prepare_face P_ ((FRAME_PTR, struct face *)); | |
165 static void xftfont_done_face P_ ((FRAME_PTR, struct face *)); | |
166 static unsigned xftfont_encode_char P_ ((struct font *, int)); | |
167 static int xftfont_text_extents P_ ((struct font *, unsigned *, int, | |
168 struct font_metrics *)); | |
169 static int xftfont_draw P_ ((struct glyph_string *, int, int, int, int, int)); | |
170 | |
171 static int xftfont_anchor_point P_ ((struct font *, unsigned, int, | |
172 int *, int *)); | |
91110
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
173 static int xftfont_start_for_frame P_ ((FRAME_PTR f)); |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
174 static int xftfont_end_for_frame P_ ((FRAME_PTR f)); |
90400 | 175 |
176 struct font_driver xftfont_driver; | |
177 | |
178 static Lisp_Object | |
179 xftfont_list (frame, spec) | |
180 Lisp_Object frame; | |
181 Lisp_Object spec; | |
182 { | |
183 Lisp_Object val = ftfont_driver.list (frame, spec); | |
90559
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
184 int i; |
90400 | 185 |
186 if (! NILP (val)) | |
90559
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
187 for (i = 0; i < ASIZE (val); i++) |
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
188 ASET (AREF (val, i), FONT_TYPE_INDEX, Qxft); |
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
189 return val; |
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
190 } |
90400 | 191 |
90559
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
192 static Lisp_Object |
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
193 xftfont_match (frame, spec) |
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
194 Lisp_Object frame; |
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
195 Lisp_Object spec; |
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
196 { |
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
197 Lisp_Object entity = ftfont_driver.match (frame, spec); |
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
198 |
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
199 if (VECTORP (entity)) |
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
200 ASET (entity, FONT_TYPE_INDEX, Qxft); |
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
201 return entity; |
90400 | 202 } |
203 | |
90700
b165eceb829f
(ftfont_font_format): Extern declaration.
Kenichi Handa <handa@m17n.org>
parents:
90675
diff
changeset
|
204 extern Lisp_Object ftfont_font_format P_ ((FcPattern *)); |
b165eceb829f
(ftfont_font_format): Extern declaration.
Kenichi Handa <handa@m17n.org>
parents:
90675
diff
changeset
|
205 |
90400 | 206 static FcChar8 ascii_printable[95]; |
207 | |
208 static struct font * | |
209 xftfont_open (f, entity, pixel_size) | |
210 FRAME_PTR f; | |
211 Lisp_Object entity; | |
212 int pixel_size; | |
213 { | |
214 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | |
215 Display *display = FRAME_X_DISPLAY (f); | |
216 Lisp_Object val; | |
90460
86449661f321
(xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents:
90442
diff
changeset
|
217 FcPattern *pattern, *pat = NULL; |
86449661f321
(xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents:
90442
diff
changeset
|
218 FcChar8 *file; |
86449661f321
(xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents:
90442
diff
changeset
|
219 struct xftfont_info *xftfont_info = NULL; |
86449661f321
(xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents:
90442
diff
changeset
|
220 XFontStruct *xfont = NULL; |
90400 | 221 struct font *font; |
222 double size = 0; | |
90460
86449661f321
(xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents:
90442
diff
changeset
|
223 XftFont *xftfont = NULL; |
90400 | 224 int spacing; |
90460
86449661f321
(xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents:
90442
diff
changeset
|
225 char *name; |
90442
d6abf2344438
(xftfont_open): Make the font name fontconfig's
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
226 int len; |
90959
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
227 XGlyphInfo extents; |
90400 | 228 |
229 val = AREF (entity, FONT_EXTRA_INDEX); | |
230 if (XTYPE (val) != Lisp_Misc | |
231 || XMISCTYPE (val) != Lisp_Misc_Save_Value) | |
232 return NULL; | |
233 pattern = XSAVE_VALUE (val)->pointer; | |
234 if (FcPatternGetString (pattern, FC_FILE, 0, &file) != FcResultMatch) | |
235 return NULL; | |
236 | |
237 size = XINT (AREF (entity, FONT_SIZE_INDEX)); | |
238 if (size == 0) | |
239 size = pixel_size; | |
90442
d6abf2344438
(xftfont_open): Make the font name fontconfig's
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
240 |
90400 | 241 pat = FcPatternCreate (); |
242 FcPatternAddString (pat, FC_FILE, file); | |
243 FcPatternAddDouble (pat, FC_PIXEL_SIZE, pixel_size); | |
90712
8594053c8fec
(xftfont_open): Don't enable antialias explicitly.
Kenichi Handa <handa@m17n.org>
parents:
90700
diff
changeset
|
244 /*FcPatternAddBool (pat, FC_ANTIALIAS, FcTrue);*/ |
90714
698001835583
(xftfont_open): Call FcConfigSubstitute.
Kenichi Handa <handa@m17n.org>
parents:
90712
diff
changeset
|
245 val = AREF (entity, FONT_FAMILY_INDEX); |
698001835583
(xftfont_open): Call FcConfigSubstitute.
Kenichi Handa <handa@m17n.org>
parents:
90712
diff
changeset
|
246 if (! NILP (val)) |
698001835583
(xftfont_open): Call FcConfigSubstitute.
Kenichi Handa <handa@m17n.org>
parents:
90712
diff
changeset
|
247 FcPatternAddString (pat, FC_FAMILY, (FcChar8 *) SDATA (SYMBOL_NAME (val))); |
698001835583
(xftfont_open): Call FcConfigSubstitute.
Kenichi Handa <handa@m17n.org>
parents:
90712
diff
changeset
|
248 FcConfigSubstitute (NULL, pat, FcMatchPattern); |
90442
d6abf2344438
(xftfont_open): Make the font name fontconfig's
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
249 |
d6abf2344438
(xftfont_open): Make the font name fontconfig's
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
250 BLOCK_INPUT; |
90589
697dcc1df88d
(xftfont_open): Call XftDefaultSubstitute before
Kenichi Handa <handa@m17n.org>
parents:
90559
diff
changeset
|
251 XftDefaultSubstitute (display, FRAME_X_SCREEN_NUMBER (f), pat); |
90400 | 252 xftfont = XftFontOpenPattern (display, pat); |
253 /* We should not destroy PAT here because it is kept in XFTFONT and | |
254 destroyed automatically when XFTFONT is closed. */ | |
255 if (! xftfont) | |
90460
86449661f321
(xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents:
90442
diff
changeset
|
256 goto err; |
90400 | 257 |
258 xftfont_info = malloc (sizeof (struct xftfont_info)); | |
259 if (! xftfont_info) | |
90460
86449661f321
(xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents:
90442
diff
changeset
|
260 goto err; |
90400 | 261 xfont = malloc (sizeof (XFontStruct)); |
90460
86449661f321
(xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents:
90442
diff
changeset
|
262 if (! xfont) |
86449661f321
(xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents:
90442
diff
changeset
|
263 goto err; |
90400 | 264 xftfont_info->display = display; |
265 xftfont_info->screen = FRAME_X_SCREEN_NUMBER (f); | |
266 xftfont_info->xftfont = xftfont; | |
267 xftfont_info->ft_face = XftLockFace (xftfont); | |
268 | |
269 font = (struct font *) xftfont_info; | |
90675
dfe6bfcd570f
(xftfont_open): Set font->format.
Kenichi Handa <handa@m17n.org>
parents:
90616
diff
changeset
|
270 font->format = ftfont_font_format (xftfont->pattern); |
90400 | 271 font->entity = entity; |
272 font->pixel_size = size; | |
273 font->driver = &xftfont_driver; | |
90473
9c75458ea910
(xftfont_open): For generating a name, start from
Kenichi Handa <handa@m17n.org>
parents:
90460
diff
changeset
|
274 len = 96; |
90460
86449661f321
(xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents:
90442
diff
changeset
|
275 name = malloc (len); |
86449661f321
(xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents:
90442
diff
changeset
|
276 while (name && font_unparse_fcname (entity, pixel_size, name, len) < 0) |
86449661f321
(xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents:
90442
diff
changeset
|
277 { |
86449661f321
(xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents:
90442
diff
changeset
|
278 char *new = realloc (name, len += 32); |
86449661f321
(xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents:
90442
diff
changeset
|
279 |
86449661f321
(xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents:
90442
diff
changeset
|
280 if (! new) |
86449661f321
(xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents:
90442
diff
changeset
|
281 free (name); |
86449661f321
(xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents:
90442
diff
changeset
|
282 name = new; |
86449661f321
(xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents:
90442
diff
changeset
|
283 } |
86449661f321
(xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents:
90442
diff
changeset
|
284 if (! name) |
86449661f321
(xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents:
90442
diff
changeset
|
285 goto err; |
86449661f321
(xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents:
90442
diff
changeset
|
286 font->font.full_name = font->font.name = name; |
90400 | 287 font->file_name = (char *) file; |
288 font->font.size = xftfont->max_advance_width; | |
90511
2cd8e24f656a
(xftfont_open): Set charset related members to -1.
Kenichi Handa <handa@m17n.org>
parents:
90499
diff
changeset
|
289 font->font.charset = font->encoding_charset = font->repertory_charset = -1; |
90400 | 290 |
291 if (FcPatternGetInteger (xftfont->pattern, FC_SPACING, 0, &spacing) | |
292 != FcResultMatch) | |
293 spacing = FC_PROPORTIONAL; | |
90959
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
294 if (! ascii_printable[0]) |
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
295 { |
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
296 int i; |
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
297 for (i = 0; i < 95; i++) |
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
298 ascii_printable[i] = ' ' + i; |
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
299 } |
90400 | 300 if (spacing != FC_PROPORTIONAL) |
90959
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
301 { |
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
302 font->font.average_width = font->font.space_width |
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
303 = xftfont->max_advance_width; |
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
304 XftTextExtents8 (display, xftfont, ascii_printable + 1, 94, &extents); |
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
305 } |
90400 | 306 else |
307 { | |
308 XftTextExtents8 (display, xftfont, ascii_printable, 1, &extents); | |
309 font->font.space_width = extents.xOff; | |
310 if (font->font.space_width <= 0) | |
311 /* dirty workaround */ | |
312 font->font.space_width = pixel_size; | |
313 XftTextExtents8 (display, xftfont, ascii_printable + 1, 94, &extents); | |
314 font->font.average_width = (font->font.space_width + extents.xOff) / 95; | |
315 } | |
90442
d6abf2344438
(xftfont_open): Make the font name fontconfig's
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
316 UNBLOCK_INPUT; |
90400 | 317 |
90959
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
318 font->ascent = xftfont->ascent; |
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
319 if (font->ascent < extents.y) |
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
320 font->ascent = extents.y; |
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
321 font->descent = xftfont->descent; |
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
322 if (font->descent < extents.height - extents.y) |
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
323 font->descent = extents.height - extents.y; |
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
324 font->font.height = font->ascent + font->descent; |
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
325 |
90400 | 326 /* Unfortunately Xft doesn't provide a way to get minimum char |
327 width. So, we use space_width instead. */ | |
328 font->min_width = font->font.space_width; | |
329 | |
330 font->font.baseline_offset = 0; | |
331 font->font.relative_compose = 0; | |
332 font->font.default_ascent = 0; | |
333 font->font.vertical_centering = 0; | |
334 | |
335 /* Setup pseudo XFontStruct */ | |
336 xfont->fid = xftfont_default_fid (f); | |
90959
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
337 xfont->ascent = font->ascent; |
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
338 xfont->descent = font->descent; |
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
339 xfont->max_bounds.descent = font->descent; |
90400 | 340 xfont->max_bounds.width = xftfont->max_advance_width; |
341 xfont->min_bounds.width = font->font.space_width; | |
342 font->font.font = xfont; | |
343 | |
344 dpyinfo->n_fonts++; | |
345 | |
346 /* Set global flag fonts_changed_p to non-zero if the font loaded | |
347 has a character with a smaller width than any other character | |
348 before, or if the font loaded has a smaller height than any other | |
349 font loaded before. If this happens, it will make a glyph matrix | |
350 reallocation necessary. */ | |
351 if (dpyinfo->n_fonts == 1) | |
352 { | |
353 dpyinfo->smallest_font_height = font->font.height; | |
354 dpyinfo->smallest_char_width = font->min_width; | |
355 fonts_changed_p = 1; | |
356 } | |
357 else | |
358 { | |
359 if (dpyinfo->smallest_font_height > font->font.height) | |
360 dpyinfo->smallest_font_height = font->font.height, | |
361 fonts_changed_p |= 1; | |
362 if (dpyinfo->smallest_char_width > font->min_width) | |
363 dpyinfo->smallest_char_width = font->min_width, | |
364 fonts_changed_p |= 1; | |
365 } | |
366 | |
367 return font; | |
90460
86449661f321
(xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents:
90442
diff
changeset
|
368 |
86449661f321
(xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents:
90442
diff
changeset
|
369 err: |
86449661f321
(xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents:
90442
diff
changeset
|
370 if (xftfont) XftFontClose (display, xftfont); |
86449661f321
(xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents:
90442
diff
changeset
|
371 UNBLOCK_INPUT; |
86449661f321
(xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents:
90442
diff
changeset
|
372 if (xftfont_info) free (xftfont_info); |
86449661f321
(xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents:
90442
diff
changeset
|
373 if (xfont) free (xfont); |
86449661f321
(xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents:
90442
diff
changeset
|
374 return NULL; |
90400 | 375 } |
376 | |
377 static void | |
378 xftfont_close (f, font) | |
379 FRAME_PTR f; | |
380 struct font *font; | |
381 { | |
382 struct xftfont_info *xftfont_info = (struct xftfont_info *) font; | |
383 | |
384 XftUnlockFace (xftfont_info->xftfont); | |
385 XftFontClose (xftfont_info->display, xftfont_info->xftfont); | |
90442
d6abf2344438
(xftfont_open): Make the font name fontconfig's
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
386 if (font->font.name) |
d6abf2344438
(xftfont_open): Make the font name fontconfig's
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
387 free (font->font.name); |
90400 | 388 free (font); |
389 FRAME_X_DISPLAY_INFO (f)->n_fonts--; | |
390 } | |
391 | |
392 static int | |
393 xftfont_prepare_face (f, face) | |
394 FRAME_PTR f; | |
395 struct face *face; | |
396 { | |
90489
78a820ef12db
(xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents:
90473
diff
changeset
|
397 struct xftface_info *xftface_info; |
90400 | 398 |
90499
32b8f672da38
(xftfont_prepare_face): Cancel previous change.
Kenichi Handa <handa@m17n.org>
parents:
90489
diff
changeset
|
399 #if 0 |
32b8f672da38
(xftfont_prepare_face): Cancel previous change.
Kenichi Handa <handa@m17n.org>
parents:
90489
diff
changeset
|
400 /* This doesn't work if face->ascii_face doesn't use an Xft font. */ |
90489
78a820ef12db
(xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents:
90473
diff
changeset
|
401 if (face != face->ascii_face) |
78a820ef12db
(xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents:
90473
diff
changeset
|
402 { |
78a820ef12db
(xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents:
90473
diff
changeset
|
403 face->extra = face->ascii_face->extra; |
78a820ef12db
(xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents:
90473
diff
changeset
|
404 return 0; |
78a820ef12db
(xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents:
90473
diff
changeset
|
405 } |
90499
32b8f672da38
(xftfont_prepare_face): Cancel previous change.
Kenichi Handa <handa@m17n.org>
parents:
90489
diff
changeset
|
406 #endif |
90489
78a820ef12db
(xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents:
90473
diff
changeset
|
407 |
78a820ef12db
(xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents:
90473
diff
changeset
|
408 xftface_info = malloc (sizeof (struct xftface_info)); |
90400 | 409 if (! xftface_info) |
410 return -1; | |
411 | |
412 BLOCK_INPUT; | |
413 xftfont_get_colors (f, face, face->gc, NULL, | |
414 &xftface_info->xft_fg, &xftface_info->xft_bg); | |
415 UNBLOCK_INPUT; | |
416 | |
417 face->extra = xftface_info; | |
418 return 0; | |
419 } | |
420 | |
421 static void | |
422 xftfont_done_face (f, face) | |
423 FRAME_PTR f; | |
424 struct face *face; | |
425 { | |
90489
78a820ef12db
(xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents:
90473
diff
changeset
|
426 struct xftface_info *xftface_info; |
78a820ef12db
(xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents:
90473
diff
changeset
|
427 |
90499
32b8f672da38
(xftfont_prepare_face): Cancel previous change.
Kenichi Handa <handa@m17n.org>
parents:
90489
diff
changeset
|
428 #if 0 |
32b8f672da38
(xftfont_prepare_face): Cancel previous change.
Kenichi Handa <handa@m17n.org>
parents:
90489
diff
changeset
|
429 /* This doesn't work if face->ascii_face doesn't use an Xft font. */ |
90489
78a820ef12db
(xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents:
90473
diff
changeset
|
430 if (face != face->ascii_face |
78a820ef12db
(xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents:
90473
diff
changeset
|
431 || ! face->extra) |
78a820ef12db
(xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents:
90473
diff
changeset
|
432 return; |
90499
32b8f672da38
(xftfont_prepare_face): Cancel previous change.
Kenichi Handa <handa@m17n.org>
parents:
90489
diff
changeset
|
433 #endif |
90400 | 434 |
90489
78a820ef12db
(xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents:
90473
diff
changeset
|
435 xftface_info = (struct xftface_info *) face->extra; |
90527
63b888896eba
* xftfont.c (xftfont_done_face): Call XftDrawDestroy only if xftface_info
Jan Djärv <jan.h.d@swipnet.se>
parents:
90511
diff
changeset
|
436 if (xftface_info) |
63b888896eba
* xftfont.c (xftfont_done_face): Call XftDrawDestroy only if xftface_info
Jan Djärv <jan.h.d@swipnet.se>
parents:
90511
diff
changeset
|
437 { |
63b888896eba
* xftfont.c (xftfont_done_face): Call XftDrawDestroy only if xftface_info
Jan Djärv <jan.h.d@swipnet.se>
parents:
90511
diff
changeset
|
438 free (xftface_info); |
91110
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
439 face->extra = NULL; |
90527
63b888896eba
* xftfont.c (xftfont_done_face): Call XftDrawDestroy only if xftface_info
Jan Djärv <jan.h.d@swipnet.se>
parents:
90511
diff
changeset
|
440 } |
90400 | 441 } |
442 | |
443 static unsigned | |
444 xftfont_encode_char (font, c) | |
445 struct font *font; | |
446 int c; | |
447 { | |
448 struct xftfont_info *xftfont_info = (struct xftfont_info *) font; | |
449 unsigned code = XftCharIndex (xftfont_info->display, xftfont_info->xftfont, | |
450 (FcChar32) c); | |
451 | |
452 return (code ? code : 0xFFFFFFFF); | |
453 } | |
454 | |
455 static int | |
456 xftfont_text_extents (font, code, nglyphs, metrics) | |
457 struct font *font; | |
458 unsigned *code; | |
459 int nglyphs; | |
460 struct font_metrics *metrics; | |
461 { | |
462 struct xftfont_info *xftfont_info = (struct xftfont_info *) font; | |
463 XGlyphInfo extents; | |
464 | |
465 BLOCK_INPUT; | |
466 XftGlyphExtents (xftfont_info->display, xftfont_info->xftfont, code, nglyphs, | |
467 &extents); | |
468 UNBLOCK_INPUT; | |
469 if (metrics) | |
470 { | |
471 metrics->lbearing = - extents.x; | |
472 metrics->rbearing = - extents.x + extents.width; | |
473 metrics->width = extents.xOff; | |
474 metrics->ascent = extents.y; | |
90616
68d59ef20174
(xftfont_text_extents): Fix calculation of descent
Kenichi Handa <handa@m17n.org>
parents:
90589
diff
changeset
|
475 metrics->descent = extents.height - extents.y; |
90400 | 476 } |
477 return extents.xOff; | |
478 } | |
479 | |
91110
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
480 static XftDraw * |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
481 xftfont_get_xft_draw (f) |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
482 FRAME_PTR f; |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
483 { |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
484 XftDraw *xft_draw = font_get_frame_data (f, &xftfont_driver);; |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
485 |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
486 if (! xft_draw) |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
487 { |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
488 BLOCK_INPUT; |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
489 xft_draw= XftDrawCreate (FRAME_X_DISPLAY (f), |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
490 FRAME_X_WINDOW (f), |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
491 FRAME_X_VISUAL (f), |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
492 FRAME_X_COLORMAP (f)); |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
493 UNBLOCK_INPUT; |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
494 if (! xft_draw) |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
495 abort (); |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
496 font_put_frame_data (f, &xftfont_driver, xft_draw); |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
497 } |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
498 return xft_draw; |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
499 } |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
500 |
90400 | 501 static int |
502 xftfont_draw (s, from, to, x, y, with_background) | |
503 struct glyph_string *s; | |
504 int from, to, x, y, with_background; | |
505 { | |
506 FRAME_PTR f = s->f; | |
507 struct face *face = s->face; | |
91011
7239c19e55e9
(xftfont_draw): If s->font_info != s->face->font_info,
Kenichi Handa <handa@m17n.org>
parents:
90959
diff
changeset
|
508 struct xftfont_info *xftfont_info = (struct xftfont_info *) s->font_info; |
7239c19e55e9
(xftfont_draw): If s->font_info != s->face->font_info,
Kenichi Handa <handa@m17n.org>
parents:
90959
diff
changeset
|
509 struct xftface_info *xftface_info = NULL; |
91110
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
510 XftDraw *xft_draw = xftfont_get_xft_draw (f); |
90400 | 511 FT_UInt *code; |
512 XftColor fg, bg; | |
513 XRectangle r; | |
514 int len = to - from; | |
515 int i; | |
516 | |
91011
7239c19e55e9
(xftfont_draw): If s->font_info != s->face->font_info,
Kenichi Handa <handa@m17n.org>
parents:
90959
diff
changeset
|
517 if (s->font_info == face->font_info) |
91110
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
518 xftface_info = (struct xftface_info *) face->extra; |
90400 | 519 xftfont_get_colors (f, face, s->gc, xftface_info, |
90426
e9ed7d437c21
(xftfont_default_fid): Set fid_known to 1.
Kenichi Handa <handa@m17n.org>
parents:
90400
diff
changeset
|
520 &fg, with_background ? &bg : NULL); |
90400 | 521 BLOCK_INPUT; |
91027
04b81a720da9
(xftfont_draw): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
91011
diff
changeset
|
522 if (s->num_clips > 0) |
04b81a720da9
(xftfont_draw): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
91011
diff
changeset
|
523 XftDrawSetClipRectangles (xft_draw, 0, 0, s->clip, s->num_clips); |
04b81a720da9
(xftfont_draw): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
91011
diff
changeset
|
524 else |
04b81a720da9
(xftfont_draw): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
91011
diff
changeset
|
525 XftDrawSetClip (xft_draw, NULL); |
04b81a720da9
(xftfont_draw): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
91011
diff
changeset
|
526 |
90400 | 527 if (with_background) |
528 { | |
529 struct font *font = (struct font *) face->font_info; | |
530 | |
91011
7239c19e55e9
(xftfont_draw): If s->font_info != s->face->font_info,
Kenichi Handa <handa@m17n.org>
parents:
90959
diff
changeset
|
531 XftDrawRect (xft_draw, &bg, |
90400 | 532 x, y - face->font->ascent, s->width, font->font.height); |
533 } | |
534 code = alloca (sizeof (FT_UInt) * len); | |
535 for (i = 0; i < len; i++) | |
536 code[i] = ((XCHAR2B_BYTE1 (s->char2b + from + i) << 8) | |
537 | XCHAR2B_BYTE2 (s->char2b + from + i)); | |
538 | |
91011
7239c19e55e9
(xftfont_draw): If s->font_info != s->face->font_info,
Kenichi Handa <handa@m17n.org>
parents:
90959
diff
changeset
|
539 XftDrawGlyphs (xft_draw, &fg, xftfont_info->xftfont, |
90400 | 540 x, y, code, len); |
541 UNBLOCK_INPUT; | |
542 | |
543 return len; | |
544 } | |
545 | |
546 static int | |
547 xftfont_anchor_point (font, code, index, x, y) | |
548 struct font *font; | |
549 unsigned code; | |
550 int index; | |
551 int *x, *y; | |
552 { | |
553 struct xftfont_info *xftfont_info = (struct xftfont_info *) font; | |
554 FT_Face ft_face = xftfont_info->ft_face; | |
555 | |
556 if (FT_Load_Glyph (ft_face, code, FT_LOAD_DEFAULT) != 0) | |
557 return -1; | |
558 if (ft_face->glyph->format != FT_GLYPH_FORMAT_OUTLINE) | |
559 return -1; | |
560 if (index >= ft_face->glyph->outline.n_points) | |
561 return -1; | |
562 *x = ft_face->glyph->outline.points[index].x; | |
563 *y = ft_face->glyph->outline.points[index].y; | |
564 return 0; | |
565 } | |
566 | |
91110
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
567 static int |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
568 xftfont_end_for_frame (f) |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
569 FRAME_PTR f; |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
570 { |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
571 XftDraw *xft_draw = font_get_frame_data (f, &xftfont_driver); |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
572 |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
573 if (xft_draw) |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
574 { |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
575 BLOCK_INPUT; |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
576 XftDrawDestroy (xft_draw); |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
577 UNBLOCK_INPUT; |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
578 font_put_frame_data (f, &xftfont_driver, NULL); |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
579 } |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
580 return 0; |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
581 } |
90400 | 582 |
583 void | |
584 syms_of_xftfont () | |
585 { | |
586 DEFSYM (Qxft, "xft"); | |
587 | |
588 xftfont_driver = ftfont_driver; | |
589 xftfont_driver.type = Qxft; | |
590 xftfont_driver.get_cache = xfont_driver.get_cache; | |
591 xftfont_driver.list = xftfont_list; | |
90559
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
592 xftfont_driver.match = xftfont_match; |
90400 | 593 xftfont_driver.open = xftfont_open; |
594 xftfont_driver.close = xftfont_close; | |
595 xftfont_driver.prepare_face = xftfont_prepare_face; | |
596 xftfont_driver.done_face = xftfont_done_face; | |
597 xftfont_driver.encode_char = xftfont_encode_char; | |
598 xftfont_driver.text_extents = xftfont_text_extents; | |
599 xftfont_driver.draw = xftfont_draw; | |
600 xftfont_driver.anchor_point = xftfont_anchor_point; | |
91110
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
601 xftfont_driver.end_for_frame = xftfont_end_for_frame; |
90400 | 602 |
603 register_font_driver (&xftfont_driver, NULL); | |
604 } | |
90427 | 605 |
606 /* arch-tag: 64ec61bf-7c8e-4fe6-b953-c6a85d5e1605 | |
607 (do not change this comment) */ |