annotate src/xftfont.c @ 90495:e9e7201759bb

Add back smoothing_type and smoothing_enabled definitions.
author Jason Rumney <jasonr@gnu.org>
date Sun, 25 Jun 2006 11:47:12 +0000
parents 78a820ef12db
children 32b8f672da38
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.
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
2 Copyright (C) 2006 Free Software Foundation, Inc.
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
3 Copyright (C) 2006
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
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
9 GNU Emacs is free software; you can redistribute it and/or modify
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
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
11 the Free Software Foundation; either version 2, or (at your option)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
12 any later version.
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
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
20 along with GNU Emacs; see the file COPYING. If not, write to
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
21 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
22 Boston, MA 02110-1301, USA. */
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
23
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
24 #include <config.h>
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
25 #include <stdio.h>
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
26 #include <X11/Xlib.h>
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
27 #include <X11/Xft/Xft.h>
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
28
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
29 #include "lisp.h"
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
30 #include "dispextern.h"
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
31 #include "xterm.h"
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
32 #include "frame.h"
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
33 #include "blockinput.h"
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
34 #include "character.h"
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
35 #include "charset.h"
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
36 #include "fontset.h"
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
37 #include "font.h"
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
38
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
39 /* Xft font driver. */
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
40
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
41 static Lisp_Object Qxft;
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;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
49 Display *display;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
50 int screen;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
51 XftFont *xftfont;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
52 FT_Face ft_face;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
53 };
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
54
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
55 /* Structure pointed by (struct face *)->extra */
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
56 struct xftface_info
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
57 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
58 XftColor xft_fg;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
59 XftColor xft_bg;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
60 XftDraw *xft_draw;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
61 };
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
62
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
63 static void xftfont_get_colors P_ ((FRAME_PTR, struct face *, GC gc,
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 XftColor *fg, XftColor *bg));
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
66 static Font xftfont_default_fid P_ ((FRAME_PTR));
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
67
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
68
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
69 /* Setup colors pointed by FG and BG for GC. If XFTFACE_INFO is not
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
70 NULL, reuse the colors in it if possible. BG may be NULL. */
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
71 static void
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
72 xftfont_get_colors (f, face, gc, xftface_info, fg, bg)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
73 FRAME_PTR f;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
74 struct face *face;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
75 GC gc;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
76 struct xftface_info *xftface_info;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
77 XftColor *fg, *bg;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
78 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
79 if (xftface_info && face->gc == gc)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
80 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
81 *fg = xftface_info->xft_fg;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
82 if (bg)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
83 *bg = xftface_info->xft_bg;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
84 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
85 else
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
86 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
87 XGCValues xgcv;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
88 int fg_done = 0, bg_done = 0;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
89
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
90 BLOCK_INPUT;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
91 XGetGCValues (FRAME_X_DISPLAY (f), gc,
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
92 GCForeground | GCBackground, &xgcv);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
93 if (xftface_info)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
94 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
95 if (xgcv.foreground == face->foreground)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
96 *fg = xftface_info->xft_fg, fg_done = 1;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
97 else if (xgcv.foreground == face->background)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
98 *fg = xftface_info->xft_bg, fg_done = 1;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
99 if (! bg)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
100 bg_done = 1;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
101 else if (xgcv.background == face->background)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
102 *bg = xftface_info->xft_bg, bg_done = 1;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
103 else if (xgcv.background == face->foreground)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
104 *bg = xftface_info->xft_fg, bg_done = 1;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
105 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
106
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
107 if (fg_done + bg_done < 2)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
108 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
109 XColor colors[2];
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
110
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
111 colors[0].pixel = fg->pixel = xgcv.foreground;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
112 if (bg)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
113 colors[1].pixel = bg->pixel = xgcv.background;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
114 XQueryColors (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), colors,
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
115 bg ? 2 : 1);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
116 fg->color.alpha = 0xFFFF;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
117 fg->color.red = colors[0].red;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
118 fg->color.green = colors[0].green;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
119 fg->color.blue = colors[0].blue;
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 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
122 bg->color.alpha = 0xFFFF;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
123 bg->color.red = colors[1].red;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
124 bg->color.green = colors[1].green;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
125 bg->color.blue = colors[1].blue;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
126 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
127 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
128 UNBLOCK_INPUT;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
129 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
130 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
131
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
132 /* Return the default Font ID on frame F. */
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
133
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
134 static Font
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
135 xftfont_default_fid (f)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
136 FRAME_PTR f;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
137 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
138 static int fid_known;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
139 static Font fid;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
140
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
141 if (! fid_known)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
142 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
143 fid = XLoadFont (FRAME_X_DISPLAY (f), "fixed");
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
144 if (! fid)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
145 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
146 fid = XLoadFont (FRAME_X_DISPLAY (f), "*");
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
147 if (! fid)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
148 abort ();
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
149 }
90426
e9ed7d437c21 (xftfont_default_fid): Set fid_known to 1.
Kenichi Handa <handa@m17n.org>
parents: 90400
diff changeset
150 fid_known = 1;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
151 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
152 return fid;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
153 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
154
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
155
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
156 static Lisp_Object xftfont_list P_ ((Lisp_Object, Lisp_Object));
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
157 static struct font *xftfont_open P_ ((FRAME_PTR, Lisp_Object, int));
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
158 static void xftfont_close P_ ((FRAME_PTR, struct font *));
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
159 static int xftfont_prepare_face P_ ((FRAME_PTR, struct face *));
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
160 static void xftfont_done_face P_ ((FRAME_PTR, struct face *));
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
161 static unsigned xftfont_encode_char P_ ((struct font *, int));
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
162 static int xftfont_text_extents P_ ((struct font *, unsigned *, int,
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
163 struct font_metrics *));
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
164 static int xftfont_draw P_ ((struct glyph_string *, int, int, int, int, int));
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
165
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
166 static int xftfont_anchor_point P_ ((struct font *, unsigned, int,
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
167 int *, int *));
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
168
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
169 struct font_driver xftfont_driver;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
170
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
171 static Lisp_Object
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
172 xftfont_list (frame, spec)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
173 Lisp_Object frame;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
174 Lisp_Object spec;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
175 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
176 Lisp_Object val = ftfont_driver.list (frame, spec);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
177
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
178 if (! NILP (val))
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
179 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
180 int i;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
181
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
182 for (i = 0; i < ASIZE (val); i++)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
183 ASET (AREF (val, i), FONT_TYPE_INDEX, Qxft);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
184 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
185 return val;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
186 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
187
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
188 static FcChar8 ascii_printable[95];
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
189
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
190 static struct font *
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
191 xftfont_open (f, entity, pixel_size)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
192 FRAME_PTR f;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
193 Lisp_Object entity;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
194 int pixel_size;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
195 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
196 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
197 Display *display = FRAME_X_DISPLAY (f);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
198 Lisp_Object val;
90460
86449661f321 (xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents: 90442
diff changeset
199 FcPattern *pattern, *pat = NULL;
86449661f321 (xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents: 90442
diff changeset
200 FcChar8 *file;
86449661f321 (xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents: 90442
diff changeset
201 struct xftfont_info *xftfont_info = NULL;
86449661f321 (xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents: 90442
diff changeset
202 XFontStruct *xfont = NULL;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
203 struct font *font;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
204 double size = 0;
90460
86449661f321 (xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents: 90442
diff changeset
205 XftFont *xftfont = NULL;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
206 int spacing;
90460
86449661f321 (xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents: 90442
diff changeset
207 char *name;
90442
d6abf2344438 (xftfont_open): Make the font name fontconfig's
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
208 int len;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
209
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
210 val = AREF (entity, FONT_EXTRA_INDEX);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
211 if (XTYPE (val) != Lisp_Misc
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
212 || XMISCTYPE (val) != Lisp_Misc_Save_Value)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
213 return NULL;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
214 pattern = XSAVE_VALUE (val)->pointer;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
215 if (FcPatternGetString (pattern, FC_FILE, 0, &file) != FcResultMatch)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
216 return NULL;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
217
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
218 size = XINT (AREF (entity, FONT_SIZE_INDEX));
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
219 if (size == 0)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
220 size = pixel_size;
90442
d6abf2344438 (xftfont_open): Make the font name fontconfig's
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
221
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
222 pat = FcPatternCreate ();
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
223 FcPatternAddString (pat, FC_FILE, file);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
224 FcPatternAddDouble (pat, FC_PIXEL_SIZE, pixel_size);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
225 FcPatternAddBool (pat, FC_ANTIALIAS, FcTrue);
90442
d6abf2344438 (xftfont_open): Make the font name fontconfig's
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
226
d6abf2344438 (xftfont_open): Make the font name fontconfig's
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
227 BLOCK_INPUT;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
228 xftfont = XftFontOpenPattern (display, pat);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
229 /* We should not destroy PAT here because it is kept in XFTFONT and
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
230 destroyed automatically when XFTFONT is closed. */
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
231 if (! xftfont)
90460
86449661f321 (xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents: 90442
diff changeset
232 goto err;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
233
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
234 xftfont_info = malloc (sizeof (struct xftfont_info));
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
235 if (! xftfont_info)
90460
86449661f321 (xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents: 90442
diff changeset
236 goto err;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
237 xfont = malloc (sizeof (XFontStruct));
90460
86449661f321 (xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents: 90442
diff changeset
238 if (! xfont)
86449661f321 (xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents: 90442
diff changeset
239 goto err;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
240 xftfont_info->display = display;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
241 xftfont_info->screen = FRAME_X_SCREEN_NUMBER (f);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
242 xftfont_info->xftfont = xftfont;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
243 xftfont_info->ft_face = XftLockFace (xftfont);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
244
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
245 font = (struct font *) xftfont_info;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
246 font->entity = entity;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
247 font->pixel_size = size;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
248 font->driver = &xftfont_driver;
90473
9c75458ea910 (xftfont_open): For generating a name, start from
Kenichi Handa <handa@m17n.org>
parents: 90460
diff changeset
249 len = 96;
90460
86449661f321 (xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents: 90442
diff changeset
250 name = malloc (len);
86449661f321 (xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents: 90442
diff changeset
251 while (name && font_unparse_fcname (entity, pixel_size, name, len) < 0)
86449661f321 (xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents: 90442
diff changeset
252 {
86449661f321 (xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents: 90442
diff changeset
253 char *new = realloc (name, len += 32);
86449661f321 (xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents: 90442
diff changeset
254
86449661f321 (xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents: 90442
diff changeset
255 if (! new)
86449661f321 (xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents: 90442
diff changeset
256 free (name);
86449661f321 (xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents: 90442
diff changeset
257 name = new;
86449661f321 (xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents: 90442
diff changeset
258 }
86449661f321 (xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents: 90442
diff changeset
259 if (! name)
86449661f321 (xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents: 90442
diff changeset
260 goto err;
86449661f321 (xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents: 90442
diff changeset
261 font->font.full_name = font->font.name = name;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
262 font->file_name = (char *) file;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
263 font->font.size = xftfont->max_advance_width;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
264 font->ascent = xftfont->ascent;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
265 font->descent = xftfont->descent;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
266 font->font.height = xftfont->ascent + xftfont->descent;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
267
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
268 if (FcPatternGetInteger (xftfont->pattern, FC_SPACING, 0, &spacing)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
269 != FcResultMatch)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
270 spacing = FC_PROPORTIONAL;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
271 if (spacing != FC_PROPORTIONAL)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
272 font->font.average_width = font->font.space_width
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
273 = xftfont->max_advance_width;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
274 else
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
275 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
276 XGlyphInfo extents;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
277
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
278 if (! ascii_printable[0])
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
279 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
280 int i;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
281 for (i = 0; i < 95; i++)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
282 ascii_printable[i] = ' ' + i;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
283 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
284 XftTextExtents8 (display, xftfont, ascii_printable, 1, &extents);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
285 font->font.space_width = extents.xOff;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
286 if (font->font.space_width <= 0)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
287 /* dirty workaround */
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
288 font->font.space_width = pixel_size;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
289 XftTextExtents8 (display, xftfont, ascii_printable + 1, 94, &extents);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
290 font->font.average_width = (font->font.space_width + extents.xOff) / 95;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
291 }
90442
d6abf2344438 (xftfont_open): Make the font name fontconfig's
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
292 UNBLOCK_INPUT;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
293
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
294 /* Unfortunately Xft doesn't provide a way to get minimum char
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
295 width. So, we use space_width instead. */
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
296 font->min_width = font->font.space_width;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
297
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
298 font->font.baseline_offset = 0;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
299 font->font.relative_compose = 0;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
300 font->font.default_ascent = 0;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
301 font->font.vertical_centering = 0;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
302
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
303 /* Setup pseudo XFontStruct */
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
304 xfont->fid = xftfont_default_fid (f);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
305 xfont->ascent = xftfont->ascent;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
306 xfont->descent = xftfont->descent;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
307 xfont->max_bounds.descent = xftfont->descent;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
308 xfont->max_bounds.width = xftfont->max_advance_width;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
309 xfont->min_bounds.width = font->font.space_width;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
310 font->font.font = xfont;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
311
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
312 dpyinfo->n_fonts++;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
313
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
314 /* Set global flag fonts_changed_p to non-zero if the font loaded
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
315 has a character with a smaller width than any other character
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
316 before, or if the font loaded has a smaller height than any other
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
317 font loaded before. If this happens, it will make a glyph matrix
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
318 reallocation necessary. */
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
319 if (dpyinfo->n_fonts == 1)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
320 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
321 dpyinfo->smallest_font_height = font->font.height;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
322 dpyinfo->smallest_char_width = font->min_width;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
323 fonts_changed_p = 1;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
324 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
325 else
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
326 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
327 if (dpyinfo->smallest_font_height > font->font.height)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
328 dpyinfo->smallest_font_height = font->font.height,
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
329 fonts_changed_p |= 1;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
330 if (dpyinfo->smallest_char_width > font->min_width)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
331 dpyinfo->smallest_char_width = font->min_width,
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
332 fonts_changed_p |= 1;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
333 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
334
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
335 return font;
90460
86449661f321 (xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents: 90442
diff changeset
336
86449661f321 (xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents: 90442
diff changeset
337 err:
86449661f321 (xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents: 90442
diff changeset
338 if (xftfont) XftFontClose (display, xftfont);
86449661f321 (xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents: 90442
diff changeset
339 UNBLOCK_INPUT;
86449661f321 (xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents: 90442
diff changeset
340 if (xftfont_info) free (xftfont_info);
86449661f321 (xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents: 90442
diff changeset
341 if (xfont) free (xfont);
86449661f321 (xftfont_open): Change coding style of error
Kenichi Handa <handa@m17n.org>
parents: 90442
diff changeset
342 return NULL;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
343 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
344
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
345 static void
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
346 xftfont_close (f, font)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
347 FRAME_PTR f;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
348 struct font *font;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
349 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
350 struct xftfont_info *xftfont_info = (struct xftfont_info *) font;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
351
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
352 XftUnlockFace (xftfont_info->xftfont);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
353 XftFontClose (xftfont_info->display, xftfont_info->xftfont);
90442
d6abf2344438 (xftfont_open): Make the font name fontconfig's
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
354 if (font->font.name)
d6abf2344438 (xftfont_open): Make the font name fontconfig's
Kenichi Handa <handa@m17n.org>
parents: 90427
diff changeset
355 free (font->font.name);
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
356 free (font);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
357 FRAME_X_DISPLAY_INFO (f)->n_fonts--;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
358 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
359
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
360 static int
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
361 xftfont_prepare_face (f, face)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
362 FRAME_PTR f;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
363 struct face *face;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
364 {
90489
78a820ef12db (xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents: 90473
diff changeset
365 struct xftface_info *xftface_info;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
366
90489
78a820ef12db (xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents: 90473
diff changeset
367 if (face != face->ascii_face)
78a820ef12db (xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents: 90473
diff changeset
368 {
78a820ef12db (xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents: 90473
diff changeset
369 face->extra = face->ascii_face->extra;
78a820ef12db (xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents: 90473
diff changeset
370 return 0;
78a820ef12db (xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents: 90473
diff changeset
371 }
78a820ef12db (xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents: 90473
diff changeset
372
78a820ef12db (xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents: 90473
diff changeset
373 xftface_info = malloc (sizeof (struct xftface_info));
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
374 if (! xftface_info)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
375 return -1;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
376
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
377 BLOCK_INPUT;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
378 xftface_info->xft_draw = XftDrawCreate (FRAME_X_DISPLAY (f),
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
379 FRAME_X_WINDOW (f),
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
380 FRAME_X_VISUAL (f),
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
381 FRAME_X_COLORMAP (f));
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
382 xftfont_get_colors (f, face, face->gc, NULL,
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
383 &xftface_info->xft_fg, &xftface_info->xft_bg);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
384 UNBLOCK_INPUT;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
385
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
386 face->extra = xftface_info;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
387 return 0;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
388 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
389
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
390 static void
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
391 xftfont_done_face (f, face)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
392 FRAME_PTR f;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
393 struct face *face;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
394 {
90489
78a820ef12db (xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents: 90473
diff changeset
395 struct xftface_info *xftface_info;
78a820ef12db (xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents: 90473
diff changeset
396
78a820ef12db (xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents: 90473
diff changeset
397 if (face != face->ascii_face
78a820ef12db (xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents: 90473
diff changeset
398 || ! face->extra)
78a820ef12db (xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents: 90473
diff changeset
399 return;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
400
90489
78a820ef12db (xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents: 90473
diff changeset
401 xftface_info = (struct xftface_info *) face->extra;
78a820ef12db (xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents: 90473
diff changeset
402 BLOCK_INPUT;
78a820ef12db (xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents: 90473
diff changeset
403 XftDrawDestroy (xftface_info->xft_draw);
78a820ef12db (xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents: 90473
diff changeset
404 UNBLOCK_INPUT;
78a820ef12db (xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents: 90473
diff changeset
405 free (xftface_info);
78a820ef12db (xftfont_prepare_face): Make non-ascii face share
Kenichi Handa <handa@m17n.org>
parents: 90473
diff changeset
406 face->extra = NULL;
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
407 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
408
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
409 static unsigned
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
410 xftfont_encode_char (font, c)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
411 struct font *font;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
412 int c;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
413 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
414 struct xftfont_info *xftfont_info = (struct xftfont_info *) font;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
415 unsigned code = XftCharIndex (xftfont_info->display, xftfont_info->xftfont,
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
416 (FcChar32) c);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
417
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
418 return (code ? code : 0xFFFFFFFF);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
419 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
420
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
421 static int
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
422 xftfont_text_extents (font, code, nglyphs, metrics)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
423 struct font *font;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
424 unsigned *code;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
425 int nglyphs;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
426 struct font_metrics *metrics;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
427 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
428 struct xftfont_info *xftfont_info = (struct xftfont_info *) font;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
429 XGlyphInfo extents;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
430
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
431 BLOCK_INPUT;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
432 XftGlyphExtents (xftfont_info->display, xftfont_info->xftfont, code, nglyphs,
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
433 &extents);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
434 UNBLOCK_INPUT;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
435 if (metrics)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
436 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
437 metrics->lbearing = - extents.x;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
438 metrics->rbearing = - extents.x + extents.width;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
439 metrics->width = extents.xOff;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
440 metrics->ascent = extents.y;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
441 metrics->descent = extents.y - extents.height;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
442 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
443 return extents.xOff;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
444 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
445
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
446 static int
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
447 xftfont_draw (s, from, to, x, y, with_background)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
448 struct glyph_string *s;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
449 int from, to, x, y, with_background;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
450 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
451 FRAME_PTR f = s->f;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
452 struct face *face = s->face;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
453 struct xftfont_info *xftfont_info = (struct xftfont_info *) face->font_info;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
454 struct xftface_info *xftface_info = (struct xftface_info *) face->extra;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
455 FT_UInt *code;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
456 XftColor fg, bg;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
457 XRectangle r;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
458 int len = to - from;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
459 int i;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
460
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
461 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
462 &fg, with_background ? &bg : NULL);
90400
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
463 BLOCK_INPUT;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
464 if (s->clip_width)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
465 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
466 r.x = s->clip_x, r.width = s->clip_width;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
467 r.y = s->clip_y, r.height = s->clip_height;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
468 XftDrawSetClipRectangles (xftface_info->xft_draw, 0, 0, &r, 1);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
469 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
470 if (with_background)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
471 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
472 struct font *font = (struct font *) face->font_info;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
473
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
474 XftDrawRect (xftface_info->xft_draw, &bg,
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
475 x, y - face->font->ascent, s->width, font->font.height);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
476 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
477 code = alloca (sizeof (FT_UInt) * len);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
478 for (i = 0; i < len; i++)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
479 code[i] = ((XCHAR2B_BYTE1 (s->char2b + from + i) << 8)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
480 | XCHAR2B_BYTE2 (s->char2b + from + i));
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
481
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
482 XftDrawGlyphs (xftface_info->xft_draw, &fg, xftfont_info->xftfont,
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
483 x, y, code, len);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
484 if (s->clip_width)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
485 XftDrawSetClip (xftface_info->xft_draw, NULL);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
486 UNBLOCK_INPUT;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
487
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
488 return len;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
489 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
490
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
491 static int
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
492 xftfont_anchor_point (font, code, index, x, y)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
493 struct font *font;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
494 unsigned code;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
495 int index;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
496 int *x, *y;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
497 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
498 struct xftfont_info *xftfont_info = (struct xftfont_info *) font;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
499 FT_Face ft_face = xftfont_info->ft_face;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
500
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
501 if (FT_Load_Glyph (ft_face, code, FT_LOAD_DEFAULT) != 0)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
502 return -1;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
503 if (ft_face->glyph->format != FT_GLYPH_FORMAT_OUTLINE)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
504 return -1;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
505 if (index >= ft_face->glyph->outline.n_points)
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
506 return -1;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
507 *x = ft_face->glyph->outline.points[index].x;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
508 *y = ft_face->glyph->outline.points[index].y;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
509 return 0;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
510 }
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
511
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
512
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
513 void
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
514 syms_of_xftfont ()
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
515 {
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
516 DEFSYM (Qxft, "xft");
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
517
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
518 xftfont_driver = ftfont_driver;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
519 xftfont_driver.type = Qxft;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
520 xftfont_driver.get_cache = xfont_driver.get_cache;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
521 xftfont_driver.list = xftfont_list;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
522 xftfont_driver.open = xftfont_open;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
523 xftfont_driver.close = xftfont_close;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
524 xftfont_driver.prepare_face = xftfont_prepare_face;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
525 xftfont_driver.done_face = xftfont_done_face;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
526 xftfont_driver.encode_char = xftfont_encode_char;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
527 xftfont_driver.text_extents = xftfont_text_extents;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
528 xftfont_driver.draw = xftfont_draw;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
529 xftfont_driver.anchor_point = xftfont_anchor_point;
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
530
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
531 register_font_driver (&xftfont_driver, NULL);
80fff33f74f5 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
532 }
90427
ddb25860d044 Add arch tagline
Miles Bader <miles@gnu.org>
parents: 90426
diff changeset
533
ddb25860d044 Add arch tagline
Miles Bader <miles@gnu.org>
parents: 90426
diff changeset
534 /* arch-tag: 64ec61bf-7c8e-4fe6-b953-c6a85d5e1605
ddb25860d044 Add arch tagline
Miles Bader <miles@gnu.org>
parents: 90426
diff changeset
535 (do not change this comment) */