Mercurial > emacs
changeset 90559:fb5d3ac2d786
(xftfont_match): New function.
(syms_of_xftfont): Set xftfont_driver.match to xftfont_match.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Tue, 01 Aug 2006 01:18:34 +0000 |
parents | 1c287c3d1698 |
children | c443c8a56b84 |
files | src/xftfont.c |
diffstat | 1 files changed, 28 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/src/xftfont.c Fri Jul 28 12:53:14 2006 +0000 +++ b/src/xftfont.c Tue Aug 01 01:18:34 2006 +0000 @@ -49,14 +49,15 @@ Display *display; int screen; XftFont *xftfont; - FT_Face ft_face; + FT_Face ft_face; /* set to XftLockFace (xftfont) */ }; /* Structure pointed by (struct face *)->extra */ + struct xftface_info { - XftColor xft_fg; - XftColor xft_bg; + XftColor xft_fg; /* color for face->foreground */ + XftColor xft_bg; /* color for face->background */ XftDraw *xft_draw; }; @@ -66,8 +67,10 @@ static Font xftfont_default_fid P_ ((FRAME_PTR)); -/* Setup colors pointed by FG and BG for GC. If XFTFACE_INFO is not - NULL, reuse the colors in it if possible. BG may be NULL. */ +/* Setup foreground and background colors of GC into FG and BG. If + XFTFACE_INFO is not NULL, reuse the colors in it if possible. BG + may be NULL. */ + static void xftfont_get_colors (f, face, gc, xftface_info, fg, bg) FRAME_PTR f; @@ -129,7 +132,9 @@ } } -/* Return the default Font ID on frame F. */ +/* Return the default Font ID on frame F. The Returned Font ID is + stored in the GC of the frame F, but the font is never used. So, + any ID is ok as long as it is valid. */ static Font xftfont_default_fid (f) @@ -154,6 +159,7 @@ static Lisp_Object xftfont_list P_ ((Lisp_Object, Lisp_Object)); +static Lisp_Object xftfont_match P_ ((Lisp_Object, Lisp_Object)); static struct font *xftfont_open P_ ((FRAME_PTR, Lisp_Object, int)); static void xftfont_close P_ ((FRAME_PTR, struct font *)); static int xftfont_prepare_face P_ ((FRAME_PTR, struct face *)); @@ -174,15 +180,24 @@ Lisp_Object spec; { Lisp_Object val = ftfont_driver.list (frame, spec); + int i; if (! NILP (val)) - { - int i; + for (i = 0; i < ASIZE (val); i++) + ASET (AREF (val, i), FONT_TYPE_INDEX, Qxft); + return val; +} - for (i = 0; i < ASIZE (val); i++) - ASET (AREF (val, i), FONT_TYPE_INDEX, Qxft); - } - return val; +static Lisp_Object +xftfont_match (frame, spec) + Lisp_Object frame; + Lisp_Object spec; +{ + Lisp_Object entity = ftfont_driver.match (frame, spec); + + if (VECTORP (entity)) + ASET (entity, FONT_TYPE_INDEX, Qxft); + return entity; } static FcChar8 ascii_printable[95]; @@ -529,6 +544,7 @@ xftfont_driver.type = Qxft; xftfont_driver.get_cache = xfont_driver.get_cache; xftfont_driver.list = xftfont_list; + xftfont_driver.match = xftfont_match; xftfont_driver.open = xftfont_open; xftfont_driver.close = xftfont_close; xftfont_driver.prepare_face = xftfont_prepare_face;