freetype-devel
[Top][All Lists]
Advanced

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

Re: [Devel] freetype LCD filtering


From: Sébastien Kunz-Jacques
Subject: Re: [Devel] freetype LCD filtering
Date: Fri, 23 Jan 2004 16:06:53 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; fr-FR; rv:1.4) Gecko/20030630

Turner David a écrit :

Hello Sebastien,
- In experiencing with a nonlinear filtering aimed at
increasing glyph contrast,  I noticed that the
antialiasing algorithm used by freetype changes
between 34 and 35pt : exact coverage for ppem<35,
supersampling above. the supersampling gives
lower-quality results than the exact coverage algo;
where do I have to modify the freetype source in order
to use the exact coverage algorithm everytime? What is
the order of magnitude of the performance loss?

I don't see what you're speaking about ? FreeType doesn't
switch rendering algorithms based on the character pixel
sizes. And switching to super-sampling _above_ 35 pixels
would be a disaster in terms of performance anyway.

Thanks for your quick response.

I use the code of freetype 2.1.7. In src/smooth/ftgrays.c, the comments about the code explain the differences between the antialiasing methods used in this file and the one implemented in src/raster/ftraster.c. One is an exact covering method, the other is a supersampling technique. I didn't pay any attention to this at first. Then I experienced the use of a nonlinear function favoring extreme values (dark grays appear darker, light grays lighter) to enhance contrast after antialiasing without completely losing the antialiased aspect (see "nltable" defined in the modified source file ftview.c). This yields good results for point sizes below 35pt (100dpi), but suddenly above 35pt I get "stairs" effects on some letters. Tracking down the problem I saw that letters above 35pt used much less gray levels (4-5) than below 35pt (the whole palette, it seems) (this appears clearly using the zoom feature I added in the render_text mode of ftview, see below). Since a 2x2 oversampling renderer uses only 5 gray levels, and since the comments of the file ftgrays.c explain that the exact coverage technique is more efficient than the oversampling one for small faces, I convinced myself (without looking in freetype code, I must admit...) that there was some kind of switch between the two antialiasing methods depending on the size of the rendered face.

we'd be interested in seeing this code.
Here you are. The archive contain the 2 files I modified in the (2.1.7) demo programs archive and one file defining filter coefficients. All 3 should lie in src/. The options of ftview are modified (there is for example a 3x3 zoom, I deactivated waterfall rendering mode), see help.

Sébastien Kunz-Jacques


Attachment: filtering_source.tgz
Description: GNU Zip compressed data


reply via email to

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