Mercurial > emacs
annotate src/xftfont.c @ 112085:19ad0830069c
* src/.gdbinit (xgetptr): Fix the union+lsb case.
(xbacktrace): Fix the union case.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Mon, 27 Dec 2010 10:27:52 -0500 |
parents | 8d403fa5e77d |
children | 1e7d8f405703 376148b31b5e |
rev | line source |
---|---|
90400 | 1 /* xftfont.c -- XFT font driver. |
106815 | 2 Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
3 Copyright (C) 2006, 2007, 2008, 2009, 2010 | |
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:
94941
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:
94941
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:
94941
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:
94941
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> | |
105669
68dd71358159
* alloc.c: Do not define struct catchtag.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103838
diff
changeset
|
24 #include <setjmp.h> |
90400 | 25 #include <X11/Xlib.h> |
26 #include <X11/Xft/Xft.h> | |
27 | |
28 #include "lisp.h" | |
29 #include "dispextern.h" | |
30 #include "xterm.h" | |
31 #include "frame.h" | |
32 #include "blockinput.h" | |
33 #include "character.h" | |
34 #include "charset.h" | |
111038
8d403fa5e77d
Fix incorrect font metrics when the same font is opened with different pixelsizes.
Kenichi Handa <handa@m17n.org>
parents:
109287
diff
changeset
|
35 #include "composite.h" |
90400 | 36 #include "fontset.h" |
37 #include "font.h" | |
91143 | 38 #include "ftfont.h" |
90400 | 39 |
40 /* Xft font driver. */ | |
41 | |
42 static Lisp_Object Qxft; | |
106558
3d091f151696
xftfont.c: Parse symbolic names for constants also.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106538
diff
changeset
|
43 static Lisp_Object QChinting, QCautohint, QChintstyle, QCrgba, QCembolden, |
3d091f151696
xftfont.c: Parse symbolic names for constants also.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106538
diff
changeset
|
44 QClcdfilter; |
90400 | 45 |
46 /* The actual structure for Xft font that can be casted to struct | |
47 font. */ | |
48 | |
49 struct xftfont_info | |
50 { | |
51 struct font font; | |
106538
500878bee91d
(struct xftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106290
diff
changeset
|
52 /* The following five members must be here in this order to be |
96562
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
53 compatible with struct ftfont_info (in ftfont.c). */ |
91143 | 54 #ifdef HAVE_LIBOTF |
55 int maybe_otf; /* Flag to tell if this may be OTF or not. */ | |
56 OTF *otf; | |
91163 | 57 #endif /* HAVE_LIBOTF */ |
96562
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
58 FT_Size ft_size; |
101555
a8e049b0d2c2
(struct xftfont_info): New member `index'.
Kenichi Handa <handa@m17n.org>
parents:
100951
diff
changeset
|
59 int index; |
106538
500878bee91d
(struct xftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106290
diff
changeset
|
60 FT_Matrix matrix; |
96562
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
61 Display *display; |
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
62 int screen; |
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
63 XftFont *xftfont; |
90400 | 64 }; |
65 | |
66 /* Structure pointed by (struct face *)->extra */ | |
90559
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
67 |
90400 | 68 struct xftface_info |
69 { | |
90559
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
70 XftColor xft_fg; /* color for face->foreground */ |
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
71 XftColor xft_bg; /* color for face->background */ |
90400 | 72 }; |
73 | |
74 static void xftfont_get_colors P_ ((FRAME_PTR, struct face *, GC gc, | |
75 struct xftface_info *, | |
76 XftColor *fg, XftColor *bg)); | |
77 | |
78 | |
90559
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
79 /* 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
|
80 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
|
81 may be NULL. */ |
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
82 |
90400 | 83 static void |
84 xftfont_get_colors (f, face, gc, xftface_info, fg, bg) | |
85 FRAME_PTR f; | |
86 struct face *face; | |
87 GC gc; | |
88 struct xftface_info *xftface_info; | |
89 XftColor *fg, *bg; | |
90 { | |
91 if (xftface_info && face->gc == gc) | |
92 { | |
93 *fg = xftface_info->xft_fg; | |
94 if (bg) | |
95 *bg = xftface_info->xft_bg; | |
96 } | |
97 else | |
98 { | |
99 XGCValues xgcv; | |
100 int fg_done = 0, bg_done = 0; | |
101 | |
102 BLOCK_INPUT; | |
103 XGetGCValues (FRAME_X_DISPLAY (f), gc, | |
104 GCForeground | GCBackground, &xgcv); | |
105 if (xftface_info) | |
106 { | |
107 if (xgcv.foreground == face->foreground) | |
108 *fg = xftface_info->xft_fg, fg_done = 1; | |
109 else if (xgcv.foreground == face->background) | |
110 *fg = xftface_info->xft_bg, fg_done = 1; | |
111 if (! bg) | |
112 bg_done = 1; | |
113 else if (xgcv.background == face->background) | |
114 *bg = xftface_info->xft_bg, bg_done = 1; | |
115 else if (xgcv.background == face->foreground) | |
116 *bg = xftface_info->xft_fg, bg_done = 1; | |
117 } | |
118 | |
119 if (fg_done + bg_done < 2) | |
120 { | |
121 XColor colors[2]; | |
122 | |
123 colors[0].pixel = fg->pixel = xgcv.foreground; | |
124 if (bg) | |
125 colors[1].pixel = bg->pixel = xgcv.background; | |
126 XQueryColors (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), colors, | |
127 bg ? 2 : 1); | |
128 fg->color.alpha = 0xFFFF; | |
129 fg->color.red = colors[0].red; | |
130 fg->color.green = colors[0].green; | |
131 fg->color.blue = colors[0].blue; | |
132 if (bg) | |
133 { | |
134 bg->color.alpha = 0xFFFF; | |
135 bg->color.red = colors[1].red; | |
136 bg->color.green = colors[1].green; | |
137 bg->color.blue = colors[1].blue; | |
138 } | |
139 } | |
140 UNBLOCK_INPUT; | |
141 } | |
142 } | |
143 | |
144 | |
145 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
|
146 static Lisp_Object xftfont_match P_ ((Lisp_Object, Lisp_Object)); |
94941
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
147 static Lisp_Object xftfont_open P_ ((FRAME_PTR, Lisp_Object, int)); |
90400 | 148 static void xftfont_close P_ ((FRAME_PTR, struct font *)); |
149 static int xftfont_prepare_face P_ ((FRAME_PTR, struct face *)); | |
150 static void xftfont_done_face P_ ((FRAME_PTR, struct face *)); | |
101640
6a674ba1901f
(xftfont_has_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
101555
diff
changeset
|
151 static int xftfont_has_char P_ ((Lisp_Object, int)); |
90400 | 152 static unsigned xftfont_encode_char P_ ((struct font *, int)); |
153 static int xftfont_text_extents P_ ((struct font *, unsigned *, int, | |
154 struct font_metrics *)); | |
155 static int xftfont_draw P_ ((struct glyph_string *, int, int, int, int, int)); | |
91110
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
156 static int xftfont_end_for_frame P_ ((FRAME_PTR f)); |
90400 | 157 |
158 struct font_driver xftfont_driver; | |
159 | |
160 static Lisp_Object | |
161 xftfont_list (frame, spec) | |
162 Lisp_Object frame; | |
163 Lisp_Object spec; | |
164 { | |
94941
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
165 Lisp_Object list = ftfont_driver.list (frame, spec), tail; |
101943
97c9e9322753
Remove spurious semicolons.
Juanma Barranquero <lekktu@gmail.com>
parents:
101640
diff
changeset
|
166 |
94941
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
167 for (tail = list; CONSP (tail); tail = XCDR (tail)) |
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
168 ASET (XCAR (tail), FONT_TYPE_INDEX, Qxft); |
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
169 return list; |
90559
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
170 } |
90400 | 171 |
90559
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
172 static Lisp_Object |
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
173 xftfont_match (frame, spec) |
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
174 Lisp_Object frame; |
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
175 Lisp_Object spec; |
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
176 { |
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
177 Lisp_Object entity = ftfont_driver.match (frame, spec); |
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
178 |
94941
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
179 if (! NILP (entity)) |
90559
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
180 ASET (entity, FONT_TYPE_INDEX, Qxft); |
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
181 return entity; |
90400 | 182 } |
183 | |
96431
abddf0a4cec0
(xftfont_open): Don't call FcConfigSubstitute and
Kenichi Handa <handa@m17n.org>
parents:
96146
diff
changeset
|
184 extern Lisp_Object ftfont_font_format P_ ((FcPattern *, Lisp_Object)); |
96562
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
185 extern FcCharSet *ftfont_get_fc_charset P_ ((Lisp_Object)); |
96075
3376493a3ad4
(QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents:
95293
diff
changeset
|
186 extern Lisp_Object QCantialias; |
90700
b165eceb829f
(ftfont_font_format): Extern declaration.
Kenichi Handa <handa@m17n.org>
parents:
90675
diff
changeset
|
187 |
90400 | 188 static FcChar8 ascii_printable[95]; |
189 | |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
190 static void |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
191 xftfont_fix_match (pat, match) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
192 FcPattern *pat, *match; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
193 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
194 /* These values are not used for matching (except antialias), but for |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
195 rendering, so make sure they are carried over to the match. |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
196 We also put antialias here because most fonts are antialiased, so |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
197 the match will have antialias true. */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
198 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
199 FcBool b = FcTrue; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
200 int i; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
201 double dpi; |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
202 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
203 FcPatternGetBool (pat, FC_ANTIALIAS, 0, &b); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
204 if (! b) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
205 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
206 FcPatternDel (match, FC_ANTIALIAS); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
207 FcPatternAddBool (match, FC_ANTIALIAS, FcFalse); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
208 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
209 FcPatternGetBool (pat, FC_HINTING, 0, &b); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
210 if (! b) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
211 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
212 FcPatternDel (match, FC_HINTING); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
213 FcPatternAddBool (match, FC_HINTING, FcFalse); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
214 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
215 if (FcResultMatch == FcPatternGetInteger (pat, FC_HINT_STYLE, 0, &i)) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
216 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
217 FcPatternDel (match, FC_HINT_STYLE); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
218 FcPatternAddInteger (match, FC_HINT_STYLE, i); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
219 } |
106092
6804c4648fee
* xftfont.c (xftfont_fix_match): Older versions of fontconfig does
Jan Djärv <jan.h.d@swipnet.se>
parents:
106089
diff
changeset
|
220 #ifndef FC_LCD_FILTER |
106089 | 221 /* Older fontconfig versions don't have FC_LCD_FILTER. */ |
106092
6804c4648fee
* xftfont.c (xftfont_fix_match): Older versions of fontconfig does
Jan Djärv <jan.h.d@swipnet.se>
parents:
106089
diff
changeset
|
222 #define FC_LCD_FILTER "lcdfilter" |
6804c4648fee
* xftfont.c (xftfont_fix_match): Older versions of fontconfig does
Jan Djärv <jan.h.d@swipnet.se>
parents:
106089
diff
changeset
|
223 #endif |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
224 if (FcResultMatch == FcPatternGetInteger (pat, FC_LCD_FILTER, 0, &i)) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
225 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
226 FcPatternDel (match, FC_LCD_FILTER); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
227 FcPatternAddInteger (match, FC_LCD_FILTER, i); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
228 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
229 if (FcResultMatch == FcPatternGetInteger (pat, FC_RGBA, 0, &i)) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
230 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
231 FcPatternDel (match, FC_RGBA); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
232 FcPatternAddInteger (match, FC_RGBA, i); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
233 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
234 if (FcResultMatch == FcPatternGetDouble (pat, FC_DPI, 0, &dpi)) |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
235 { |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
236 FcPatternDel (match, FC_DPI); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
237 FcPatternAddDouble (match, FC_DPI, dpi); |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
238 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
239 } |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
240 |
106755
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
241 static void |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
242 xftfont_add_rendering_parameters (pat, entity) |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
243 FcPattern *pat; |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
244 Lisp_Object entity; |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
245 { |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
246 Lisp_Object tail; |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
247 int ival; |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
248 |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
249 for (tail = AREF (entity, FONT_EXTRA_INDEX); CONSP (tail); tail = XCDR (tail)) |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
250 { |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
251 Lisp_Object key = XCAR (XCAR (tail)); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
252 Lisp_Object val = XCDR (XCAR (tail)); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
253 |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
254 if (EQ (key, QCantialias)) |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
255 FcPatternAddBool (pat, FC_ANTIALIAS, NILP (val) ? FcFalse : FcTrue); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
256 else if (EQ (key, QChinting)) |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
257 FcPatternAddBool (pat, FC_HINTING, NILP (val) ? FcFalse : FcTrue); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
258 else if (EQ (key, QCautohint)) |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
259 FcPatternAddBool (pat, FC_AUTOHINT, NILP (val) ? FcFalse : FcTrue); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
260 else if (EQ (key, QChintstyle)) |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
261 { |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
262 if (INTEGERP (val)) |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
263 FcPatternAddInteger (pat, FC_HINT_STYLE, XINT (val)); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
264 else if (SYMBOLP (val) |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
265 && FcNameConstant (SDATA (SYMBOL_NAME (val)), &ival)) |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
266 FcPatternAddInteger (pat, FC_HINT_STYLE, ival); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
267 } |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
268 else if (EQ (key, QCrgba)) |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
269 { |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
270 if (INTEGERP (val)) |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
271 FcPatternAddInteger (pat, FC_RGBA, XINT (val)); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
272 else if (SYMBOLP (val) |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
273 && FcNameConstant (SDATA (SYMBOL_NAME (val)), &ival)) |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
274 FcPatternAddInteger (pat, FC_RGBA, ival); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
275 } |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
276 else if (EQ (key, QClcdfilter)) |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
277 { |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
278 if (INTEGERP (val)) |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
279 FcPatternAddInteger (pat, FC_LCD_FILTER, ival = XINT (val)); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
280 else if (SYMBOLP (val) |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
281 && FcNameConstant (SDATA (SYMBOL_NAME (val)), &ival)) |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
282 FcPatternAddInteger (pat, FC_LCD_FILTER, ival); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
283 } |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
284 #ifdef FC_EMBOLDEN |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
285 else if (EQ (key, QCembolden)) |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
286 FcPatternAddBool (pat, FC_EMBOLDEN, NILP (val) ? FcFalse : FcTrue); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
287 #endif |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
288 } |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
289 } |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
290 |
94941
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
291 static Lisp_Object |
90400 | 292 xftfont_open (f, entity, pixel_size) |
293 FRAME_PTR f; | |
294 Lisp_Object entity; | |
295 int pixel_size; | |
296 { | |
96075
3376493a3ad4
(QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents:
95293
diff
changeset
|
297 FcResult result; |
90400 | 298 Display *display = FRAME_X_DISPLAY (f); |
106755
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
299 Lisp_Object val, filename, index, font_object; |
96075
3376493a3ad4
(QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents:
95293
diff
changeset
|
300 FcPattern *pat = NULL, *match; |
90460
86449661f321
(xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents:
90442
diff
changeset
|
301 struct xftfont_info *xftfont_info = NULL; |
90400 | 302 struct font *font; |
303 double size = 0; | |
90460
86449661f321
(xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents:
90442
diff
changeset
|
304 XftFont *xftfont = NULL; |
90400 | 305 int spacing; |
94941
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
306 char name[256]; |
106755
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
307 int len, i; |
90959
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
308 XGlyphInfo extents; |
91226
040f2e332dc3
(struct xftfont_info): Delete the member ft_face.
Kenichi Handa <handa@m17n.org>
parents:
91163
diff
changeset
|
309 FT_Face ft_face; |
106538
500878bee91d
(struct xftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106290
diff
changeset
|
310 FcMatrix *matrix; |
90400 | 311 |
94941
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
312 val = assq_no_quit (QCfont_entity, AREF (entity, FONT_EXTRA_INDEX)); |
95102
a3868b9c34f4
(xftfont_open): Ajusted for the change of extra info
Kenichi Handa <handa@m17n.org>
parents:
94963
diff
changeset
|
313 if (! CONSP (val)) |
94941
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
314 return Qnil; |
95102
a3868b9c34f4
(xftfont_open): Ajusted for the change of extra info
Kenichi Handa <handa@m17n.org>
parents:
94963
diff
changeset
|
315 val = XCDR (val); |
a3868b9c34f4
(xftfont_open): Ajusted for the change of extra info
Kenichi Handa <handa@m17n.org>
parents:
94963
diff
changeset
|
316 filename = XCAR (val); |
96562
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
317 index = XCDR (val); |
90400 | 318 size = XINT (AREF (entity, FONT_SIZE_INDEX)); |
319 if (size == 0) | |
320 size = pixel_size; | |
321 pat = FcPatternCreate (); | |
96075
3376493a3ad4
(QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents:
95293
diff
changeset
|
322 FcPatternAddInteger (pat, FC_WEIGHT, FONT_WEIGHT_NUMERIC (entity)); |
3376493a3ad4
(QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents:
95293
diff
changeset
|
323 i = FONT_SLANT_NUMERIC (entity) - 100; |
3376493a3ad4
(QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents:
95293
diff
changeset
|
324 if (i < 0) i = 0; |
3376493a3ad4
(QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents:
95293
diff
changeset
|
325 FcPatternAddInteger (pat, FC_SLANT, i); |
3376493a3ad4
(QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents:
95293
diff
changeset
|
326 FcPatternAddInteger (pat, FC_WIDTH, FONT_WIDTH_NUMERIC (entity)); |
90400 | 327 FcPatternAddDouble (pat, FC_PIXEL_SIZE, pixel_size); |
90714
698001835583
(xftfont_open): Call FcConfigSubstitute.
Kenichi Handa <handa@m17n.org>
parents:
90712
diff
changeset
|
328 val = AREF (entity, FONT_FAMILY_INDEX); |
698001835583
(xftfont_open): Call FcConfigSubstitute.
Kenichi Handa <handa@m17n.org>
parents:
90712
diff
changeset
|
329 if (! NILP (val)) |
698001835583
(xftfont_open): Call FcConfigSubstitute.
Kenichi Handa <handa@m17n.org>
parents:
90712
diff
changeset
|
330 FcPatternAddString (pat, FC_FAMILY, (FcChar8 *) SDATA (SYMBOL_NAME (val))); |
96094
0304b3142c84
(xftfont_open): Add FOUNDRY, SPACING, DPI, SCALABLE to the pattern.
Kenichi Handa <handa@m17n.org>
parents:
96075
diff
changeset
|
331 val = AREF (entity, FONT_FOUNDRY_INDEX); |
0304b3142c84
(xftfont_open): Add FOUNDRY, SPACING, DPI, SCALABLE to the pattern.
Kenichi Handa <handa@m17n.org>
parents:
96075
diff
changeset
|
332 if (! NILP (val)) |
0304b3142c84
(xftfont_open): Add FOUNDRY, SPACING, DPI, SCALABLE to the pattern.
Kenichi Handa <handa@m17n.org>
parents:
96075
diff
changeset
|
333 FcPatternAddString (pat, FC_FOUNDRY, (FcChar8 *) SDATA (SYMBOL_NAME (val))); |
0304b3142c84
(xftfont_open): Add FOUNDRY, SPACING, DPI, SCALABLE to the pattern.
Kenichi Handa <handa@m17n.org>
parents:
96075
diff
changeset
|
334 val = AREF (entity, FONT_SPACING_INDEX); |
0304b3142c84
(xftfont_open): Add FOUNDRY, SPACING, DPI, SCALABLE to the pattern.
Kenichi Handa <handa@m17n.org>
parents:
96075
diff
changeset
|
335 if (! NILP (val)) |
0304b3142c84
(xftfont_open): Add FOUNDRY, SPACING, DPI, SCALABLE to the pattern.
Kenichi Handa <handa@m17n.org>
parents:
96075
diff
changeset
|
336 FcPatternAddInteger (pat, FC_SPACING, XINT (val)); |
0304b3142c84
(xftfont_open): Add FOUNDRY, SPACING, DPI, SCALABLE to the pattern.
Kenichi Handa <handa@m17n.org>
parents:
96075
diff
changeset
|
337 val = AREF (entity, FONT_DPI_INDEX); |
0304b3142c84
(xftfont_open): Add FOUNDRY, SPACING, DPI, SCALABLE to the pattern.
Kenichi Handa <handa@m17n.org>
parents:
96075
diff
changeset
|
338 if (! NILP (val)) |
0304b3142c84
(xftfont_open): Add FOUNDRY, SPACING, DPI, SCALABLE to the pattern.
Kenichi Handa <handa@m17n.org>
parents:
96075
diff
changeset
|
339 { |
0304b3142c84
(xftfont_open): Add FOUNDRY, SPACING, DPI, SCALABLE to the pattern.
Kenichi Handa <handa@m17n.org>
parents:
96075
diff
changeset
|
340 double dbl = XINT (val); |
0304b3142c84
(xftfont_open): Add FOUNDRY, SPACING, DPI, SCALABLE to the pattern.
Kenichi Handa <handa@m17n.org>
parents:
96075
diff
changeset
|
341 |
0304b3142c84
(xftfont_open): Add FOUNDRY, SPACING, DPI, SCALABLE to the pattern.
Kenichi Handa <handa@m17n.org>
parents:
96075
diff
changeset
|
342 FcPatternAddDouble (pat, FC_DPI, dbl); |
0304b3142c84
(xftfont_open): Add FOUNDRY, SPACING, DPI, SCALABLE to the pattern.
Kenichi Handa <handa@m17n.org>
parents:
96075
diff
changeset
|
343 } |
0304b3142c84
(xftfont_open): Add FOUNDRY, SPACING, DPI, SCALABLE to the pattern.
Kenichi Handa <handa@m17n.org>
parents:
96075
diff
changeset
|
344 val = AREF (entity, FONT_AVGWIDTH_INDEX); |
0304b3142c84
(xftfont_open): Add FOUNDRY, SPACING, DPI, SCALABLE to the pattern.
Kenichi Handa <handa@m17n.org>
parents:
96075
diff
changeset
|
345 if (INTEGERP (val) && XINT (val) == 0) |
0304b3142c84
(xftfont_open): Add FOUNDRY, SPACING, DPI, SCALABLE to the pattern.
Kenichi Handa <handa@m17n.org>
parents:
96075
diff
changeset
|
346 FcPatternAddBool (pat, FC_SCALABLE, FcTrue); |
96562
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
347 /* This is necessary to identify the exact font (e.g. 10x20.pcf.gz |
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
348 over 10x20-ISO8859-1.pcf.gz). */ |
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
349 FcPatternAddCharSet (pat, FC_CHARSET, ftfont_get_fc_charset (entity)); |
96094
0304b3142c84
(xftfont_open): Add FOUNDRY, SPACING, DPI, SCALABLE to the pattern.
Kenichi Handa <handa@m17n.org>
parents:
96075
diff
changeset
|
350 |
106755
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
351 xftfont_add_rendering_parameters (pat, entity); |
90442
d6abf2344438
(xftfont_open): Make the font name fontconfig's
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
352 |
96562
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
353 FcPatternAddString (pat, FC_FILE, (FcChar8 *) SDATA (filename)); |
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
354 FcPatternAddInteger (pat, FC_INDEX, XINT (index)); |
101943
97c9e9322753
Remove spurious semicolons.
Juanma Barranquero <lekktu@gmail.com>
parents:
101640
diff
changeset
|
355 |
96562
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
356 |
90442
d6abf2344438
(xftfont_open): Make the font name fontconfig's
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
357 BLOCK_INPUT; |
103199
3b14cedd241f
(xftfont_open): Make sure that Xrender extension is added
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
102992
diff
changeset
|
358 /* Make sure that the Xrender extension is added before the Xft one. |
3b14cedd241f
(xftfont_open): Make sure that Xrender extension is added
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
102992
diff
changeset
|
359 Otherwise, the close-display hook set by Xft is called after the |
3b14cedd241f
(xftfont_open): Make sure that Xrender extension is added
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
102992
diff
changeset
|
360 one for Xrender, and the former tries to re-add the latter. This |
3b14cedd241f
(xftfont_open): Make sure that Xrender extension is added
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
102992
diff
changeset
|
361 results in inconsistency of internal states and leads to X |
3b14cedd241f
(xftfont_open): Make sure that Xrender extension is added
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
102992
diff
changeset
|
362 protocol error when one reconnects to the same X server. |
3b14cedd241f
(xftfont_open): Make sure that Xrender extension is added
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
102992
diff
changeset
|
363 (Bug#1696) */ |
3b14cedd241f
(xftfont_open): Make sure that Xrender extension is added
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
102992
diff
changeset
|
364 { |
3b14cedd241f
(xftfont_open): Make sure that Xrender extension is added
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
102992
diff
changeset
|
365 int event_base, error_base; |
3b14cedd241f
(xftfont_open): Make sure that Xrender extension is added
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
102992
diff
changeset
|
366 XRenderQueryExtension (display, &event_base, &error_base); |
3b14cedd241f
(xftfont_open): Make sure that Xrender extension is added
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
102992
diff
changeset
|
367 } |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
368 |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
369 /* Substitute in values from X resources and XftDefaultSet. */ |
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
370 XftDefaultSubstitute (display, FRAME_X_SCREEN_NUMBER (f), pat); |
96075
3376493a3ad4
(QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents:
95293
diff
changeset
|
371 match = XftFontMatch (display, FRAME_X_SCREEN_NUMBER (f), pat, &result); |
106085
cd4cbab8bb21
Handle system default font and changing font parameters.
Jan Djärv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
372 xftfont_fix_match (pat, match); |
106558
3d091f151696
xftfont.c: Parse symbolic names for constants also.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106538
diff
changeset
|
373 |
96075
3376493a3ad4
(QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents:
95293
diff
changeset
|
374 FcPatternDestroy (pat); |
3376493a3ad4
(QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents:
95293
diff
changeset
|
375 xftfont = XftFontOpenPattern (display, match); |
103650
e561e9f73ad4
* xftfont.c (xftfont_open): Avoid passing NULL argument to
Chong Yidong <cyd@stupidchicken.com>
parents:
103199
diff
changeset
|
376 if (!xftfont) |
e561e9f73ad4
* xftfont.c (xftfont_open): Avoid passing NULL argument to
Chong Yidong <cyd@stupidchicken.com>
parents:
103199
diff
changeset
|
377 { |
e561e9f73ad4
* xftfont.c (xftfont_open): Avoid passing NULL argument to
Chong Yidong <cyd@stupidchicken.com>
parents:
103199
diff
changeset
|
378 UNBLOCK_INPUT; |
e561e9f73ad4
* xftfont.c (xftfont_open): Avoid passing NULL argument to
Chong Yidong <cyd@stupidchicken.com>
parents:
103199
diff
changeset
|
379 XftPatternDestroy (match); |
e561e9f73ad4
* xftfont.c (xftfont_open): Avoid passing NULL argument to
Chong Yidong <cyd@stupidchicken.com>
parents:
103199
diff
changeset
|
380 return Qnil; |
e561e9f73ad4
* xftfont.c (xftfont_open): Avoid passing NULL argument to
Chong Yidong <cyd@stupidchicken.com>
parents:
103199
diff
changeset
|
381 } |
96562
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
382 ft_face = XftLockFace (xftfont); |
94941
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
383 UNBLOCK_INPUT; |
96075
3376493a3ad4
(QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents:
95293
diff
changeset
|
384 |
90400 | 385 /* We should not destroy PAT here because it is kept in XFTFONT and |
386 destroyed automatically when XFTFONT is closed. */ | |
96562
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
387 font_object = font_make_object (VECSIZE (struct xftfont_info), entity, size); |
94941
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
388 ASET (font_object, FONT_TYPE_INDEX, Qxft); |
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
389 len = font_unparse_xlfd (entity, size, name, 256); |
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
390 if (len > 0) |
100551
42e9e426d886
(xftfont_open): Genarate a multibyte string if give names are utf-8.
Kenichi Handa <handa@m17n.org>
parents:
100427
diff
changeset
|
391 ASET (font_object, FONT_NAME_INDEX, make_string (name, len)); |
94941
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
392 len = font_unparse_fcname (entity, size, name, 256); |
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
393 if (len > 0) |
100551
42e9e426d886
(xftfont_open): Genarate a multibyte string if give names are utf-8.
Kenichi Handa <handa@m17n.org>
parents:
100427
diff
changeset
|
394 ASET (font_object, FONT_FULLNAME_INDEX, make_string (name, len)); |
94941
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
395 else |
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
396 ASET (font_object, FONT_FULLNAME_INDEX, |
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
397 AREF (font_object, FONT_NAME_INDEX)); |
95102
a3868b9c34f4
(xftfont_open): Ajusted for the change of extra info
Kenichi Handa <handa@m17n.org>
parents:
94963
diff
changeset
|
398 ASET (font_object, FONT_FILE_INDEX, filename); |
a3868b9c34f4
(xftfont_open): Ajusted for the change of extra info
Kenichi Handa <handa@m17n.org>
parents:
94963
diff
changeset
|
399 ASET (font_object, FONT_FORMAT_INDEX, |
96431
abddf0a4cec0
(xftfont_open): Don't call FcConfigSubstitute and
Kenichi Handa <handa@m17n.org>
parents:
96146
diff
changeset
|
400 ftfont_font_format (xftfont->pattern, filename)); |
94941
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
401 font = XFONT_OBJECT (font_object); |
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
402 font->pixel_size = pixel_size; |
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
403 font->driver = &xftfont_driver; |
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
404 font->encoding_charset = font->repertory_charset = -1; |
90400 | 405 |
94941
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
406 xftfont_info = (struct xftfont_info *) font; |
90400 | 407 xftfont_info->display = display; |
408 xftfont_info->screen = FRAME_X_SCREEN_NUMBER (f); | |
409 xftfont_info->xftfont = xftfont; | |
106538
500878bee91d
(struct xftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106290
diff
changeset
|
410 /* This means that there's no need of transformation. */ |
500878bee91d
(struct xftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106290
diff
changeset
|
411 xftfont_info->matrix.xx = 0; |
500878bee91d
(struct xftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106290
diff
changeset
|
412 if (FcPatternGetMatrix (xftfont->pattern, FC_MATRIX, 0, &matrix) |
500878bee91d
(struct xftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106290
diff
changeset
|
413 == FcResultMatch) |
500878bee91d
(struct xftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106290
diff
changeset
|
414 { |
500878bee91d
(struct xftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106290
diff
changeset
|
415 xftfont_info->matrix.xx = 0x10000L * matrix->xx; |
500878bee91d
(struct xftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106290
diff
changeset
|
416 xftfont_info->matrix.yy = 0x10000L * matrix->yy; |
500878bee91d
(struct xftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106290
diff
changeset
|
417 xftfont_info->matrix.xy = 0x10000L * matrix->xy; |
500878bee91d
(struct xftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106290
diff
changeset
|
418 xftfont_info->matrix.yx = 0x10000L * matrix->yx; |
500878bee91d
(struct xftfont_info): New member matrix.
Kenichi Handa <handa@m17n.org>
parents:
106290
diff
changeset
|
419 } |
90400 | 420 font->pixel_size = size; |
421 font->driver = &xftfont_driver; | |
95102
a3868b9c34f4
(xftfont_open): Ajusted for the change of extra info
Kenichi Handa <handa@m17n.org>
parents:
94963
diff
changeset
|
422 if (INTEGERP (AREF (entity, FONT_SPACING_INDEX))) |
a3868b9c34f4
(xftfont_open): Ajusted for the change of extra info
Kenichi Handa <handa@m17n.org>
parents:
94963
diff
changeset
|
423 spacing = XINT (AREF (entity, FONT_SPACING_INDEX)); |
a3868b9c34f4
(xftfont_open): Ajusted for the change of extra info
Kenichi Handa <handa@m17n.org>
parents:
94963
diff
changeset
|
424 else |
90400 | 425 spacing = FC_PROPORTIONAL; |
90959
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
426 if (! ascii_printable[0]) |
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
427 { |
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
428 int i; |
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
429 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
|
430 ascii_printable[i] = ' ' + i; |
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
431 } |
94941
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
432 BLOCK_INPUT; |
109287
a18863f338c2
Check FC_DUAL too. For such fonts, check width one by one (Bug#4129).
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
433 if (spacing != FC_PROPORTIONAL && spacing != FC_DUAL) |
90959
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
434 { |
94941
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
435 font->min_width = font->average_width = font->space_width |
90959
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
436 = xftfont->max_advance_width; |
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
437 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
|
438 } |
90400 | 439 else |
440 { | |
441 XftTextExtents8 (display, xftfont, ascii_printable, 1, &extents); | |
94941
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
442 font->space_width = extents.xOff; |
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
443 if (font->space_width <= 0) |
90400 | 444 /* dirty workaround */ |
101943
97c9e9322753
Remove spurious semicolons.
Juanma Barranquero <lekktu@gmail.com>
parents:
101640
diff
changeset
|
445 font->space_width = pixel_size; |
90400 | 446 XftTextExtents8 (display, xftfont, ascii_printable + 1, 94, &extents); |
94941
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
447 font->average_width = (font->space_width + extents.xOff) / 95; |
90400 | 448 } |
90442
d6abf2344438
(xftfont_open): Make the font name fontconfig's
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
449 UNBLOCK_INPUT; |
90400 | 450 |
90959
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
451 font->ascent = xftfont->ascent; |
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
452 font->descent = xftfont->descent; |
96075
3376493a3ad4
(QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents:
95293
diff
changeset
|
453 if (pixel_size >= 5) |
3376493a3ad4
(QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents:
95293
diff
changeset
|
454 { |
3376493a3ad4
(QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents:
95293
diff
changeset
|
455 /* The above condition is a dirty workaround because |
3376493a3ad4
(QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents:
95293
diff
changeset
|
456 XftTextExtents8 behaves strangely for some fonts |
3376493a3ad4
(QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents:
95293
diff
changeset
|
457 (e.g. "Dejavu Sans Mono") when pixel_size is less than 5. */ |
3376493a3ad4
(QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents:
95293
diff
changeset
|
458 if (font->ascent < extents.y) |
3376493a3ad4
(QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents:
95293
diff
changeset
|
459 font->ascent = extents.y; |
3376493a3ad4
(QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents:
95293
diff
changeset
|
460 if (font->descent < extents.height - extents.y) |
3376493a3ad4
(QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents:
95293
diff
changeset
|
461 font->descent = extents.height - extents.y; |
3376493a3ad4
(QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents:
95293
diff
changeset
|
462 } |
94941
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
463 font->height = font->ascent + font->descent; |
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
464 |
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
465 if (XINT (AREF (entity, FONT_SIZE_INDEX)) == 0) |
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
466 { |
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
467 int upEM = ft_face->units_per_EM; |
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
468 |
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
469 font->underline_position = -ft_face->underline_position * size / upEM; |
102861
0ea82e792866
(xftfont_open): Fix setting font->underline_thickness.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
470 font->underline_thickness = ft_face->underline_thickness * size / upEM; |
95293
089ad7a58f94
(xftfont_open): Delete unused variable. If
Kenichi Handa <handa@m17n.org>
parents:
95102
diff
changeset
|
471 if (font->underline_thickness > 2) |
089ad7a58f94
(xftfont_open): Delete unused variable. If
Kenichi Handa <handa@m17n.org>
parents:
95102
diff
changeset
|
472 font->underline_position -= font->underline_thickness / 2; |
94941
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
473 } |
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
474 else |
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
475 { |
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
476 font->underline_position = -1; |
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
477 font->underline_thickness = 0; |
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
478 } |
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
479 #ifdef HAVE_LIBOTF |
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
480 xftfont_info->maybe_otf = ft_face->face_flags & FT_FACE_FLAG_SFNT; |
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
481 xftfont_info->otf = NULL; |
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
482 #endif /* HAVE_LIBOTF */ |
96562
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
483 xftfont_info->ft_size = ft_face->size; |
90959
3f83c9d3f96c
(xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents:
90714
diff
changeset
|
484 |
90400 | 485 /* Unfortunately Xft doesn't provide a way to get minimum char |
486 width. So, we use space_width instead. */ | |
94941
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
487 font->min_width = font->space_width; |
90400 | 488 |
94941
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
489 font->baseline_offset = 0; |
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
490 font->relative_compose = 0; |
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
491 font->default_ascent = 0; |
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
492 font->vertical_centering = 0; |
96562
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
493 #ifdef FT_BDF_H |
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
494 if (! (ft_face->face_flags & FT_FACE_FLAG_SFNT)) |
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
495 { |
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
496 BDF_PropertyRec rec; |
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
497 |
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
498 if (FT_Get_BDF_Property (ft_face, "_MULE_BASELINE_OFFSET", &rec) == 0 |
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
499 && rec.type == BDF_PROPERTY_TYPE_INTEGER) |
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
500 font->baseline_offset = rec.u.integer; |
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
501 if (FT_Get_BDF_Property (ft_face, "_MULE_RELATIVE_COMPOSE", &rec) == 0 |
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
502 && rec.type == BDF_PROPERTY_TYPE_INTEGER) |
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
503 font->relative_compose = rec.u.integer; |
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
504 if (FT_Get_BDF_Property (ft_face, "_MULE_DEFAULT_ASCENT", &rec) == 0 |
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
505 && rec.type == BDF_PROPERTY_TYPE_INTEGER) |
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
506 font->default_ascent = rec.u.integer; |
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
507 } |
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
508 #endif |
90400 | 509 |
94941
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
510 return font_object; |
90400 | 511 } |
512 | |
513 static void | |
514 xftfont_close (f, font) | |
515 FRAME_PTR f; | |
516 struct font *font; | |
517 { | |
518 struct xftfont_info *xftfont_info = (struct xftfont_info *) font; | |
519 | |
91143 | 520 #ifdef HAVE_LIBOTF |
521 if (xftfont_info->otf) | |
522 OTF_close (xftfont_info->otf); | |
523 #endif | |
94941
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
524 BLOCK_INPUT; |
96562
ea11c7e02573
(struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents:
96431
diff
changeset
|
525 XftUnlockFace (xftfont_info->xftfont); |
90400 | 526 XftFontClose (xftfont_info->display, xftfont_info->xftfont); |
94941
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
527 UNBLOCK_INPUT; |
90400 | 528 } |
529 | |
530 static int | |
531 xftfont_prepare_face (f, face) | |
532 FRAME_PTR f; | |
533 struct face *face; | |
534 { | |
90489
78a820ef12db
(xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents:
90473
diff
changeset
|
535 struct xftface_info *xftface_info; |
90400 | 536 |
90499
32b8f672da38
(xftfont_prepare_face): Cancel previous change.
Kenichi Handa <handa@m17n.org>
parents:
90489
diff
changeset
|
537 #if 0 |
32b8f672da38
(xftfont_prepare_face): Cancel previous change.
Kenichi Handa <handa@m17n.org>
parents:
90489
diff
changeset
|
538 /* 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
|
539 if (face != face->ascii_face) |
78a820ef12db
(xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents:
90473
diff
changeset
|
540 { |
78a820ef12db
(xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents:
90473
diff
changeset
|
541 face->extra = face->ascii_face->extra; |
78a820ef12db
(xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents:
90473
diff
changeset
|
542 return 0; |
78a820ef12db
(xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents:
90473
diff
changeset
|
543 } |
90499
32b8f672da38
(xftfont_prepare_face): Cancel previous change.
Kenichi Handa <handa@m17n.org>
parents:
90489
diff
changeset
|
544 #endif |
90489
78a820ef12db
(xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents:
90473
diff
changeset
|
545 |
78a820ef12db
(xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents:
90473
diff
changeset
|
546 xftface_info = malloc (sizeof (struct xftface_info)); |
90400 | 547 if (! xftface_info) |
548 return -1; | |
549 xftfont_get_colors (f, face, face->gc, NULL, | |
550 &xftface_info->xft_fg, &xftface_info->xft_bg); | |
551 face->extra = xftface_info; | |
552 return 0; | |
553 } | |
554 | |
555 static void | |
556 xftfont_done_face (f, face) | |
557 FRAME_PTR f; | |
558 struct face *face; | |
559 { | |
90489
78a820ef12db
(xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents:
90473
diff
changeset
|
560 struct xftface_info *xftface_info; |
101943
97c9e9322753
Remove spurious semicolons.
Juanma Barranquero <lekktu@gmail.com>
parents:
101640
diff
changeset
|
561 |
90499
32b8f672da38
(xftfont_prepare_face): Cancel previous change.
Kenichi Handa <handa@m17n.org>
parents:
90489
diff
changeset
|
562 #if 0 |
32b8f672da38
(xftfont_prepare_face): Cancel previous change.
Kenichi Handa <handa@m17n.org>
parents:
90489
diff
changeset
|
563 /* 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
|
564 if (face != face->ascii_face |
78a820ef12db
(xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents:
90473
diff
changeset
|
565 || ! face->extra) |
78a820ef12db
(xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents:
90473
diff
changeset
|
566 return; |
90499
32b8f672da38
(xftfont_prepare_face): Cancel previous change.
Kenichi Handa <handa@m17n.org>
parents:
90489
diff
changeset
|
567 #endif |
90400 | 568 |
90489
78a820ef12db
(xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents:
90473
diff
changeset
|
569 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
|
570 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
|
571 { |
63b888896eba
* xftfont.c (xftfont_done_face): Call XftDrawDestroy only if xftface_info
Jan Djärv <jan.h.d@swipnet.se>
parents:
90511
diff
changeset
|
572 free (xftface_info); |
91110
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
573 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
|
574 } |
90400 | 575 } |
576 | |
102992
64cdf8a83bdd
(xftfont_has_char): Special handling of `ja' and `ko' adstyle.
Kenichi Handa <handa@m17n.org>
parents:
102861
diff
changeset
|
577 extern Lisp_Object Qja, Qko; |
64cdf8a83bdd
(xftfont_has_char): Special handling of `ja' and `ko' adstyle.
Kenichi Handa <handa@m17n.org>
parents:
102861
diff
changeset
|
578 |
101640
6a674ba1901f
(xftfont_has_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
101555
diff
changeset
|
579 static int |
6a674ba1901f
(xftfont_has_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
101555
diff
changeset
|
580 xftfont_has_char (font, c) |
6a674ba1901f
(xftfont_has_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
101555
diff
changeset
|
581 Lisp_Object font; |
6a674ba1901f
(xftfont_has_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
101555
diff
changeset
|
582 int c; |
6a674ba1901f
(xftfont_has_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
101555
diff
changeset
|
583 { |
6a674ba1901f
(xftfont_has_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
101555
diff
changeset
|
584 struct xftfont_info *xftfont_info; |
102992
64cdf8a83bdd
(xftfont_has_char): Special handling of `ja' and `ko' adstyle.
Kenichi Handa <handa@m17n.org>
parents:
102861
diff
changeset
|
585 struct charset *cs = NULL; |
101640
6a674ba1901f
(xftfont_has_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
101555
diff
changeset
|
586 |
102992
64cdf8a83bdd
(xftfont_has_char): Special handling of `ja' and `ko' adstyle.
Kenichi Handa <handa@m17n.org>
parents:
102861
diff
changeset
|
587 if (EQ (AREF (font, FONT_ADSTYLE_INDEX), Qja) |
64cdf8a83bdd
(xftfont_has_char): Special handling of `ja' and `ko' adstyle.
Kenichi Handa <handa@m17n.org>
parents:
102861
diff
changeset
|
588 && charset_jisx0208 >= 0) |
64cdf8a83bdd
(xftfont_has_char): Special handling of `ja' and `ko' adstyle.
Kenichi Handa <handa@m17n.org>
parents:
102861
diff
changeset
|
589 cs = CHARSET_FROM_ID (charset_jisx0208); |
64cdf8a83bdd
(xftfont_has_char): Special handling of `ja' and `ko' adstyle.
Kenichi Handa <handa@m17n.org>
parents:
102861
diff
changeset
|
590 else if (EQ (AREF (font, FONT_ADSTYLE_INDEX), Qko) |
64cdf8a83bdd
(xftfont_has_char): Special handling of `ja' and `ko' adstyle.
Kenichi Handa <handa@m17n.org>
parents:
102861
diff
changeset
|
591 && charset_ksc5601 >= 0) |
64cdf8a83bdd
(xftfont_has_char): Special handling of `ja' and `ko' adstyle.
Kenichi Handa <handa@m17n.org>
parents:
102861
diff
changeset
|
592 cs = CHARSET_FROM_ID (charset_ksc5601); |
64cdf8a83bdd
(xftfont_has_char): Special handling of `ja' and `ko' adstyle.
Kenichi Handa <handa@m17n.org>
parents:
102861
diff
changeset
|
593 if (cs) |
64cdf8a83bdd
(xftfont_has_char): Special handling of `ja' and `ko' adstyle.
Kenichi Handa <handa@m17n.org>
parents:
102861
diff
changeset
|
594 return (ENCODE_CHAR (cs, c) != CHARSET_INVALID_CODE (cs)); |
64cdf8a83bdd
(xftfont_has_char): Special handling of `ja' and `ko' adstyle.
Kenichi Handa <handa@m17n.org>
parents:
102861
diff
changeset
|
595 |
103838
a7805f91abdd
(xftfont_open): Fix typo: FC_RGBA->FC_HINT_STYLE.
Kenichi Handa <handa@m17n.org>
parents:
103650
diff
changeset
|
596 if (FONT_ENTITY_P (font)) |
a7805f91abdd
(xftfont_open): Fix typo: FC_RGBA->FC_HINT_STYLE.
Kenichi Handa <handa@m17n.org>
parents:
103650
diff
changeset
|
597 return ftfont_driver.has_char (font, c); |
101640
6a674ba1901f
(xftfont_has_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
101555
diff
changeset
|
598 xftfont_info = (struct xftfont_info *) XFONT_OBJECT (font); |
6a674ba1901f
(xftfont_has_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
101555
diff
changeset
|
599 return (XftCharExists (xftfont_info->display, xftfont_info->xftfont, |
6a674ba1901f
(xftfont_has_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
101555
diff
changeset
|
600 (FcChar32) c) == FcTrue); |
6a674ba1901f
(xftfont_has_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
101555
diff
changeset
|
601 } |
6a674ba1901f
(xftfont_has_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
101555
diff
changeset
|
602 |
90400 | 603 static unsigned |
604 xftfont_encode_char (font, c) | |
605 struct font *font; | |
606 int c; | |
607 { | |
608 struct xftfont_info *xftfont_info = (struct xftfont_info *) font; | |
609 unsigned code = XftCharIndex (xftfont_info->display, xftfont_info->xftfont, | |
610 (FcChar32) c); | |
101943
97c9e9322753
Remove spurious semicolons.
Juanma Barranquero <lekktu@gmail.com>
parents:
101640
diff
changeset
|
611 |
91269
421d7c7d296a
(xftfont_encode_char): Use the macro FONT_INVALID_CODE.
Kenichi Handa <handa@m17n.org>
parents:
91243
diff
changeset
|
612 return (code ? code : FONT_INVALID_CODE); |
90400 | 613 } |
614 | |
615 static int | |
616 xftfont_text_extents (font, code, nglyphs, metrics) | |
617 struct font *font; | |
618 unsigned *code; | |
619 int nglyphs; | |
620 struct font_metrics *metrics; | |
621 { | |
622 struct xftfont_info *xftfont_info = (struct xftfont_info *) font; | |
623 XGlyphInfo extents; | |
624 | |
625 BLOCK_INPUT; | |
626 XftGlyphExtents (xftfont_info->display, xftfont_info->xftfont, code, nglyphs, | |
627 &extents); | |
628 UNBLOCK_INPUT; | |
629 if (metrics) | |
630 { | |
631 metrics->lbearing = - extents.x; | |
632 metrics->rbearing = - extents.x + extents.width; | |
633 metrics->width = extents.xOff; | |
634 metrics->ascent = extents.y; | |
90616
68d59ef20174
(xftfont_text_extents): Fix calculation of descent
Kenichi Handa <handa@m17n.org>
parents:
90589
diff
changeset
|
635 metrics->descent = extents.height - extents.y; |
90400 | 636 } |
637 return extents.xOff; | |
638 } | |
639 | |
91110
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
640 static XftDraw * |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
641 xftfont_get_xft_draw (f) |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
642 FRAME_PTR f; |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
643 { |
101943
97c9e9322753
Remove spurious semicolons.
Juanma Barranquero <lekktu@gmail.com>
parents:
101640
diff
changeset
|
644 XftDraw *xft_draw = font_get_frame_data (f, &xftfont_driver); |
91110
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
645 |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
646 if (! xft_draw) |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
647 { |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
648 BLOCK_INPUT; |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
649 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
|
650 FRAME_X_WINDOW (f), |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
651 FRAME_X_VISUAL (f), |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
652 FRAME_X_COLORMAP (f)); |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
653 UNBLOCK_INPUT; |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
654 if (! xft_draw) |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
655 abort (); |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
656 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
|
657 } |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
658 return xft_draw; |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
659 } |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
660 |
90400 | 661 static int |
662 xftfont_draw (s, from, to, x, y, with_background) | |
663 struct glyph_string *s; | |
664 int from, to, x, y, with_background; | |
665 { | |
666 FRAME_PTR f = s->f; | |
667 struct face *face = s->face; | |
94941
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
668 struct xftfont_info *xftfont_info = (struct xftfont_info *) s->font; |
91011
7239c19e55e9
(xftfont_draw): If s->font_info != s->face->font_info,
Kenichi Handa <handa@m17n.org>
parents:
90959
diff
changeset
|
669 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
|
670 XftDraw *xft_draw = xftfont_get_xft_draw (f); |
90400 | 671 FT_UInt *code; |
672 XftColor fg, bg; | |
673 int len = to - from; | |
674 int i; | |
675 | |
94941
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
676 if (s->font == face->font) |
91110
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
677 xftface_info = (struct xftface_info *) face->extra; |
90400 | 678 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
|
679 &fg, with_background ? &bg : NULL); |
90400 | 680 BLOCK_INPUT; |
91027
04b81a720da9
(xftfont_draw): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
91011
diff
changeset
|
681 if (s->num_clips > 0) |
04b81a720da9
(xftfont_draw): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
91011
diff
changeset
|
682 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
|
683 else |
04b81a720da9
(xftfont_draw): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
91011
diff
changeset
|
684 XftDrawSetClip (xft_draw, NULL); |
04b81a720da9
(xftfont_draw): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents:
91011
diff
changeset
|
685 |
90400 | 686 if (with_background) |
94941
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
687 XftDrawRect (xft_draw, &bg, |
8cbdb26068b4
(xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents:
92184
diff
changeset
|
688 x, y - face->font->ascent, s->width, face->font->height); |
90400 | 689 code = alloca (sizeof (FT_UInt) * len); |
690 for (i = 0; i < len; i++) | |
691 code[i] = ((XCHAR2B_BYTE1 (s->char2b + from + i) << 8) | |
692 | XCHAR2B_BYTE2 (s->char2b + from + i)); | |
693 | |
92184
6218afb021ac
(xftfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91907
diff
changeset
|
694 if (s->padding_p) |
6218afb021ac
(xftfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91907
diff
changeset
|
695 for (i = 0; i < len; i++) |
6218afb021ac
(xftfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91907
diff
changeset
|
696 XftDrawGlyphs (xft_draw, &fg, xftfont_info->xftfont, |
6218afb021ac
(xftfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91907
diff
changeset
|
697 x + i, y, code + i, 1); |
6218afb021ac
(xftfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91907
diff
changeset
|
698 else |
6218afb021ac
(xftfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91907
diff
changeset
|
699 XftDrawGlyphs (xft_draw, &fg, xftfont_info->xftfont, |
6218afb021ac
(xftfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
91907
diff
changeset
|
700 x, y, code, len); |
90400 | 701 UNBLOCK_INPUT; |
702 | |
703 return len; | |
704 } | |
705 | |
111038
8d403fa5e77d
Fix incorrect font metrics when the same font is opened with different pixelsizes.
Kenichi Handa <handa@m17n.org>
parents:
109287
diff
changeset
|
706 Lisp_Object |
8d403fa5e77d
Fix incorrect font metrics when the same font is opened with different pixelsizes.
Kenichi Handa <handa@m17n.org>
parents:
109287
diff
changeset
|
707 xftfont_shape (Lisp_Object lgstring) |
8d403fa5e77d
Fix incorrect font metrics when the same font is opened with different pixelsizes.
Kenichi Handa <handa@m17n.org>
parents:
109287
diff
changeset
|
708 { |
8d403fa5e77d
Fix incorrect font metrics when the same font is opened with different pixelsizes.
Kenichi Handa <handa@m17n.org>
parents:
109287
diff
changeset
|
709 struct font *font; |
8d403fa5e77d
Fix incorrect font metrics when the same font is opened with different pixelsizes.
Kenichi Handa <handa@m17n.org>
parents:
109287
diff
changeset
|
710 struct xftfont_info *xftfont_info; |
8d403fa5e77d
Fix incorrect font metrics when the same font is opened with different pixelsizes.
Kenichi Handa <handa@m17n.org>
parents:
109287
diff
changeset
|
711 FT_Face ft_face; |
8d403fa5e77d
Fix incorrect font metrics when the same font is opened with different pixelsizes.
Kenichi Handa <handa@m17n.org>
parents:
109287
diff
changeset
|
712 Lisp_Object val; |
8d403fa5e77d
Fix incorrect font metrics when the same font is opened with different pixelsizes.
Kenichi Handa <handa@m17n.org>
parents:
109287
diff
changeset
|
713 |
8d403fa5e77d
Fix incorrect font metrics when the same font is opened with different pixelsizes.
Kenichi Handa <handa@m17n.org>
parents:
109287
diff
changeset
|
714 CHECK_FONT_GET_OBJECT (LGSTRING_FONT (lgstring), font); |
8d403fa5e77d
Fix incorrect font metrics when the same font is opened with different pixelsizes.
Kenichi Handa <handa@m17n.org>
parents:
109287
diff
changeset
|
715 xftfont_info = (struct xftfont_info *) font; |
8d403fa5e77d
Fix incorrect font metrics when the same font is opened with different pixelsizes.
Kenichi Handa <handa@m17n.org>
parents:
109287
diff
changeset
|
716 ft_face = XftLockFace (xftfont_info->xftfont); |
8d403fa5e77d
Fix incorrect font metrics when the same font is opened with different pixelsizes.
Kenichi Handa <handa@m17n.org>
parents:
109287
diff
changeset
|
717 xftfont_info->ft_size = ft_face->size; |
8d403fa5e77d
Fix incorrect font metrics when the same font is opened with different pixelsizes.
Kenichi Handa <handa@m17n.org>
parents:
109287
diff
changeset
|
718 val = ftfont_driver.shape (lgstring); |
8d403fa5e77d
Fix incorrect font metrics when the same font is opened with different pixelsizes.
Kenichi Handa <handa@m17n.org>
parents:
109287
diff
changeset
|
719 XftUnlockFace (xftfont_info->xftfont); |
8d403fa5e77d
Fix incorrect font metrics when the same font is opened with different pixelsizes.
Kenichi Handa <handa@m17n.org>
parents:
109287
diff
changeset
|
720 return val; |
8d403fa5e77d
Fix incorrect font metrics when the same font is opened with different pixelsizes.
Kenichi Handa <handa@m17n.org>
parents:
109287
diff
changeset
|
721 } |
8d403fa5e77d
Fix incorrect font metrics when the same font is opened with different pixelsizes.
Kenichi Handa <handa@m17n.org>
parents:
109287
diff
changeset
|
722 |
90400 | 723 static int |
91110
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
724 xftfont_end_for_frame (f) |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
725 FRAME_PTR f; |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
726 { |
106290
8671036bedc4
Don't crash if an X terminal is deleted with force == t.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106092
diff
changeset
|
727 XftDraw *xft_draw; |
8671036bedc4
Don't crash if an X terminal is deleted with force == t.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106092
diff
changeset
|
728 |
8671036bedc4
Don't crash if an X terminal is deleted with force == t.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106092
diff
changeset
|
729 /* Don't do anything if display is dead */ |
8671036bedc4
Don't crash if an X terminal is deleted with force == t.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106092
diff
changeset
|
730 if (FRAME_X_DISPLAY (f) == NULL) return 0; |
8671036bedc4
Don't crash if an X terminal is deleted with force == t.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106092
diff
changeset
|
731 |
8671036bedc4
Don't crash if an X terminal is deleted with force == t.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106092
diff
changeset
|
732 xft_draw = font_get_frame_data (f, &xftfont_driver); |
91110
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
733 |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
734 if (xft_draw) |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
735 { |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
736 BLOCK_INPUT; |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
737 XftDrawDestroy (xft_draw); |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
738 UNBLOCK_INPUT; |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
739 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
|
740 } |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
741 return 0; |
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
742 } |
90400 | 743 |
106755
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
744 static int |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
745 xftfont_cached_font_ok (f, font_object, entity) |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
746 struct frame *f; |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
747 Lisp_Object font_object; |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
748 Lisp_Object entity; |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
749 |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
750 { |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
751 struct xftfont_info *info = (struct xftfont_info *) XFONT_OBJECT (font_object); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
752 FcPattern *oldpat = info->xftfont->pattern; |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
753 Display *display = FRAME_X_DISPLAY (f); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
754 FcPattern *pat = FcPatternCreate (); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
755 FcBool b1, b2; |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
756 int ok = 0, i1, i2, r1, r2; |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
757 |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
758 xftfont_add_rendering_parameters (pat, entity); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
759 XftDefaultSubstitute (display, FRAME_X_SCREEN_NUMBER (f), pat); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
760 |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
761 r1 = FcPatternGetBool (pat, FC_ANTIALIAS, 0, &b1); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
762 r2 = FcPatternGetBool (oldpat, FC_ANTIALIAS, 0, &b2); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
763 if (r1 != r2 || b1 != b2) goto out; |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
764 r1 = FcPatternGetBool (pat, FC_HINTING, 0, &b1); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
765 r2 = FcPatternGetBool (oldpat, FC_HINTING, 0, &b2); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
766 if (r1 != r2 || b1 != b2) goto out; |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
767 r1 = FcPatternGetBool (pat, FC_AUTOHINT, 0, &b1); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
768 r2 = FcPatternGetBool (oldpat, FC_AUTOHINT, 0, &b2); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
769 if (r1 != r2 || b1 != b2) goto out; |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
770 #ifdef FC_EMBOLDEN |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
771 r1 = FcPatternGetBool (pat, FC_EMBOLDEN, 0, &b1); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
772 r2 = FcPatternGetBool (oldpat, FC_EMBOLDEN, 0, &b2); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
773 if (r1 != r2 || b1 != b2) goto out; |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
774 #endif |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
775 r1 = FcPatternGetInteger (pat, FC_HINT_STYLE, 0, &i1); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
776 r2 = FcPatternGetInteger (oldpat, FC_HINT_STYLE, 0, &i2); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
777 if (r1 != r2 || i1 != i2) goto out; |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
778 r1 = FcPatternGetInteger (pat, FC_LCD_FILTER, 0, &i1); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
779 r2 = FcPatternGetInteger (oldpat, FC_LCD_FILTER, 0, &i2); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
780 if (r1 != r2 || i1 != i2) goto out; |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
781 r1 = FcPatternGetInteger (pat, FC_RGBA, 0, &i1); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
782 r2 = FcPatternGetInteger (oldpat, FC_RGBA, 0, &i2); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
783 if (r1 != r2 || i1 != i2) goto out; |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
784 |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
785 ok = 1; |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
786 out: |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
787 FcPatternDestroy (pat); |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
788 return ok; |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
789 } |
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
790 |
90400 | 791 void |
792 syms_of_xftfont () | |
793 { | |
794 DEFSYM (Qxft, "xft"); | |
96075
3376493a3ad4
(QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents:
95293
diff
changeset
|
795 DEFSYM (QChinting, ":hinting"); |
100301
5c8b389c391a
(syms_of_xftfont): Fix typo.
Chong Yidong <cyd@stupidchicken.com>
parents:
96562
diff
changeset
|
796 DEFSYM (QCautohint, ":autohint"); |
96075
3376493a3ad4
(QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents:
95293
diff
changeset
|
797 DEFSYM (QChintstyle, ":hintstyle"); |
3376493a3ad4
(QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents:
95293
diff
changeset
|
798 DEFSYM (QCrgba, ":rgba"); |
3376493a3ad4
(QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents:
95293
diff
changeset
|
799 DEFSYM (QCembolden, ":embolden"); |
106558
3d091f151696
xftfont.c: Parse symbolic names for constants also.
Jan Djärv <jan.h.d@swipnet.se>
parents:
106538
diff
changeset
|
800 DEFSYM (QClcdfilter, ":lcdfilter"); |
90400 | 801 |
802 xftfont_driver = ftfont_driver; | |
803 xftfont_driver.type = Qxft; | |
804 xftfont_driver.get_cache = xfont_driver.get_cache; | |
805 xftfont_driver.list = xftfont_list; | |
90559
fb5d3ac2d786
(xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents:
90527
diff
changeset
|
806 xftfont_driver.match = xftfont_match; |
90400 | 807 xftfont_driver.open = xftfont_open; |
808 xftfont_driver.close = xftfont_close; | |
809 xftfont_driver.prepare_face = xftfont_prepare_face; | |
810 xftfont_driver.done_face = xftfont_done_face; | |
101640
6a674ba1901f
(xftfont_has_char): New function.
Kenichi Handa <handa@m17n.org>
parents:
101555
diff
changeset
|
811 xftfont_driver.has_char = xftfont_has_char; |
90400 | 812 xftfont_driver.encode_char = xftfont_encode_char; |
813 xftfont_driver.text_extents = xftfont_text_extents; | |
814 xftfont_driver.draw = xftfont_draw; | |
91110
82a42637237c
(struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents:
91027
diff
changeset
|
815 xftfont_driver.end_for_frame = xftfont_end_for_frame; |
106755
574dd89b7759
Fix slowdown and wrong font choosed by XSETTINGS changes. bug #5157.
Jan D. <jan.h.d@swipnet.se>
parents:
106558
diff
changeset
|
816 xftfont_driver.cached_font_ok = xftfont_cached_font_ok; |
111038
8d403fa5e77d
Fix incorrect font metrics when the same font is opened with different pixelsizes.
Kenichi Handa <handa@m17n.org>
parents:
109287
diff
changeset
|
817 #if defined (HAVE_M17N_FLT) && defined (HAVE_LIBOTF) |
8d403fa5e77d
Fix incorrect font metrics when the same font is opened with different pixelsizes.
Kenichi Handa <handa@m17n.org>
parents:
109287
diff
changeset
|
818 xftfont_driver.shape = xftfont_shape; |
8d403fa5e77d
Fix incorrect font metrics when the same font is opened with different pixelsizes.
Kenichi Handa <handa@m17n.org>
parents:
109287
diff
changeset
|
819 #endif |
90400 | 820 |
821 register_font_driver (&xftfont_driver, NULL); | |
822 } | |
90427 | 823 |
824 /* arch-tag: 64ec61bf-7c8e-4fe6-b953-c6a85d5e1605 | |
825 (do not change this comment) */ |