Hello,

I'm quite sure this is not going to garner a lot of support, but I
personally find that fonts are not rendered bold enough on Linux (no
matter what particular antialiasing or hinting setting you choose).
And no matter what font you choose. (Fonts that have a weight 600 look
better, but in practice, it's difficult to replace all fonts.)

So I went ahead and patched freetype2 on my system and changed the FIR
weights for lcd_filter_func. See patch attached.

static const FT_Byte  heavy_filter[5] =
                            { 0x40, 0x80, 0x90, 0x80, 0x40 };

On the left with FT_LCD_FILTER_HEAVY, on the right with FT_LCD_FILTER_DEFAULT:

https://lh6.googleusercontent.com/-_oEuCOK1GYU/TsdPvEYO4rI/AAAAAAAABH4/8sxrozofATU/s1300/freetype2-heavy-01.jpg

I just find the left version a lot easier to read.

The new FT_LCD_FILTER_HEAVY is very heavy handed, I'll admit. It looks
great with serif fonts such as Georgia (or so I think), but it may be
excessive with sans-serif fonts.

So I don't really expect you would want to include this as submitted.
What would be a better way to offer a "bolder" rendering option to
people like me?

Define a new GConf or fontconfig flag and Call
FT_Library_SetLcdFilterWeights() from there? Should it be a flag with
predefined weights or should we allow users to choose weight
explicitly?

Something like:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <match target="font">
    <edit name="lcd_filter_weight_0" mode="assign">
      <int>0x40</int>
    </edit>
    <edit name="lcd_filter_weight_1" mode="assign">
      <int>0x80</int>
    </edit>
    <edit name="lcd_filter_weight_2" mode="assign">
      <int>0x90</int>
    </edit>
    <edit name="lcd_filter_weight_3" mode="assign">
      <int>0x80</int>
    </edit>
    <edit name="lcd_filter_weight_4" mode="assign">
      <int>0x40</int>
    </edit>
  </match>
</fontconfig>

Thanks.
From e565138d643f192e7cfa8a38da9e7699ea3c7b22 Mon Sep 17 00:00:00 2001
Message-Id: <e565138d643f192e7cfa8a38da9e7699ea3c7b22.1321685334.gi...@nanocritical.com>
From: Eric Rannaud <[email protected]>
Date: Fri, 18 Nov 2011 21:17:29 -0800
Subject: [PATCH 1/1] * include/freetype/ftlcdfil.h, src/base/ftlcdfilt.c:
 Introduce new   LCD filter configuration
 FT_LCD_FILTER_HEAVY.

---
 include/freetype/ftlcdfil.h |   12 +++++++++++-
 src/base/ftlcdfil.c         |   10 +++++++++-
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/include/freetype/ftlcdfil.h b/include/freetype/ftlcdfil.h
index 0b55ebe..bf9d25b 100644
--- a/include/freetype/ftlcdfil.h
+++ b/include/freetype/ftlcdfil.h
@@ -78,6 +78,14 @@ FT_BEGIN_HEADER
    *     cost of slightly more color fringes than the default one.  It might
    *     be better, depending on taste, your monitor, or your personal vision.
    *
+   *   FT_LCD_FILTER_HEAVY ::
+   *     The heavy filter is a variant that produces a bolder (or "fat") result
+   *     with a little more bluriness than the default filter. It
+   *     sort of corresponds to an important gamma correction and may depart
+   *     significantly from the intended weight of the font. However, you
+   *     may like it better, especially if you want a higher contrast or
+   *     find white text on a dark background to be rendered too lightly.
+   *
    *   FT_LCD_FILTER_LEGACY ::
    *     This filter corresponds to the original libXft color filter.  It
    *     provides high contrast output but can exhibit really bad color
@@ -96,6 +104,7 @@ FT_BEGIN_HEADER
     FT_LCD_FILTER_NONE    = 0,
     FT_LCD_FILTER_DEFAULT = 1,
     FT_LCD_FILTER_LIGHT   = 2,
+    FT_LCD_FILTER_HEAVY   = 3,
     FT_LCD_FILTER_LEGACY  = 16,
 
     FT_LCD_FILTER_MAX   /* do not remove */
@@ -172,7 +181,8 @@ FT_BEGIN_HEADER
    *   @FT_Library_SetLcdFilter.  By default, FreeType uses the quintuple
    *   (0x00, 0x55, 0x56, 0x55, 0x00) for FT_LCD_FILTER_LIGHT, and (0x10,
    *   0x40, 0x70, 0x40, 0x10) for FT_LCD_FILTER_DEFAULT and
-   *   FT_LCD_FILTER_LEGACY.
+   *   FT_LCD_FILTER_LEGACY, and (0x40, 0x80, 0x90, 0x80, 0x40) for
+   *   FT_LCD_FILTER_HEAVY.
    *
    * @input:
    *   library ::
diff --git a/src/base/ftlcdfil.c b/src/base/ftlcdfil.c
index 0da4ba1..872961b 100644
--- a/src/base/ftlcdfil.c
+++ b/src/base/ftlcdfil.c
@@ -289,7 +289,9 @@
     /* providing a cheap gamma correction                 */
     static const FT_Byte  default_filter[5] =
                             { 0x10, 0x40, 0x70, 0x40, 0x10 };
-
+    /* idem */
+    static const FT_Byte  heavy_filter[5] =
+                            { 0x40, 0x80, 0x90, 0x80, 0x40 };
 
     if ( !library )
       return FT_Err_Invalid_Argument;
@@ -323,6 +325,12 @@
 
       break;
 
+    case FT_LCD_FILTER_HEAVY:
+      ft_memcpy( library->lcd_weights, heavy_filter, 5 );
+      library->lcd_filter_func = _ft_lcd_filter_fir;
+      library->lcd_extra       = 2;
+      break;
+
     case FT_LCD_FILTER_LIGHT:
       ft_memcpy( library->lcd_weights, light_filter, 5 );
       library->lcd_filter_func = _ft_lcd_filter_fir;
-- 
1.7.6.4

_______________________________________________
Freetype-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/freetype-devel

Reply via email to