[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ft-devel] Light Autofit + RGB Filtering
From: |
James Cloos |
Subject: |
[ft-devel] Light Autofit + RGB Filtering |
Date: |
Tue, 31 May 2011 19:21:29 -0400 |
User-agent: |
Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) |
A few months back aging eyes and displays forced me to change my UI font
preferences. Up until then I primarily used fonts which had stem widths
of one pixel. In fontconfig pattern syntax, I used faces such as:
DejaVu Sans Mono:pixelsize=15:minspace=true:autohint=false
DejaVu Serif:pixelsize=15:minspace=true:autohint=false
After considerable testing, I ended up with:
DejaVu Sans Mono:pixelsize=20:minspace=true:autohint=true
DejaVu Serif:pixelsize=20:minspace=true:autohint=true
as my preferences.
I had already had fontconfig configured to suggest freetype’s legacy
lcd filter for instructed sfnt/glyf faces and its default filter for
all other faces.
The buggest annoyance I hit was the fact that the autofitter adjusts
glyphs’ advance widths. The resulted in DejaVu Sans Mono’s asterisk
glyph being a (sub-?)pixel wider than its space glyph, causing text
to reposition in my Gnus Summary buffers when I *-tagged messages.
Fontconfig and freetype make it easy to force lcd filtering and autofit,
but I do not see any easy way to get lcd filtering with light autofit.
I first tested a ft patch which only avoided changes to advance width.
That produced ugly output.
The below patch changes every test for (mode == FT_RENDER_MODE_LIGHT)
to (true) and (mode != FT_RENDER_MODE_LIGHT) to (false).
To my eyes, on this display, the results look substantially better than
the defaults for autofit+lcd. The horizontal stems tend to get fit to a
single pixel tall and the vertical stems tend to be one of 1+3+1, 1+3+2,
2+3+1 or 2+3+2 sub-pixels wide. Which looks crisp; I cannot see any
colour fringing at all.
IIRC, David at some point expressed a preference for the light autofit.
I’ve come to strongly agree.
I think we should look into making autofit fit in a single direction
by default.
The patch is not meant for upstreaming, but rather to allow easy testing
and to be mostly self-documenting:
diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c
index d7670f4..ae2a18a 100644
--- a/src/autofit/afcjk.c
+++ b/src/autofit/afcjk.c
@@ -1303,7 +1303,7 @@
/*
* We adjust stems to full pixels only if we don't use the `light' mode.
*/
- if ( mode != FT_RENDER_MODE_LIGHT )
+ if ( 0 )
other_flags |= AF_LATIN_HINTS_STEM_ADJUST;
if ( mode == FT_RENDER_MODE_MONO )
diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
index b939938..9b25781 100644
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -1495,7 +1495,7 @@
/*
* We adjust stems to full pixels only if we don't use the `light' mode.
*/
- if ( mode != FT_RENDER_MODE_LIGHT )
+ if ( 0 )
other_flags |= AF_LATIN_HINTS_STEM_ADJUST;
if ( mode == FT_RENDER_MODE_MONO )
@@ -1505,7 +1505,7 @@
* In `light' hinting mode we disable horizontal hinting completely.
* We also do it if the face is italic.
*/
- if ( mode == FT_RENDER_MODE_LIGHT ||
+ if ( 1 ||
( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 )
scaler_flags |= AF_SCALER_FLAG_NO_HORIZONTAL;
@@ -2235,7 +2235,7 @@
/* analyze glyph outline */
#ifdef AF_CONFIG_OPTION_USE_WARPER
- if ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT ||
+ if ( 1 ||
AF_HINTS_DO_HORIZONTAL( hints ) )
#else
if ( AF_HINTS_DO_HORIZONTAL( hints ) )
@@ -2260,7 +2260,7 @@
{
#ifdef AF_CONFIG_OPTION_USE_WARPER
if ( dim == AF_DIMENSION_HORZ &&
- metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT )
+ 1 )
{
AF_WarperRec warper;
FT_Fixed scale;
diff --git a/src/autofit/aflatin2.c b/src/autofit/aflatin2.c
index d84e53a..efdd74f 100644
--- a/src/autofit/aflatin2.c
+++ b/src/autofit/aflatin2.c
@@ -1512,7 +1512,7 @@
/*
* We adjust stems to full pixels only if we don't use the `light' mode.
*/
- if ( mode != FT_RENDER_MODE_LIGHT )
+ if ( 0 )
other_flags |= AF_LATIN_HINTS_STEM_ADJUST;
if ( mode == FT_RENDER_MODE_MONO )
@@ -1522,7 +1522,7 @@
* In `light' hinting mode we disable horizontal hinting completely.
* We also do it if the face is italic.
*/
- if ( mode == FT_RENDER_MODE_LIGHT ||
+ if ( 1 ||
(face->style_flags & FT_STYLE_FLAG_ITALIC) != 0 )
scaler_flags |= AF_SCALER_FLAG_NO_HORIZONTAL;
@@ -2286,7 +2286,7 @@
/* analyze glyph outline */
#ifdef AF_CONFIG_OPTION_USE_WARPER
- if ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT ||
+ if ( 1 ||
AF_HINTS_DO_HORIZONTAL( hints ) )
#else
if ( AF_HINTS_DO_HORIZONTAL( hints ) )
@@ -2311,7 +2311,7 @@
{
#ifdef AF_CONFIG_OPTION_USE_WARPER
if ( ( dim == AF_DIMENSION_HORZ &&
- metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT ) )
+ 1 ) )
{
AF_WarperRec warper;
FT_Fixed scale;
diff --git a/src/autofit/afloader.c b/src/autofit/afloader.c
index 966a0df..00c4acc 100644
--- a/src/autofit/afloader.c
+++ b/src/autofit/afloader.c
@@ -181,7 +181,7 @@
/* we now need to adjust the metrics according to the change in */
/* width/positioning that occurred during the hinting process */
- if ( scaler->render_mode != FT_RENDER_MODE_LIGHT )
+ if ( 0 )
{
FT_Pos old_rsb, old_lsb, new_lsb;
FT_Pos pp1x_uh, pp2x_uh;
diff --git a/src/pshinter/pshalgo.c b/src/pshinter/pshalgo.c
index d798978..847763b 100644
--- a/src/pshinter/pshalgo.c
+++ b/src/pshinter/pshalgo.c
@@ -658,7 +658,7 @@
}
-#if 0 /* not used for now, experimental */
+#if 1 /* not used for now, experimental */
/*
* A variant to perform "light" hinting (i.e. FT_RENDER_MODE_LIGHT)
@@ -2260,7 +2260,7 @@
glyph->do_vert_snapping = FT_BOOL( hint_mode == FT_RENDER_MODE_MONO ||
hint_mode == FT_RENDER_MODE_LCD_V );
- glyph->do_stem_adjust = FT_BOOL( hint_mode != FT_RENDER_MODE_LIGHT );
+ glyph->do_stem_adjust = FT_BOOL( 0 );
for ( dimension = 0; dimension < 2; dimension++ )
{
-JimC
--
James Cloos <address@hidden> OpenPGP: 1024D/ED7DAEA6
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [ft-devel] Light Autofit + RGB Filtering,
James Cloos <=