Hi Andrej, Andrej Spielmann wrote: > Hello everybody, > > I would like to submit a proposal for the sub-pixel antialiasing project > for GSoC. I know the basics of how sub-pixel antialiasing works and I > think that the most important part of this project would actually be to > get a complex understanding of how text-rendering in Haiku works. Could > you please suggest any materials that would help me familiarize myself > with the structure of Haiku's app_server and font rendering. I would like > to get a more precise idea of what needs to be done before writing the > application. This is a nice project, thanks for considering it! :-) All the code that is involved is at src/servers/app/drawing/Painter/. Some AGG code might need to be adjusted at src/libs/agg and headers/libs/agg. (The rasterizer clipping could interfere when trying to generate scanlines with triple X resolution.) Two things happen for text rendering: The text either is or is not transformed (not scaled or rotated). For the untransformed case, a cache of bitmaps for each glyph is used, generated by Freetype, otherwise a cache of vector glyphs is used. In both cases, the AGG backend is used to generate so called "scanlines of coverage values". These scanlines are passed to the different drawing mode implementations (see src/servers/app/drawing/Painter/drawing_modes) and contain one coverage value on [0..255] per pixel. The DrawingModes apply a drawing mode (copy, over, add, blend, alpha, etc) between a high color and a low color. The coverage values define a smooth transition of the result. The cleanest way to implement sub-pixel anti-aliasing would be to support it for any and all vector drawing at once, not only text rendering. Then you would have to change every DrawingMode implementation to interprete the coverage values as triples for individual red, green and blue subpixels. Or better yet, write a complete alternative set of DrawingModes, so the feature could be turned on/off. The last thing to do would be to change the code path which generates the glyph bitmaps directly to use the Freetype subpixel version. And whereever Painter uses the AGG rasterizer, it would need to triple the X resolution. I know that there is some filtering involved to avoid strong color fringing. You need to define where this happens. I assume Freetype already does it, but for the normal vector pipelines, you would need to do it yourself "somewhere". Also see my old article on Painter and AGG here: <http://www.haiku-os.org/documents/dev/painter_and_how_agg_works> If you have any further questions, please don't hesitate to post them here! Best regards, -Stephan