freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] Freetype2/Subpixel Question (OpenSceneGraph)


From: David Turner
Subject: Re: [ft-devel] Freetype2/Subpixel Question (OpenSceneGraph)
Date: Tue, 14 Nov 2006 17:27:14 +0100

Hello Jeremy,

On Tue, 14 Nov 2006 10:53:11 -0500, "Jeremy Moles" <address@hidden> said:
> Greetings all. :) I'm experimenting with enabling subpixel hinting in an
> OpenSceneGraph application (which already has freetype2 support). I've
> been using this information which, although it's from 2002, still seems
> consistent with the API docs:
> 
> http://lists.nongnu.org/archive/html/freetype-devel/2002-11/msg00087.html
>

The documentation found there is old but still true if you do *not* use the
FT_LOAD_RENDER flag when loading the flag.

If you do (and I suspect you do), then this is equivalent to doing:

  FT_Load_Glyph( face, glyph_index, FT_LOAD_TARGET_LCD );
  FT_Render_Glyph( face, FT_RENDER_MODE_LCD );
 
because your FT_LOAD_TARGET_LCD value will be converted into the
corresponding FT_RENDER_MODE_LCD.

the result if this is a bitmap that is 3 times larger than the original
glyph outline. In other words, FreeType did for you most of the work
described in the 2002 post.

this is described in the current API documentation, by the way.

Now, to get acceptable results to display, you need to be able to perform
RGB-decimated alpha-blending (a.k.a. composite alpha blending), and this
feature is not found on many graphics libraries. It's possible to do it
with OpenGL with three distinct passes though, but the details escape me
at the moment.

I suspect the OSG rendering code is going to need some changes. Let us
know when you get it working.

Hope this helps,

- David Turner
- The FreeType Project  (www.freetype.org)


> However, when I pass FT_LOAD_TARGET_LCD to the FT_Load_Char function,
> the fonts get rendered one on top of one another almost, and are
> stretched and distorted. Here are some screenshots:
> 
> http://cherustone.com/no-autohint.png
> http://cherustone.com/force-autohint-lcd.png
> 
> (The _only_ difference between these two screenshots is the
> FT_LOAD_TARGET_LCD flag)
> 
> I wouldn't bother asking the lists for this, but I just wanted to know
> if anyone has seen this before? Is it some kind of API misuse on my
> part? Or, is it more likely the OSG rendering code needs to be changed
> to "cope" with both types of glyphs? Are there any "gotchas" when
> rendering using subpixel hinted glyphs as opposed to not? (I thought at
> first the same code should work fine for both modes)
> 
> At any rate--thanks. :)
> 
> 
> 
> _______________________________________________
> Freetype-devel mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/freetype-devel




reply via email to

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