aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2006-08-01 01:18:34 +0000
committerKenichi Handa2006-08-01 01:18:34 +0000
commit10aca0f7ef4b2adde76123608f1dcf956a36b62b (patch)
tree7c594b7bd2e4534c23512d23cc4bae74d5704ea8 /src
parentda369b6b254ef55243997b5d7f0424ff48021b18 (diff)
downloademacs-10aca0f7ef4b2adde76123608f1dcf956a36b62b.tar.gz
emacs-10aca0f7ef4b2adde76123608f1dcf956a36b62b.zip
(xftfont_match): New function.
(syms_of_xftfont): Set xftfont_driver.match to xftfont_match.
Diffstat (limited to 'src')
-rw-r--r--src/xftfont.c40
1 files changed, 28 insertions, 12 deletions
diff --git a/src/xftfont.c b/src/xftfont.c
index bd310cb68b8..d84eb4eb943 100644
--- a/src/xftfont.c
+++ b/src/xftfont.c
@@ -49,14 +49,15 @@ struct xftfont_info
49 Display *display; 49 Display *display;
50 int screen; 50 int screen;
51 XftFont *xftfont; 51 XftFont *xftfont;
52 FT_Face ft_face; 52 FT_Face ft_face; /* set to XftLockFace (xftfont) */
53}; 53};
54 54
55/* Structure pointed by (struct face *)->extra */ 55/* Structure pointed by (struct face *)->extra */
56
56struct xftface_info 57struct xftface_info
57{ 58{
58 XftColor xft_fg; 59 XftColor xft_fg; /* color for face->foreground */
59 XftColor xft_bg; 60 XftColor xft_bg; /* color for face->background */
60 XftDraw *xft_draw; 61 XftDraw *xft_draw;
61}; 62};
62 63
@@ -66,8 +67,10 @@ static void xftfont_get_colors P_ ((FRAME_PTR, struct face *, GC gc,
66static Font xftfont_default_fid P_ ((FRAME_PTR)); 67static Font xftfont_default_fid P_ ((FRAME_PTR));
67 68
68 69
69/* Setup colors pointed by FG and BG for GC. If XFTFACE_INFO is not 70/* Setup foreground and background colors of GC into FG and BG. If
70 NULL, reuse the colors in it if possible. BG may be NULL. */ 71 XFTFACE_INFO is not NULL, reuse the colors in it if possible. BG
72 may be NULL. */
73
71static void 74static void
72xftfont_get_colors (f, face, gc, xftface_info, fg, bg) 75xftfont_get_colors (f, face, gc, xftface_info, fg, bg)
73 FRAME_PTR f; 76 FRAME_PTR f;
@@ -129,7 +132,9 @@ xftfont_get_colors (f, face, gc, xftface_info, fg, bg)
129 } 132 }
130} 133}
131 134
132/* Return the default Font ID on frame F. */ 135/* Return the default Font ID on frame F. The Returned Font ID is
136 stored in the GC of the frame F, but the font is never used. So,
137 any ID is ok as long as it is valid. */
133 138
134static Font 139static Font
135xftfont_default_fid (f) 140xftfont_default_fid (f)
@@ -154,6 +159,7 @@ xftfont_default_fid (f)
154 159
155 160
156static Lisp_Object xftfont_list P_ ((Lisp_Object, Lisp_Object)); 161static Lisp_Object xftfont_list P_ ((Lisp_Object, Lisp_Object));
162static Lisp_Object xftfont_match P_ ((Lisp_Object, Lisp_Object));
157static struct font *xftfont_open P_ ((FRAME_PTR, Lisp_Object, int)); 163static struct font *xftfont_open P_ ((FRAME_PTR, Lisp_Object, int));
158static void xftfont_close P_ ((FRAME_PTR, struct font *)); 164static void xftfont_close P_ ((FRAME_PTR, struct font *));
159static int xftfont_prepare_face P_ ((FRAME_PTR, struct face *)); 165static int xftfont_prepare_face P_ ((FRAME_PTR, struct face *));
@@ -174,17 +180,26 @@ xftfont_list (frame, spec)
174 Lisp_Object spec; 180 Lisp_Object spec;
175{ 181{
176 Lisp_Object val = ftfont_driver.list (frame, spec); 182 Lisp_Object val = ftfont_driver.list (frame, spec);
183 int i;
177 184
178 if (! NILP (val)) 185 if (! NILP (val))
179 { 186 for (i = 0; i < ASIZE (val); i++)
180 int i; 187 ASET (AREF (val, i), FONT_TYPE_INDEX, Qxft);
181
182 for (i = 0; i < ASIZE (val); i++)
183 ASET (AREF (val, i), FONT_TYPE_INDEX, Qxft);
184 }
185 return val; 188 return val;
186} 189}
187 190
191static Lisp_Object
192xftfont_match (frame, spec)
193 Lisp_Object frame;
194 Lisp_Object spec;
195{
196 Lisp_Object entity = ftfont_driver.match (frame, spec);
197
198 if (VECTORP (entity))
199 ASET (entity, FONT_TYPE_INDEX, Qxft);
200 return entity;
201}
202
188static FcChar8 ascii_printable[95]; 203static FcChar8 ascii_printable[95];
189 204
190static struct font * 205static struct font *
@@ -529,6 +544,7 @@ syms_of_xftfont ()
529 xftfont_driver.type = Qxft; 544 xftfont_driver.type = Qxft;
530 xftfont_driver.get_cache = xfont_driver.get_cache; 545 xftfont_driver.get_cache = xfont_driver.get_cache;
531 xftfont_driver.list = xftfont_list; 546 xftfont_driver.list = xftfont_list;
547 xftfont_driver.match = xftfont_match;
532 xftfont_driver.open = xftfont_open; 548 xftfont_driver.open = xftfont_open;
533 xftfont_driver.close = xftfont_close; 549 xftfont_driver.close = xftfont_close;
534 xftfont_driver.prepare_face = xftfont_prepare_face; 550 xftfont_driver.prepare_face = xftfont_prepare_face;