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: Jeremy Moles
Subject: Re: [ft-devel] Freetype2/Subpixel Question (OpenSceneGraph)
Date: Tue, 14 Nov 2006 11:50:51 -0500

On Tue, 2006-11-14 at 17:27 +0100, David Turner wrote:
> 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
> >

Wow, thanks for the quick reply. :)

> 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:

Yes, the call looks like:

FT_Load_Char(., ., FT_LOAD_NO_BITMAP|FT_LOAD_TARGET_LCD|FT_LOAD_RENDER);

>   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.

Unfortunately, I'm still not clear as to what's going on. :/ I can
certainly see that the resultant glyph is almost exactly 3 times larger,
but I'm not sure how to proceed in terms of fixing that or 'why' it's
done in the first place? I think I've looked over the API docs so much
I've confused myself...

Is there perhaps a link or two anyone has to font methodologies? I feel
like the scaling up 3x is done on purpose, and that I'm supposed to do
"something" with that, though I'm not sure what. :)

> 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.

Well, this part will certainly come next; for now, I just need to get
the dimensions right. Or, is there some relationship between the 3x
scale, the blending, and the final result that I'm missing?

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

Sorry if I'm asking dumb questions... basically, I just want to have
sharp, crisp fonts, though it looks like I'm going to have to go back to
square one so I can understand the implicit things going on underneath
the hood. I guess I've been spoiled by how easy Cairo (and other Linux
apps) make this, and though it would be as easy as flipping a bit
somewhere. :) *grin*

> - 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]