diff options
| author | Kenichi Handa | 2006-08-01 01:18:34 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2006-08-01 01:18:34 +0000 |
| commit | 10aca0f7ef4b2adde76123608f1dcf956a36b62b (patch) | |
| tree | 7c594b7bd2e4534c23512d23cc4bae74d5704ea8 /src | |
| parent | da369b6b254ef55243997b5d7f0424ff48021b18 (diff) | |
| download | emacs-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.c | 40 |
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 | |||
| 56 | struct xftface_info | 57 | struct 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, | |||
| 66 | static Font xftfont_default_fid P_ ((FRAME_PTR)); | 67 | static 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 | |||
| 71 | static void | 74 | static void |
| 72 | xftfont_get_colors (f, face, gc, xftface_info, fg, bg) | 75 | xftfont_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 | ||
| 134 | static Font | 139 | static Font |
| 135 | xftfont_default_fid (f) | 140 | xftfont_default_fid (f) |
| @@ -154,6 +159,7 @@ xftfont_default_fid (f) | |||
| 154 | 159 | ||
| 155 | 160 | ||
| 156 | static Lisp_Object xftfont_list P_ ((Lisp_Object, Lisp_Object)); | 161 | static Lisp_Object xftfont_list P_ ((Lisp_Object, Lisp_Object)); |
| 162 | static Lisp_Object xftfont_match P_ ((Lisp_Object, Lisp_Object)); | ||
| 157 | static struct font *xftfont_open P_ ((FRAME_PTR, Lisp_Object, int)); | 163 | static struct font *xftfont_open P_ ((FRAME_PTR, Lisp_Object, int)); |
| 158 | static void xftfont_close P_ ((FRAME_PTR, struct font *)); | 164 | static void xftfont_close P_ ((FRAME_PTR, struct font *)); |
| 159 | static int xftfont_prepare_face P_ ((FRAME_PTR, struct face *)); | 165 | static 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 | ||
| 191 | static Lisp_Object | ||
| 192 | xftfont_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 | |||
| 188 | static FcChar8 ascii_printable[95]; | 203 | static FcChar8 ascii_printable[95]; |
| 189 | 204 | ||
| 190 | static struct font * | 205 | static 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; |