From 223e5fc656a6c8a95e5aac334e8c7b82cc9d2a4b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Dj=C3=A4rv?= Date: Sun, 13 Dec 2009 13:16:17 +0000 Subject: [PATCH] xftfont.c: Parse symbolic names for constants also. (QClcdfilter): New variable. (xftfont_open): Parse constant names for RGBA, HINT_STYLE and LCDFILTER. (syms_of_xftfont): Initialize QClcdfilter. --- src/ChangeLog | 6 ++++++ src/xftfont.c | 22 +++++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index ee05443152f..348300ee2da 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2009-12-13 Jan Djärv + + * xftfont.c (QClcdfilter): New variable. + (xftfont_open): Parse constant names for RGBA, HINT_STYLE and LCDFILTER. + (syms_of_xftfont): Initialize QClcdfilter. + 2009-12-12 Jan Djärv * xsettings.c (struct xsettings): Add member seen. diff --git a/src/xftfont.c b/src/xftfont.c index 4675875496a..82701ce0afe 100644 --- a/src/xftfont.c +++ b/src/xftfont.c @@ -39,7 +39,8 @@ along with GNU Emacs. If not, see . */ /* Xft font driver. */ static Lisp_Object Qxft; -static Lisp_Object QChinting , QCautohint, QChintstyle, QCrgba, QCembolden; +static Lisp_Object QChinting, QCautohint, QChintstyle, QCrgba, QCembolden, + QClcdfilter; /* The actual structure for Xft font that can be casted to struct font. */ @@ -252,7 +253,7 @@ xftfont_open (f, entity, pixel_size) XftFont *xftfont = NULL; int spacing; char name[256]; - int len, i; + int len, i, ival; XGlyphInfo extents; FT_Face ft_face; FcMatrix *matrix; @@ -311,11 +312,25 @@ xftfont_open (f, entity, pixel_size) { if (INTEGERP (val)) FcPatternAddInteger (pat, FC_HINT_STYLE, XINT (val)); + else if (SYMBOLP (val) + && FcNameConstant (SDATA (SYMBOL_NAME (val)), &ival)) + FcPatternAddInteger (pat, FC_HINT_STYLE, ival); } else if (EQ (key, QCrgba)) { if (INTEGERP (val)) FcPatternAddInteger (pat, FC_RGBA, XINT (val)); + else if (SYMBOLP (val) + && FcNameConstant (SDATA (SYMBOL_NAME (val)), &ival)) + FcPatternAddInteger (pat, FC_RGBA, ival); + } + else if (EQ (key, QClcdfilter)) + { + if (INTEGERP (val)) + FcPatternAddInteger (pat, FC_LCD_FILTER, ival = XINT (val)); + else if (SYMBOLP (val) + && FcNameConstant (SDATA (SYMBOL_NAME (val)), &ival)) + FcPatternAddInteger (pat, FC_LCD_FILTER, ival); } #ifdef FC_EMBOLDEN else if (EQ (key, QCembolden)) @@ -343,7 +358,7 @@ xftfont_open (f, entity, pixel_size) XftDefaultSubstitute (display, FRAME_X_SCREEN_NUMBER (f), pat); match = XftFontMatch (display, FRAME_X_SCREEN_NUMBER (f), pat, &result); xftfont_fix_match (pat, match); - + FcPatternDestroy (pat); xftfont = XftFontOpenPattern (display, match); if (!xftfont) @@ -706,6 +721,7 @@ syms_of_xftfont () DEFSYM (QChintstyle, ":hintstyle"); DEFSYM (QCrgba, ":rgba"); DEFSYM (QCembolden, ":embolden"); + DEFSYM (QClcdfilter, ":lcdfilter"); xftfont_driver = ftfont_driver; xftfont_driver.type = Qxft; -- 2.39.2