annotate src/xftfont.c @ 101608:49a4ee098b57

*** empty log message ***
author Carsten Dominik <dominik@science.uva.nl>
date Wed, 28 Jan 2009 14:33:23 +0000
parents a8e049b0d2c2
children 6a674ba1901f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
1 /* xftfont.c -- XFT font driver.
100951
e038c1a8307c Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 100551
diff changeset
2 Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
e038c1a8307c Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 100551
diff changeset
3 Copyright (C) 2006, 2007, 2008, 2009
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
4 National Institute of Advanced Industrial Science and Technology (AIST)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
5 Registration Number H13PRO009
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
6
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
7 This file is part of GNU Emacs.
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
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
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
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
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
13
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
14 GNU Emacs is distributed in the hope that it will be useful,
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
17 GNU General Public License for more details.
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
18
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
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
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
21
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
22 #include <config.h>
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
23 #include <stdio.h>
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
24 #include <X11/Xlib.h>
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
25 #include <X11/Xft/Xft.h>
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
26
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
27 #include "lisp.h"
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
28 #include "dispextern.h"
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
29 #include "xterm.h"
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
30 #include "frame.h"
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
31 #include "blockinput.h"
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
32 #include "character.h"
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
33 #include "charset.h"
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
34 #include "fontset.h"
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
35 #include "font.h"
91143
06de618f78e7 Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents: 91110
diff changeset
36 #include "ftfont.h"
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
37
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
38 /* Xft font driver. */
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
39
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
40 static Lisp_Object Qxft;
96075
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
41 static Lisp_Object QChinting , QCautohint, QChintstyle, QCrgba, QCembolden;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
42
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
43 /* The actual structure for Xft font that can be casted to struct
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
44 font. */
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
45
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
46 struct xftfont_info
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
47 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
48 struct font font;
101555
a8e049b0d2c2 (struct xftfont_info): New member `index'.
Kenichi Handa <handa@m17n.org>
parents: 100951
diff changeset
49 /* The following four 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
50 compatible with struct ftfont_info (in ftfont.c). */
91143
06de618f78e7 Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents: 91110
diff changeset
51 #ifdef HAVE_LIBOTF
06de618f78e7 Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents: 91110
diff changeset
52 int maybe_otf; /* Flag to tell if this may be OTF or not. */
06de618f78e7 Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents: 91110
diff changeset
53 OTF *otf;
91163
a12e3e58ec94 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 91143
diff changeset
54 #endif /* HAVE_LIBOTF */
96562
ea11c7e02573 (struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents: 96431
diff changeset
55 FT_Size ft_size;
101555
a8e049b0d2c2 (struct xftfont_info): New member `index'.
Kenichi Handa <handa@m17n.org>
parents: 100951
diff changeset
56 int index;
96562
ea11c7e02573 (struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents: 96431
diff changeset
57 Display *display;
ea11c7e02573 (struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents: 96431
diff changeset
58 int screen;
ea11c7e02573 (struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents: 96431
diff changeset
59 XftFont *xftfont;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
60 };
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
61
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
62 /* Structure pointed by (struct face *)->extra */
90559
fb5d3ac2d786 (xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents: 90527
diff changeset
63
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
64 struct xftface_info
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
65 {
90559
fb5d3ac2d786 (xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents: 90527
diff changeset
66 XftColor xft_fg; /* color for face->foreground */
fb5d3ac2d786 (xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents: 90527
diff changeset
67 XftColor xft_bg; /* color for face->background */
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
68 };
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
69
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
70 static void xftfont_get_colors P_ ((FRAME_PTR, struct face *, GC gc,
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
71 struct xftface_info *,
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
72 XftColor *fg, XftColor *bg));
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
73
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
74
90559
fb5d3ac2d786 (xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents: 90527
diff changeset
75 /* 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
76 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
77 may be NULL. */
fb5d3ac2d786 (xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents: 90527
diff changeset
78
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
79 static void
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
80 xftfont_get_colors (f, face, gc, xftface_info, fg, bg)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
81 FRAME_PTR f;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
82 struct face *face;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
83 GC gc;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
84 struct xftface_info *xftface_info;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
85 XftColor *fg, *bg;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
86 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
87 if (xftface_info && face->gc == gc)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
88 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
89 *fg = xftface_info->xft_fg;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
90 if (bg)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
91 *bg = xftface_info->xft_bg;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
92 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
93 else
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
94 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
95 XGCValues xgcv;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
96 int fg_done = 0, bg_done = 0;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
97
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
98 BLOCK_INPUT;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
99 XGetGCValues (FRAME_X_DISPLAY (f), gc,
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
100 GCForeground | GCBackground, &xgcv);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
101 if (xftface_info)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
102 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
103 if (xgcv.foreground == face->foreground)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
104 *fg = xftface_info->xft_fg, fg_done = 1;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
105 else if (xgcv.foreground == face->background)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
106 *fg = xftface_info->xft_bg, fg_done = 1;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
107 if (! bg)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
108 bg_done = 1;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
109 else if (xgcv.background == face->background)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
110 *bg = xftface_info->xft_bg, bg_done = 1;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
111 else if (xgcv.background == face->foreground)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
112 *bg = xftface_info->xft_fg, bg_done = 1;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
113 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
114
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
115 if (fg_done + bg_done < 2)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
116 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
117 XColor colors[2];
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
118
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
119 colors[0].pixel = fg->pixel = xgcv.foreground;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
120 if (bg)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
121 colors[1].pixel = bg->pixel = xgcv.background;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
122 XQueryColors (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), colors,
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
123 bg ? 2 : 1);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
124 fg->color.alpha = 0xFFFF;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
125 fg->color.red = colors[0].red;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
126 fg->color.green = colors[0].green;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
127 fg->color.blue = colors[0].blue;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
128 if (bg)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
129 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
130 bg->color.alpha = 0xFFFF;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
131 bg->color.red = colors[1].red;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
132 bg->color.green = colors[1].green;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
133 bg->color.blue = colors[1].blue;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
134 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
135 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
136 UNBLOCK_INPUT;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
137 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
138 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
139
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
140
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
141 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
142 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
143 static Lisp_Object xftfont_open P_ ((FRAME_PTR, Lisp_Object, int));
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
144 static void xftfont_close P_ ((FRAME_PTR, struct font *));
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
145 static int xftfont_prepare_face P_ ((FRAME_PTR, struct face *));
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
146 static void xftfont_done_face P_ ((FRAME_PTR, struct face *));
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
147 static unsigned xftfont_encode_char P_ ((struct font *, int));
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
148 static int xftfont_text_extents P_ ((struct font *, unsigned *, int,
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
149 struct font_metrics *));
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
150 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
151 static int xftfont_end_for_frame P_ ((FRAME_PTR f));
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
152
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
153 struct font_driver xftfont_driver;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
154
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
155 static Lisp_Object
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
156 xftfont_list (frame, spec)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
157 Lisp_Object frame;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
158 Lisp_Object spec;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
159 {
94941
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
160 Lisp_Object list = ftfont_driver.list (frame, spec), tail;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
161
94941
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
162 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
163 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
164 return list;
90559
fb5d3ac2d786 (xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents: 90527
diff changeset
165 }
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
166
90559
fb5d3ac2d786 (xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents: 90527
diff changeset
167 static Lisp_Object
fb5d3ac2d786 (xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents: 90527
diff changeset
168 xftfont_match (frame, spec)
fb5d3ac2d786 (xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents: 90527
diff changeset
169 Lisp_Object frame;
fb5d3ac2d786 (xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents: 90527
diff changeset
170 Lisp_Object spec;
fb5d3ac2d786 (xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents: 90527
diff changeset
171 {
fb5d3ac2d786 (xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents: 90527
diff changeset
172 Lisp_Object entity = ftfont_driver.match (frame, spec);
fb5d3ac2d786 (xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents: 90527
diff changeset
173
94941
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
174 if (! NILP (entity))
90559
fb5d3ac2d786 (xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents: 90527
diff changeset
175 ASET (entity, FONT_TYPE_INDEX, Qxft);
fb5d3ac2d786 (xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents: 90527
diff changeset
176 return entity;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
177 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
178
96431
abddf0a4cec0 (xftfont_open): Don't call FcConfigSubstitute and
Kenichi Handa <handa@m17n.org>
parents: 96146
diff changeset
179 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
180 extern FcCharSet *ftfont_get_fc_charset P_ ((Lisp_Object));
96075
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
181 extern Lisp_Object QCantialias;
90700
b165eceb829f (ftfont_font_format): Extern declaration.
Kenichi Handa <handa@m17n.org>
parents: 90675
diff changeset
182
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
183 static FcChar8 ascii_printable[95];
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
184
94941
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
185 static Lisp_Object
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
186 xftfont_open (f, entity, pixel_size)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
187 FRAME_PTR f;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
188 Lisp_Object entity;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
189 int pixel_size;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
190 {
96075
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
191 FcResult result;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
192 Display *display = FRAME_X_DISPLAY (f);
96562
ea11c7e02573 (struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents: 96431
diff changeset
193 Lisp_Object val, filename, index, tail, font_object;
96075
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
194 FcPattern *pat = NULL, *match;
90460
86449661f321 (xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents: 90442
diff changeset
195 struct xftfont_info *xftfont_info = NULL;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
196 struct font *font;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
197 double size = 0;
90460
86449661f321 (xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents: 90442
diff changeset
198 XftFont *xftfont = NULL;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
199 int spacing;
94941
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
200 char name[256];
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
201 int len, i;
90959
3f83c9d3f96c (xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents: 90714
diff changeset
202 XGlyphInfo extents;
91226
040f2e332dc3 (struct xftfont_info): Delete the member ft_face.
Kenichi Handa <handa@m17n.org>
parents: 91163
diff changeset
203 FT_Face ft_face;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
204
94941
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
205 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
206 if (! CONSP (val))
94941
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
207 return Qnil;
95102
a3868b9c34f4 (xftfont_open): Ajusted for the change of extra info
Kenichi Handa <handa@m17n.org>
parents: 94963
diff changeset
208 val = XCDR (val);
a3868b9c34f4 (xftfont_open): Ajusted for the change of extra info
Kenichi Handa <handa@m17n.org>
parents: 94963
diff changeset
209 filename = XCAR (val);
96562
ea11c7e02573 (struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents: 96431
diff changeset
210 index = XCDR (val);
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
211 size = XINT (AREF (entity, FONT_SIZE_INDEX));
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
212 if (size == 0)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
213 size = pixel_size;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
214 pat = FcPatternCreate ();
96075
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
215 FcPatternAddInteger (pat, FC_WEIGHT, FONT_WEIGHT_NUMERIC (entity));
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
216 i = FONT_SLANT_NUMERIC (entity) - 100;
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
217 if (i < 0) i = 0;
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
218 FcPatternAddInteger (pat, FC_SLANT, i);
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
219 FcPatternAddInteger (pat, FC_WIDTH, FONT_WIDTH_NUMERIC (entity));
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
220 FcPatternAddDouble (pat, FC_PIXEL_SIZE, pixel_size);
90714
698001835583 (xftfont_open): Call FcConfigSubstitute.
Kenichi Handa <handa@m17n.org>
parents: 90712
diff changeset
221 val = AREF (entity, FONT_FAMILY_INDEX);
698001835583 (xftfont_open): Call FcConfigSubstitute.
Kenichi Handa <handa@m17n.org>
parents: 90712
diff changeset
222 if (! NILP (val))
698001835583 (xftfont_open): Call FcConfigSubstitute.
Kenichi Handa <handa@m17n.org>
parents: 90712
diff changeset
223 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
224 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
225 if (! NILP (val))
0304b3142c84 (xftfont_open): Add FOUNDRY, SPACING, DPI, SCALABLE to the pattern.
Kenichi Handa <handa@m17n.org>
parents: 96075
diff changeset
226 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
227 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
228 if (! NILP (val))
0304b3142c84 (xftfont_open): Add FOUNDRY, SPACING, DPI, SCALABLE to the pattern.
Kenichi Handa <handa@m17n.org>
parents: 96075
diff changeset
229 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
230 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
231 if (! NILP (val))
0304b3142c84 (xftfont_open): Add FOUNDRY, SPACING, DPI, SCALABLE to the pattern.
Kenichi Handa <handa@m17n.org>
parents: 96075
diff changeset
232 {
0304b3142c84 (xftfont_open): Add FOUNDRY, SPACING, DPI, SCALABLE to the pattern.
Kenichi Handa <handa@m17n.org>
parents: 96075
diff changeset
233 double dbl = XINT (val);
0304b3142c84 (xftfont_open): Add FOUNDRY, SPACING, DPI, SCALABLE to the pattern.
Kenichi Handa <handa@m17n.org>
parents: 96075
diff changeset
234
0304b3142c84 (xftfont_open): Add FOUNDRY, SPACING, DPI, SCALABLE to the pattern.
Kenichi Handa <handa@m17n.org>
parents: 96075
diff changeset
235 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
236 }
0304b3142c84 (xftfont_open): Add FOUNDRY, SPACING, DPI, SCALABLE to the pattern.
Kenichi Handa <handa@m17n.org>
parents: 96075
diff changeset
237 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
238 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
239 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
240 /* 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
241 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
242 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
243
96075
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
244 for (tail = AREF (entity, FONT_EXTRA_INDEX); CONSP (tail); tail = XCDR (tail))
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
245 {
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
246 Lisp_Object key, val;
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
247
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
248 key = XCAR (XCAR (tail)), val = XCDR (XCAR (tail));
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
249 if (EQ (key, QCantialias))
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
250 FcPatternAddBool (pat, FC_ANTIALIAS, NILP (val) ? FcFalse : FcTrue);
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
251 else if (EQ (key, QChinting))
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
252 FcPatternAddBool (pat, FC_HINTING, NILP (val) ? FcFalse : FcTrue);
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
253 else if (EQ (key, QCautohint))
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
254 FcPatternAddBool (pat, FC_AUTOHINT, NILP (val) ? FcFalse : FcTrue);
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
255 else if (EQ (key, QChintstyle))
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
256 {
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
257 if (INTEGERP (val))
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
258 FcPatternAddInteger (pat, FC_RGBA, XINT (val));
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
259 }
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
260 else if (EQ (key, QCrgba))
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
261 {
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
262 if (INTEGERP (val))
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
263 FcPatternAddInteger (pat, FC_RGBA, XINT (val));
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
264 }
96146
e26d249d40df (xftfont_open): Handle QCembolden only when FC_EMBOLDEN is defined.
Kenichi Handa <handa@m17n.org>
parents: 96094
diff changeset
265 #ifdef FC_EMBOLDEN
96075
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
266 else if (EQ (key, QCembolden))
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
267 FcPatternAddBool (pat, FC_EMBOLDEN, NILP (val) ? FcFalse : FcTrue);
96146
e26d249d40df (xftfont_open): Handle QCembolden only when FC_EMBOLDEN is defined.
Kenichi Handa <handa@m17n.org>
parents: 96094
diff changeset
268 #endif
96075
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
269 }
90442
d6abf2344438 (xftfont_open): Make the font name fontconfig's
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
270
96562
ea11c7e02573 (struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents: 96431
diff changeset
271 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
272 FcPatternAddInteger (pat, FC_INDEX, XINT (index));
ea11c7e02573 (struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents: 96431
diff changeset
273
ea11c7e02573 (struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents: 96431
diff changeset
274
90442
d6abf2344438 (xftfont_open): Make the font name fontconfig's
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
275 BLOCK_INPUT;
96075
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
276 match = XftFontMatch (display, FRAME_X_SCREEN_NUMBER (f), pat, &result);
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
277 FcPatternDestroy (pat);
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
278 xftfont = XftFontOpenPattern (display, match);
96562
ea11c7e02573 (struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents: 96431
diff changeset
279 ft_face = XftLockFace (xftfont);
94941
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
280 UNBLOCK_INPUT;
96075
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
281
94941
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
282 if (! xftfont)
100427
e0aa0e328261 (xftfont_open): Free Xft font pattern if XftFontOpenPattern fails.
Chong Yidong <cyd@stupidchicken.com>
parents: 100301
diff changeset
283 {
e0aa0e328261 (xftfont_open): Free Xft font pattern if XftFontOpenPattern fails.
Chong Yidong <cyd@stupidchicken.com>
parents: 100301
diff changeset
284 XftPatternDestroy (match);
e0aa0e328261 (xftfont_open): Free Xft font pattern if XftFontOpenPattern fails.
Chong Yidong <cyd@stupidchicken.com>
parents: 100301
diff changeset
285 return Qnil;
e0aa0e328261 (xftfont_open): Free Xft font pattern if XftFontOpenPattern fails.
Chong Yidong <cyd@stupidchicken.com>
parents: 100301
diff changeset
286 }
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
287 /* We should not destroy PAT here because it is kept in XFTFONT and
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
288 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
289 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
290 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
291 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
292 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
293 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
294 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
295 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
296 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
297 else
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
298 ASET (font_object, FONT_FULLNAME_INDEX,
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
299 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
300 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
301 ASET (font_object, FONT_FORMAT_INDEX,
96431
abddf0a4cec0 (xftfont_open): Don't call FcConfigSubstitute and
Kenichi Handa <handa@m17n.org>
parents: 96146
diff changeset
302 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
303 font = XFONT_OBJECT (font_object);
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
304 font->pixel_size = pixel_size;
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
305 font->driver = &xftfont_driver;
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
306 font->encoding_charset = font->repertory_charset = -1;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
307
94941
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
308 xftfont_info = (struct xftfont_info *) font;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
309 xftfont_info->display = display;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
310 xftfont_info->screen = FRAME_X_SCREEN_NUMBER (f);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
311 xftfont_info->xftfont = xftfont;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
312 font->pixel_size = size;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
313 font->driver = &xftfont_driver;
95102
a3868b9c34f4 (xftfont_open): Ajusted for the change of extra info
Kenichi Handa <handa@m17n.org>
parents: 94963
diff changeset
314 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
315 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
316 else
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
317 spacing = FC_PROPORTIONAL;
90959
3f83c9d3f96c (xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents: 90714
diff changeset
318 if (! ascii_printable[0])
3f83c9d3f96c (xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents: 90714
diff changeset
319 {
3f83c9d3f96c (xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents: 90714
diff changeset
320 int i;
3f83c9d3f96c (xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents: 90714
diff changeset
321 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
322 ascii_printable[i] = ' ' + i;
3f83c9d3f96c (xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents: 90714
diff changeset
323 }
94941
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
324 BLOCK_INPUT;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
325 if (spacing != FC_PROPORTIONAL)
90959
3f83c9d3f96c (xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents: 90714
diff changeset
326 {
94941
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
327 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
328 = xftfont->max_advance_width;
3f83c9d3f96c (xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents: 90714
diff changeset
329 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
330 }
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
331 else
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
332 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
333 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
334 font->space_width = extents.xOff;
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
335 if (font->space_width <= 0)
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
336 /* dirty workaround */
94941
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
337 font->space_width = pixel_size;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
338 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
339 font->average_width = (font->space_width + extents.xOff) / 95;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
340 }
90442
d6abf2344438 (xftfont_open): Make the font name fontconfig's
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
341 UNBLOCK_INPUT;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
342
90959
3f83c9d3f96c (xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents: 90714
diff changeset
343 font->ascent = xftfont->ascent;
3f83c9d3f96c (xftfont_open): If one of font's ASCII glyph has
Kenichi Handa <handa@m17n.org>
parents: 90714
diff changeset
344 font->descent = xftfont->descent;
96075
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
345 if (pixel_size >= 5)
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
346 {
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
347 /* The above condition is a dirty workaround because
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
348 XftTextExtents8 behaves strangely for some fonts
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
349 (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
350 if (font->ascent < extents.y)
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
351 font->ascent = extents.y;
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
352 if (font->descent < extents.height - extents.y)
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
353 font->descent = extents.height - extents.y;
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
354 }
94941
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
355 font->height = font->ascent + font->descent;
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
356
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
357 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
358 {
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
359 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
360
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
361 font->underline_position = -ft_face->underline_position * size / upEM;
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
362 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
363 if (font->underline_thickness > 2)
089ad7a58f94 (xftfont_open): Delete unused variable. If
Kenichi Handa <handa@m17n.org>
parents: 95102
diff changeset
364 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
365 }
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
366 else
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
367 {
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
368 font->underline_position = -1;
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
369 font->underline_thickness = 0;
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
370 }
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
371 #ifdef HAVE_LIBOTF
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
372 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
373 xftfont_info->otf = NULL;
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
374 #endif /* HAVE_LIBOTF */
96562
ea11c7e02573 (struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents: 96431
diff changeset
375 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
376
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
377 /* Unfortunately Xft doesn't provide a way to get minimum char
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
378 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
379 font->min_width = font->space_width;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
380
94941
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
381 font->baseline_offset = 0;
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
382 font->relative_compose = 0;
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
383 font->default_ascent = 0;
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
384 font->vertical_centering = 0;
96562
ea11c7e02573 (struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents: 96431
diff changeset
385 #ifdef FT_BDF_H
ea11c7e02573 (struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents: 96431
diff changeset
386 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
387 {
ea11c7e02573 (struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents: 96431
diff changeset
388 BDF_PropertyRec rec;
ea11c7e02573 (struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents: 96431
diff changeset
389
ea11c7e02573 (struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents: 96431
diff changeset
390 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
391 && 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
392 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
393 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
394 && 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
395 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
396 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
397 && 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
398 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
399 }
ea11c7e02573 (struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents: 96431
diff changeset
400 #endif
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
401
94941
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
402 return font_object;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
403 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
404
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
405 static void
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
406 xftfont_close (f, font)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
407 FRAME_PTR f;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
408 struct font *font;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
409 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
410 struct xftfont_info *xftfont_info = (struct xftfont_info *) font;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
411
91143
06de618f78e7 Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents: 91110
diff changeset
412 #ifdef HAVE_LIBOTF
06de618f78e7 Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents: 91110
diff changeset
413 if (xftfont_info->otf)
06de618f78e7 Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents: 91110
diff changeset
414 OTF_close (xftfont_info->otf);
06de618f78e7 Include "ftfont.h".
Kenichi Handa <handa@m17n.org>
parents: 91110
diff changeset
415 #endif
94941
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
416 BLOCK_INPUT;
96562
ea11c7e02573 (struct xftfont_info): New member ft_size. Make the
Kenichi Handa <handa@m17n.org>
parents: 96431
diff changeset
417 XftUnlockFace (xftfont_info->xftfont);
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
418 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
419 UNBLOCK_INPUT;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
420 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
421
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
422 static int
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
423 xftfont_prepare_face (f, face)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
424 FRAME_PTR f;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
425 struct face *face;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
426 {
90489
78a820ef12db (xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents: 90473
diff changeset
427 struct xftface_info *xftface_info;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
428
90499
32b8f672da38 (xftfont_prepare_face): Cancel previous change.
Kenichi Handa <handa@m17n.org>
parents: 90489
diff changeset
429 #if 0
32b8f672da38 (xftfont_prepare_face): Cancel previous change.
Kenichi Handa <handa@m17n.org>
parents: 90489
diff changeset
430 /* 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
431 if (face != face->ascii_face)
78a820ef12db (xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents: 90473
diff changeset
432 {
78a820ef12db (xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents: 90473
diff changeset
433 face->extra = face->ascii_face->extra;
78a820ef12db (xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents: 90473
diff changeset
434 return 0;
78a820ef12db (xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents: 90473
diff changeset
435 }
90499
32b8f672da38 (xftfont_prepare_face): Cancel previous change.
Kenichi Handa <handa@m17n.org>
parents: 90489
diff changeset
436 #endif
90489
78a820ef12db (xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents: 90473
diff changeset
437
78a820ef12db (xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents: 90473
diff changeset
438 xftface_info = malloc (sizeof (struct xftface_info));
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
439 if (! xftface_info)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
440 return -1;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
441 xftfont_get_colors (f, face, face->gc, NULL,
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
442 &xftface_info->xft_fg, &xftface_info->xft_bg);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
443 face->extra = xftface_info;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
444 return 0;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
445 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
446
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
447 static void
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
448 xftfont_done_face (f, face)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
449 FRAME_PTR f;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
450 struct face *face;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
451 {
90489
78a820ef12db (xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents: 90473
diff changeset
452 struct xftface_info *xftface_info;
78a820ef12db (xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents: 90473
diff changeset
453
90499
32b8f672da38 (xftfont_prepare_face): Cancel previous change.
Kenichi Handa <handa@m17n.org>
parents: 90489
diff changeset
454 #if 0
32b8f672da38 (xftfont_prepare_face): Cancel previous change.
Kenichi Handa <handa@m17n.org>
parents: 90489
diff changeset
455 /* 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
456 if (face != face->ascii_face
78a820ef12db (xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents: 90473
diff changeset
457 || ! face->extra)
78a820ef12db (xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents: 90473
diff changeset
458 return;
90499
32b8f672da38 (xftfont_prepare_face): Cancel previous change.
Kenichi Handa <handa@m17n.org>
parents: 90489
diff changeset
459 #endif
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
460
90489
78a820ef12db (xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents: 90473
diff changeset
461 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
462 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
463 {
63b888896eba * xftfont.c (xftfont_done_face): Call XftDrawDestroy only if xftface_info
Jan Djärv <jan.h.d@swipnet.se>
parents: 90511
diff changeset
464 free (xftface_info);
91110
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
465 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
466 }
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
467 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
468
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
469 static unsigned
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
470 xftfont_encode_char (font, c)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
471 struct font *font;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
472 int c;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
473 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
474 struct xftfont_info *xftfont_info = (struct xftfont_info *) font;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
475 unsigned code = XftCharIndex (xftfont_info->display, xftfont_info->xftfont,
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
476 (FcChar32) c);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
477
91269
421d7c7d296a (xftfont_encode_char): Use the macro FONT_INVALID_CODE.
Kenichi Handa <handa@m17n.org>
parents: 91243
diff changeset
478 return (code ? code : FONT_INVALID_CODE);
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
479 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
480
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
481 static int
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
482 xftfont_text_extents (font, code, nglyphs, metrics)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
483 struct font *font;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
484 unsigned *code;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
485 int nglyphs;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
486 struct font_metrics *metrics;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
487 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
488 struct xftfont_info *xftfont_info = (struct xftfont_info *) font;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
489 XGlyphInfo extents;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
490
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
491 BLOCK_INPUT;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
492 XftGlyphExtents (xftfont_info->display, xftfont_info->xftfont, code, nglyphs,
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
493 &extents);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
494 UNBLOCK_INPUT;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
495 if (metrics)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
496 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
497 metrics->lbearing = - extents.x;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
498 metrics->rbearing = - extents.x + extents.width;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
499 metrics->width = extents.xOff;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
500 metrics->ascent = extents.y;
90616
68d59ef20174 (xftfont_text_extents): Fix calculation of descent
Kenichi Handa <handa@m17n.org>
parents: 90589
diff changeset
501 metrics->descent = extents.height - extents.y;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
502 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
503 return extents.xOff;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
504 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
505
91110
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
506 static XftDraw *
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
507 xftfont_get_xft_draw (f)
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
508 FRAME_PTR f;
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
509 {
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
510 XftDraw *xft_draw = font_get_frame_data (f, &xftfont_driver);;
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
511
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
512 if (! xft_draw)
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
513 {
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
514 BLOCK_INPUT;
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
515 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
516 FRAME_X_WINDOW (f),
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
517 FRAME_X_VISUAL (f),
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
518 FRAME_X_COLORMAP (f));
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
519 UNBLOCK_INPUT;
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
520 if (! xft_draw)
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
521 abort ();
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
522 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
523 }
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
524 return xft_draw;
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
525 }
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
526
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
527 static int
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
528 xftfont_draw (s, from, to, x, y, with_background)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
529 struct glyph_string *s;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
530 int from, to, x, y, with_background;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
531 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
532 FRAME_PTR f = s->f;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
533 struct face *face = s->face;
94941
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
534 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
535 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
536 XftDraw *xft_draw = xftfont_get_xft_draw (f);
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
537 FT_UInt *code;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
538 XftColor fg, bg;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
539 int len = to - from;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
540 int i;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
541
94941
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
542 if (s->font == face->font)
91110
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
543 xftface_info = (struct xftface_info *) face->extra;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
544 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
545 &fg, with_background ? &bg : NULL);
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
546 BLOCK_INPUT;
91027
04b81a720da9 (xftfont_draw): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 91011
diff changeset
547 if (s->num_clips > 0)
04b81a720da9 (xftfont_draw): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 91011
diff changeset
548 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
549 else
04b81a720da9 (xftfont_draw): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 91011
diff changeset
550 XftDrawSetClip (xft_draw, NULL);
04b81a720da9 (xftfont_draw): Adjusted for the change of struct
Kenichi Handa <handa@m17n.org>
parents: 91011
diff changeset
551
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
552 if (with_background)
94941
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
553 XftDrawRect (xft_draw, &bg,
8cbdb26068b4 (xftfont_list): Adjusted for the change of `list'
Kenichi Handa <handa@m17n.org>
parents: 92184
diff changeset
554 x, y - face->font->ascent, s->width, face->font->height);
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
555 code = alloca (sizeof (FT_UInt) * len);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
556 for (i = 0; i < len; i++)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
557 code[i] = ((XCHAR2B_BYTE1 (s->char2b + from + i) << 8)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
558 | XCHAR2B_BYTE2 (s->char2b + from + i));
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
559
92184
6218afb021ac (xftfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents: 91907
diff changeset
560 if (s->padding_p)
6218afb021ac (xftfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents: 91907
diff changeset
561 for (i = 0; i < len; i++)
6218afb021ac (xftfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents: 91907
diff changeset
562 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
563 x + i, y, code + i, 1);
6218afb021ac (xftfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents: 91907
diff changeset
564 else
6218afb021ac (xftfont_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents: 91907
diff changeset
565 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
566 x, y, code, len);
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
567 UNBLOCK_INPUT;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
568
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
569 return len;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
570 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
571
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
572 static int
91110
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
573 xftfont_end_for_frame (f)
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
574 FRAME_PTR f;
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
575 {
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
576 XftDraw *xft_draw = font_get_frame_data (f, &xftfont_driver);
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
577
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
578 if (xft_draw)
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
579 {
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
580 BLOCK_INPUT;
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
581 XftDrawDestroy (xft_draw);
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
582 UNBLOCK_INPUT;
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
583 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
584 }
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
585 return 0;
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
586 }
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
587
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
588 void
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
589 syms_of_xftfont ()
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
590 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
591 DEFSYM (Qxft, "xft");
96075
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
592 DEFSYM (QChinting, ":hinting");
100301
5c8b389c391a (syms_of_xftfont): Fix typo.
Chong Yidong <cyd@stupidchicken.com>
parents: 96562
diff changeset
593 DEFSYM (QCautohint, ":autohint");
96075
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
594 DEFSYM (QChintstyle, ":hintstyle");
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
595 DEFSYM (QCrgba, ":rgba");
3376493a3ad4 (QChinting , QCautohint, QChintstyle, QCrgba)
Kenichi Handa <handa@m17n.org>
parents: 95293
diff changeset
596 DEFSYM (QCembolden, ":embolden");
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
597
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
598 xftfont_driver = ftfont_driver;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
599 xftfont_driver.type = Qxft;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
600 xftfont_driver.get_cache = xfont_driver.get_cache;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
601 xftfont_driver.list = xftfont_list;
90559
fb5d3ac2d786 (xftfont_match): New function.
Kenichi Handa <handa@m17n.org>
parents: 90527
diff changeset
602 xftfont_driver.match = xftfont_match;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
603 xftfont_driver.open = xftfont_open;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
604 xftfont_driver.close = xftfont_close;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
605 xftfont_driver.prepare_face = xftfont_prepare_face;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
606 xftfont_driver.done_face = xftfont_done_face;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
607 xftfont_driver.encode_char = xftfont_encode_char;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
608 xftfont_driver.text_extents = xftfont_text_extents;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
609 xftfont_driver.draw = xftfont_draw;
91110
82a42637237c (struct xftface_info): Delete the member xft_draw.
Kenichi Handa <handa@m17n.org>
parents: 91027
diff changeset
610 xftfont_driver.end_for_frame = xftfont_end_for_frame;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
611
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
612 register_font_driver (&xftfont_driver, NULL);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
613 }
90427
ddb25860d044 Add arch tagline
Miles Bader <miles@gnu.org>
parents: 90426
diff changeset
614
ddb25860d044 Add arch tagline
Miles Bader <miles@gnu.org>
parents: 90426
diff changeset
615 /* arch-tag: 64ec61bf-7c8e-4fe6-b953-c6a85d5e1605
ddb25860d044 Add arch tagline
Miles Bader <miles@gnu.org>
parents: 90426
diff changeset
616 (do not change this comment) */