[haiku-development] Re: Text rendering

  • From: Stephan Assmus <superstippi@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 12 Jun 2007 22:09:29 +0200

Claudio Leite wrote (2007-06-12, 21:08:05 [+0200]):
> * Stephan Assmus (superstippi@xxxxxx) wrote:
> <snip>
> > 
> > So what do you need to do?
> > 
> > You need to reimplement every DrawingMode for text. These special versions
> > will have to treat the alpha values from the scanlines as alpha versions
> > per subpixel (so triplets of alpha values). You need to apply filtering
> > (weighting!) or you will get colored glyph edges. See the agg mailing list
> > archive for the code for that (or libfreetype). Then you need to make
> > freetype render the glyph bitmaps with triple horizontal resolution for
> > non-transformed glyphs, as well as the rasterizer for transformed glyphs.
> > The first one is accomplished by changing agg_font_freetype, the second 
> > one
> > might be tricky because the rasterizer needs to be made to think the
> > available rendering buffer is two times larger in width.
> 
> First, thanks for the thorough introduction.
> 
> Let's assume I just do this for non-transformed glyphs. Freetype (as of
> 2.3.0) has a built-in LCD filter that looks great as far as I can tell.
> According to freetype documentation, turning this on and rendering with
> FT_RENDER_MODE_LCD returns the 3x bigger bitmap with R-G-B info. So, I
> should be able to just implement the DrawingModes to make this work, right?

Yes. But you need to find out wether the freetype code already does the 
necessary weighting.
Also, if using the existing AGG framework proves too much of a hassle at 
first, you could also try to bypass it, I haven't looked at the code in quite 
a while, but it shouldn't be very involved to use the renderer directly with 
the ft bitmap. Once you have written the special DrawingModes, we could 
always switch to a fully LCD subpixel based rendering for any vector shapes 
later.

> I see that AGG has a scanline32 class--would this be of any help?

I'm not sure it would. Could be this is used by the compound rasterizer, but 
I really don't know.

In any case, you can send patches to me and I will commit them. You just need 
to stick to our coding style... :-) After you have proven yourself, you 
should get commit access fairly soon, if you want that.

Best regards,
-Stephan

Other related posts: