From 45a2a330fbf3da0667c0f891b605df276d23963d Mon Sep 17 00:00:00 2001
Message-Id:
From: Eric Rannaud
Date: Sun, 20 Nov 2011 14:21:06 -0800
Subject: [PATCH 1/1] Add lcdfiltercustom option: controls the filter
individual weights
When lcdfilter is set to "lcdcustom", use lcdfiltercustom to retrieve a
string containing a space-separated list of double values between 0.0
and 1.0 and configure the rendered LCD filter (e.g. for freetype2, this
is done with FT_Library_SetLcdFilterWeights()).
If lcdfiltercustom is empty or is malformed, assume lcddefault.
With freetype2 as renderer, when fontconfig's FT_LCD_DEFAULT is mapped
to freetype2's FT_LCD_FILTER_DEFAULT, the configuration
lcddefault
corresponds to setting
lcdcustom
.0625 .25 .4375 .25 .0625
---
doc/fontconfig-user.sgml | 5 +++++
fontconfig/fontconfig.h | 2 ++
src/fcname.c | 4 +++-
3 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/doc/fontconfig-user.sgml b/doc/fontconfig-user.sgml
index 217feb9..ef34254 100644
--- a/doc/fontconfig-user.sgml
+++ b/doc/fontconfig-user.sgml
@@ -122,6 +122,10 @@ convenience for the applications' rendering mechanism.
rgba Int unknown, rgb, bgr, vrgb, vbgr,
none - subpixel geometry
lcdfilter Int Type of LCD filter
+ lcdfiltercustom String Weights for the custom LCD filter, enabled by setting
+ lcdfilter to lcdcustom. Example:
+ ".0625 .25 .4375 .25 .0625" corresponds to
+ setting the option lcdfilter to lcddefault.
minspace Bool Eliminate leading from line spacing
charset CharSet Unicode chars encoded by the font
lang String List of RFC-3066-style languages this
@@ -494,6 +498,7 @@ symbolic names for common font values:
lcddefault lcdfilter 1
lcdlight lcdfilter 2
lcdlegacy lcdfilter 3
+ lcdcustom lcdfilter 4
hintnone hintstyle 0
hintslight hintstyle 1
hintmedium hintstyle 2
diff --git a/fontconfig/fontconfig.h b/fontconfig/fontconfig.h
index db26b97..f05f570 100644
--- a/fontconfig/fontconfig.h
+++ b/fontconfig/fontconfig.h
@@ -111,6 +111,7 @@ typedef int FcBool;
#define FC_EMBEDDED_BITMAP "embeddedbitmap" /* Bool - true to enable embedded bitmaps */
#define FC_DECORATIVE "decorative" /* Bool - true if style is a decorative variant */
#define FC_LCD_FILTER "lcdfilter" /* Int */
+#define FC_LCD_FILTER_CUSTOM "lcdfiltercustom" /* String. Space separated list of double */
#define FC_CACHE_SUFFIX ".cache-"FC_CACHE_VERSION
#define FC_DIR_CACHE_FILE "fonts.cache-"FC_CACHE_VERSION
@@ -177,6 +178,7 @@ typedef int FcBool;
#define FC_LCD_DEFAULT 1
#define FC_LCD_LIGHT 2
#define FC_LCD_LEGACY 3
+#define FC_LCD_CUSTOM 4
typedef enum _FcType {
FcTypeVoid,
diff --git a/src/fcname.c b/src/fcname.c
index d77eff6..0697d10 100644
--- a/src/fcname.c
+++ b/src/fcname.c
@@ -75,7 +75,8 @@ static const FcObjectType _FcBaseObjectTypes[] = {
{ FC_EMBOLDEN, FcTypeBool },
{ FC_EMBEDDED_BITMAP, FcTypeBool },
{ FC_DECORATIVE, FcTypeBool },
- { FC_LCD_FILTER, FcTypeInteger }, /* 41 */
+ { FC_LCD_FILTER, FcTypeInteger },
+ { FC_LCD_FILTER_CUSTOM, FcTypeString }, /* 42 */
};
#define NUM_OBJECT_TYPES (sizeof _FcBaseObjectTypes / sizeof _FcBaseObjectTypes[0])
@@ -454,6 +455,7 @@ static const FcConstant _FcBaseConstants[] = {
{ (FcChar8 *) "lcddefault", "lcdfilter", FC_LCD_DEFAULT },
{ (FcChar8 *) "lcdlight", "lcdfilter", FC_LCD_LIGHT },
{ (FcChar8 *) "lcdlegacy", "lcdfilter", FC_LCD_LEGACY },
+ { (FcChar8 *) "lcdcustom", "lcdfilter", FC_LCD_CUSTOM },
};
#define NUM_FC_CONSTANTS (sizeof _FcBaseConstants/sizeof _FcBaseConstants[0])
--
1.7.6.4