freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Devel] Gamma correction for anti-aliasing


From: Keith Packard
Subject: Re: [Devel] Gamma correction for anti-aliasing
Date: Sat, 08 Jun 2002 10:12:02 -0700

Around 9 o'clock on Jun 8, Vincent Caron wrote:

> - What about an interface to set this gamma value in FreeType ? I'm
> actually not sure if it's FreeType job's : it advertises that it
> provides exact pixel coverage value, and that's it. But I guess it
> should capitalize some subtile knowledge like this gamma trick. Anyway,
> I don't know where to plug that setting. Waiting for David's thoughts.

It can't be freetype's job -- it completely depends on the colors used to 
draw the text.  Drawing light text on a dark background requires opposite 
correction from drawing dark text on a light background.

In addition, the "exact pixel coverage" that FreeType computes makes the 
rather rash assumption that pixels are square -- analog monitors generate 
pixels that are approximately gaussian in shape.  Note that this exact 
coverage is essentially a 'box' filter on the shape of the glyph, and box 
filters generate quite a bit of noise; FreeType should probably be using a 
"real" low-pass filter to reduce this noise even further, but that 
will generate quite a few non-zero pixel values quite a ways from the edge 
of the glyph.

>  - you can toggle ClearType(r)(c)(tm) on/off : of great help for LCD
> screens. The LCD situation is actually remarkable : regular AA (gray
> shades) looks awful (pixels are too big and too close), while ClearType
> is a tremendous improvement upon CRT itself (it triples the resolution
> along one direction).

FreeType can already do this; use a matrix to expand the outline by a 
factor of three and then pick off the R G and B elements separately.  Note 
that you'll want to use a filter to reduce the contrast among the 
sub-pixel elements to reduce color fringing.  Examples of what this looks 
like can be see at:

        http://www.xfree86.org/~keithp/render/clear.html

Reducing the color fringing also reduces the effective improvement in 
horizontal resolution; I think it gives about a factor of two or so with 
the filter I use.

Keith Packard        XFree86 Core Team        HP Cambridge Research Lab





reply via email to

[Prev in Thread] Current Thread [Next in Thread]