freetype
[Top][All Lists]
Advanced

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

Re: [ft] anti-aliasing question


From: Tor Andersson
Subject: Re: [ft] anti-aliasing question
Date: Mon, 1 Feb 2010 00:11:27 +0100

On Sun, Jan 31, 2010 at 11:58 PM, Dave Calkins <address@hidden> wrote:
>
>
>>> Still haven't found the answer to this.  However, if I'm correct in
>>> saying
>>> that FreeType is generating a grayscale rendering of the glyph using
>>> anti-aliasing, then is there some way to control how much anti-aliasing
>>> FreeType applies when its rendering the glyph?
>>>
>>
>> No. It's either anti-aliased or it isn't (FT_RENDER_MODE_MONO).
>>
>>
>
> Do you mean no there isn't a public interface to control the degree of
> anti-aliasing or no there is no way in the code the anti-aliasing can be
> controlled?  I'm confused on this because somehow FreeType is creating white
> pixels and shades of gray pixels to render the glyph so I'm guessing there's
> some sort of determination internally which must affect how many gray pixels
> you end up getting.

The gray value depends on how much the shape of the
glyph covers the area of the pixel. Fully covered pixels
become black, uncovered pixels white, and a 50% covered
pixel will be 50% gray.

To get the result you want, the shape of the glyph has to
be changed so that fewer pixels will be partially covered.
This is what hinting does: deform the outline to align with
the pixel grid.

>> Removing the FT_LOAD_NO_HINTING flag should affect the rendering
>> in the way you have been asking.
>
> I tried removing that flag before and saw no difference in the
> anti-aliasing.  Perhaps I missed something or my test was incorrect.  I'll
> try that again and see if I can get it to have any effect.

Try it again, the difference between hinted and unhinted should
be pretty drastic.

Which font are you using by the way? Some fonts have better
hinting instructions than others. You should also make sure that
your freetype library is compiled with the bytecode interpreter
enabled if you want to match windows' rendering (look at ftoption.h).

-Tor




reply via email to

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